Skip to content

Commit fb29487

Browse files
authored
sync: update CI config files (#119)
1 parent fbad710 commit fb29487

File tree

7 files changed

+52
-19
lines changed

7 files changed

+52
-19
lines changed

.github/workflows/automerge.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ jobs:
3333
automerge:
3434
needs: automerge-check
3535
runs-on: ubuntu-latest
36-
if: ${{ needs.automerge-check.outputs.status == 'true' }}
36+
# The check for the user is redundant here, as this job depends on the automerge-check job,
37+
# but it prevents this job from spinning up, just to be skipped shortly after.
38+
if: github.event.pull_request.user.login == 'web3-bot' && needs.automerge-check.outputs.status == 'true'
3739
steps:
3840
- name: Wait on tests
3941
uses: lewagon/wait-on-check-action@bafe56a6863672c681c3cf671f5e10b20abf2eaa # v0.2

.github/workflows/go-check.yml

+29-5
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,28 @@ jobs:
88
unit:
99
runs-on: ubuntu-latest
1010
name: All
11+
env:
12+
RUNGOGENERATE: false
1113
steps:
1214
- uses: actions/checkout@v2
1315
with:
1416
submodules: recursive
1517
- uses: actions/setup-go@v2
1618
with:
17-
go-version: "1.16.x"
19+
go-version: "1.17.x"
20+
- name: Run repo-specific setup
21+
uses: ./.github/actions/go-check-setup
22+
if: hashFiles('./.github/actions/go-check-setup') != ''
23+
- name: Read config
24+
if: hashFiles('./.github/workflows/go-check-config.json') != ''
25+
run: |
26+
if jq -re .gogenerate ./.github/workflows/go-check-config.json; then
27+
echo "RUNGOGENERATE=true" >> $GITHUB_ENV
28+
fi
1829
- name: Install staticcheck
19-
run: go install honnef.co/go/tools/cmd/staticcheck@434f5f3816b358fe468fa83dcba62d794e7fe04b # 2021.1 (v0.2.0)
30+
run: go install honnef.co/go/tools/cmd/staticcheck@df71e5d0e0ed317ebf43e6e59cf919430fa4b8f2 # 2021.1.1 (v0.2.1)
2031
- name: Check that go.mod is tidy
21-
uses: protocol/multiple-go-modules@v1.0
32+
uses: protocol/multiple-go-modules@v1.2
2233
with:
2334
run: |
2435
go mod tidy
@@ -37,14 +48,27 @@ jobs:
3748
fi
3849
- name: go vet
3950
if: ${{ success() || failure() }} # run this step even if the previous one failed
40-
uses: protocol/multiple-go-modules@v1.0
51+
uses: protocol/multiple-go-modules@v1.2
4152
with:
4253
run: go vet ./...
4354
- name: staticcheck
4455
if: ${{ success() || failure() }} # run this step even if the previous one failed
45-
uses: protocol/multiple-go-modules@v1.0
56+
uses: protocol/multiple-go-modules@v1.2
4657
with:
4758
run: |
4859
set -o pipefail
4960
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'
61+
- name: go generate
62+
uses: protocol/[email protected]
63+
if: (success() || failure()) && env.RUNGOGENERATE == 'true'
64+
with:
65+
run: |
66+
git clean -fd # make sure there aren't untracked files / directories
67+
go generate ./...
68+
# check if go generate modified or added any files
69+
if ! $(git add . && git diff-index HEAD --exit-code --quiet); then
70+
echo "go generated caused changes to the repository:"
71+
git status --short
72+
exit 1
73+
fi
5074

.github/workflows/go-test.yml

+15-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
os: [ "ubuntu", "windows", "macos" ]
13-
go: [ "1.15.x", "1.16.x" ]
13+
go: [ "1.16.x", "1.17.x" ]
14+
env:
15+
COVERAGES: ""
1416
runs-on: ${{ matrix.os }}-latest
1517
name: ${{ matrix.os}} (go ${{ matrix.go }})
1618
steps:
@@ -24,24 +26,30 @@ jobs:
2426
run: |
2527
go version
2628
go env
29+
- name: Run repo-specific setup
30+
uses: ./.github/actions/go-test-setup
31+
if: hashFiles('./.github/actions/go-test-setup') != ''
2732
- name: Run tests
28-
uses: protocol/multiple-go-modules@v1.0
33+
uses: protocol/multiple-go-modules@v1.2
2934
with:
30-
run: go test -v -coverprofile coverage.txt ./...
35+
run: go test -v -coverprofile module-coverage.txt ./...
3136
- name: Run tests (32 bit)
3237
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
33-
uses: protocol/multiple-go-modules@v1.0
38+
uses: protocol/multiple-go-modules@v1.2
3439
env:
3540
GOARCH: 386
3641
with:
3742
run: go test -v ./...
3843
- name: Run tests with race detector
3944
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
40-
uses: protocol/multiple-go-modules@v1.0
45+
uses: protocol/multiple-go-modules@v1.2
4146
with:
4247
run: go test -v -race ./...
48+
- name: Collect coverage files
49+
shell: bash
50+
run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
4351
- name: Upload coverage to Codecov
44-
uses: codecov/codecov-action@a1ed4b322b4b38cb846afb5a0ebfa17086917d27 # v1.5.0
52+
uses: codecov/codecov-action@51d810878be5422784e86451c0e7c14e5860ec47 # v2.0.2
4553
with:
46-
file: coverage.txt
54+
files: '${{ env.COVERAGES }}'
4755
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ require (
66
go.uber.org/zap v1.16.0
77
)
88

9-
go 1.15
9+
go 1.16

go.sum

-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
55
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
66
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
77
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
8-
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
98
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
109
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
11-
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
1210
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
1311
github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA=
1412
github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
@@ -51,7 +49,6 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 h1:hKsoRgsbwY1NafxrwTs+k64
5149
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
5250
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
5351
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
54-
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
5552
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
5653
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
5754
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=

path_other.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//+build !windows
1+
//go:build !windows
2+
// +build !windows
23

34
package log
45

path_windows.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//+build windows
1+
//go:build windows
2+
// +build windows
23

34
package log
45

0 commit comments

Comments
 (0)