From 3db40a79fe9d440698070ef873d1e154dcd57ed9 Mon Sep 17 00:00:00 2001 From: mjarkk Date: Tue, 27 Jul 2021 22:03:37 +0200 Subject: [PATCH 1/3] Sperate gh action build step --- .github/workflows/ci.yml | 38 ++++++++++++++++++++++++++++---------- .github/workflows/lint.yml | 6 ++++++ 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5cbd72b1..14857c44d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,19 +22,37 @@ jobs: uses: actions/cache@v1 with: path: ~/.cache/go-build - key: ${{runner.os}}-go-${{hashFiles('**/go.sum')}} + key: ${{runner.os}}-go-${{hashFiles('**/go.sum')}}-test restore-keys: | ${{runner.os}}-go- - - name: Format code - run: | - if [ $(find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \;|wc -l) -gt 0 ]; then - find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \; - exit 1 - fi - name: Test code run: | ./test.sh - - name: Build binaries - uses: goreleaser/goreleaser-action@v1 + build: + runs-on: ubuntu-latest + env: + GOFLAGS: -mod=vendor + GOARCH: amd64 + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v1 with: - args: --skip-publish --snapshot + go-version: 1.16.x + - name: Cache build + uses: actions/cache@v1 + with: + path: ~/.cache/go-build + key: ${{runner.os}}-go-${{hashFiles('**/go.sum')}}-build + restore-keys: | + ${{runner.os}}-go- + - name: Build linux binary + run: | + GOOS=linux go build + - name: Build windows binary + run: | + GOOS=windows go build + - name: Build darwin binary + run: | + GOOS=darwin go build diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 25659077e..08e339d8d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,3 +12,9 @@ jobs: uses: golangci/golangci-lint-action@v2 with: version: latest + - name: Format code + run: | + if [ $(find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \;|wc -l) -gt 0 ]; then + find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \; + exit 1 + fi From bfc98812131787f4872bf2017954408d6bffb3fe Mon Sep 17 00:00:00 2001 From: mjarkk Date: Wed, 28 Jul 2021 15:41:23 +0200 Subject: [PATCH 2/3] added changes that should fail the ci on windows --- pkg/secureexec/secureexec_windows.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/secureexec/secureexec_windows.go b/pkg/secureexec/secureexec_windows.go index 537e0bfc1..44461b686 100644 --- a/pkg/secureexec/secureexec_windows.go +++ b/pkg/secureexec/secureexec_windows.go @@ -20,6 +20,8 @@ import ( // you call `git status` from the command line directly but no harm in playing it // safe. +This should fail the CI only on windows + func Command(name string, args ...string) *exec.Cmd { bin, err := safeexec.LookPath(name) if err != nil { From 1183de151aefd87b8049aa0b501414d417ccaddb Mon Sep 17 00:00:00 2001 From: mjarkk Date: Wed, 28 Jul 2021 15:42:37 +0200 Subject: [PATCH 3/3] revert changes from bfc9881 --- pkg/secureexec/secureexec_windows.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkg/secureexec/secureexec_windows.go b/pkg/secureexec/secureexec_windows.go index 44461b686..537e0bfc1 100644 --- a/pkg/secureexec/secureexec_windows.go +++ b/pkg/secureexec/secureexec_windows.go @@ -20,8 +20,6 @@ import ( // you call `git status` from the command line directly but no harm in playing it // safe. -This should fail the CI only on windows - func Command(name string, args ...string) *exec.Cmd { bin, err := safeexec.LookPath(name) if err != nil {