Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Action CI/CD Migration #553

Merged
merged 5 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
559 changes: 0 additions & 559 deletions .circleci/config.yml

This file was deleted.

7 changes: 0 additions & 7 deletions .circleci/scripts/startup-ttl.sh

This file was deleted.

8 changes: 0 additions & 8 deletions .circleci/testdata/benchmark.yaml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/multi_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Build is responsible for testing builds on all supported platforms.
# It is broken up into three separate jobs with targeted builds so that each OS will
# build in parallel and speed up overall CI time.
name: Build
on:
pull_request:

jobs:
build_linux:
runs-on: ubuntu-20.04
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
check-latest: true
- name: Cache Go Modules
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build
run: make build-linux
jsirianni marked this conversation as resolved.
Show resolved Hide resolved
build_darwin:
runs-on: macos-11
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
check-latest: true
- name: Cache Go Modules
uses: actions/cache@v2
with:
path: |
~/Library/Caches/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build
run: make build-darwin
build_windows:
runs-on: windows-2019
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
check-latest: true
- name: Cache Go Modules
uses: actions/cache@v2
with:
path: |
%LocalAppData%\go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build
run: make build-windows
43 changes: 41 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: release

on:
push:
tags:
- 'v*'
tags:
- "v*"

jobs:
release:
Expand All @@ -28,3 +28,42 @@ jobs:
env:
# Default github token should have enough permissions to make a release
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-and-push-container-image:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
check-latest: true
- name: Set up Docker Buildx
cpheps marked this conversation as resolved.
Show resolved Hide resolved
id: buildx
uses: docker/setup-buildx-action@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
# Org level secrets
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Get Tag From Environment
id: get-tag
run: printf '::set-output name=tag::%s' "$(printf '%s' "${{ github.ref }}" | sed 's/refs\/tags\///')"
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: observiq/stanza:latest,observiq/stanza:${{ steps.get-tag.outputs.tag }}
59 changes: 59 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Tests
on:
pull_request:

jobs:
unit-tests:
strategy:
matrix:
os: [ubuntu-20.04, macos-11, windows-2019]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
check-latest: true

# Load caches based on OS
- name: Linux Cache Go Modules
if: matrix.os == 'ubuntu-20.04'
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: MacOS Cache Go Modules
if: matrix.os == 'macos-11'
uses: actions/cache@v2
with:
path: |
~/Library/Caches/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Windows Cache Go Modules
if: matrix.os == 'windows-2019'
uses: actions/cache@v2
with:
path: |
%LocalAppData%\go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Run Tests
jsirianni marked this conversation as resolved.
Show resolved Hide resolved
run: go test -race -coverprofile coverage.txt -coverpkg ./... ./...
cpheps marked this conversation as resolved.
Show resolved Hide resolved
- name: Upload Codecov
# Only submit code coverage if OS is Linux
if: matrix.os == 'ubuntu-20.04'
uses: codecov/codecov-action@v2.1.0
with:
files: ./coverage.txt
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ scan-license: build-all
$$GOPATH/bin/lichen --config=./license.yaml "./artifacts/stanza_darwin_amd64"

.PHONY: test
test: vet test-only
test: $(MAKE) for-all CMD="go test -race -coverprofile coverage.txt -coverpkg ./... ./..."

.PHONY: test-only
test-only:
$(MAKE) for-all CMD="go test -race -coverprofile coverage.txt -coverpkg ./... ./..."

.PHONY: test-integration
test-integration:
Expand Down Expand Up @@ -112,6 +109,15 @@ build:
install:
(cd ./cmd/stanza && CGO_ENABLED=0 go install .)

.PHONY: build-linux
build-linux: build-linux-amd64 build-linux-arm64

.PHONY: build-darwin
build-darwin: build-darwin-amd64 build-darwin-arm64

.PHONY: build-windows
build-windows: build-windows-amd64

.PHONY: build-all
build-all: build-darwin-amd64 build-darwin-arm64 build-linux-amd64 build-linux-arm64 build-windows-amd64

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<center>

[![<observIQ>](https://circleci.com/gh/observIQ/stanza.svg?style=shield&circle-token=980a514f9dc5a48ac2b8e61a4cdb7555ea5646ca)](https://app.circleci.com/pipelines/github/observIQ/stanza)
[![Action Status](https://github.com/observIQ/stanza/workflows/Build/badge.svg)](https://github.com/observIQ/stanza/actions)
[![Action Test Status](https://github.com/observIQ/stanza/workflows/Tests/badge.svg)](https://github.com/observIQ/stanza/actions)
[![codecov](https://codecov.io/gh/observIQ/stanza/branch/master/graph/badge.svg)](https://codecov.io/gh/observIQ/stanza)
[![Go Report Card](https://goreportcard.com/badge/github.com/observIQ/stanza)](https://goreportcard.com/report/github.com/observIQ/stanza)
[![License](https://github.com/observIQ/stanza/workflows/license/badge.svg)](https://github.com/observIQ/stanza/license)
Expand Down