From 1e31d06d3cacccd8b2794eb746b07bf4fb1a383c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6ling?= Date: Tue, 4 Aug 2020 00:16:46 +0200 Subject: [PATCH 1/2] Add Github Action for tests --- .github/workflows/go-test.yaml | 31 +++++++++++++++++++++++++++++++ version/git_test.go | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/go-test.yaml diff --git a/.github/workflows/go-test.yaml b/.github/workflows/go-test.yaml new file mode 100644 index 0000000..fe719c4 --- /dev/null +++ b/.github/workflows/go-test.yaml @@ -0,0 +1,31 @@ +name: Go Testing +on: + push: + branches: [ master ] + pull_request: +jobs: + golangci: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v1 + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: v1.29 + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Set up Go >= 1.14 + uses: actions/setup-go@v2 + with: + go-version: ^1.14 + id: go + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + - name: Get dependencies + run: go mod download + - name: Test + run: go test -v -covermode=count ./... diff --git a/version/git_test.go b/version/git_test.go index 285c01f..902ba10 100644 --- a/version/git_test.go +++ b/version/git_test.go @@ -15,6 +15,7 @@ func TestGitDescribe(t *testing.T) { t.Fatal(err) } defer os.RemoveAll(dir) - os.Chdir(dir) + err = os.Chdir(dir) + assert.NoError(err) assert.Equal("0.0.0-0-", git.Describe()) } From 2f4dc59153c46485bbc6e4134db25e88d43eada6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6ling?= Date: Tue, 4 Aug 2020 00:32:13 +0200 Subject: [PATCH 2/2] Add Github Action for releasing go binaries --- .github/workflows/release.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..7d45e53 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,25 @@ +name: Release Artifacts +on: + push: + tags: + - '*' +jobs: + goreleaser: + name: Release Binaries + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.14 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}