Skip to content
This repository was archived by the owner on Mar 29, 2023. It is now read-only.

Commit 311e525

Browse files
authored
Merge pull request #40 from ipfs/web3-bot/sync
sync: update CI config files
2 parents 89dc171 + 43c0d02 commit 311e525

File tree

7 files changed

+51
-16
lines changed

7 files changed

+51
-16
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/multiple-go-modules@v1.2
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
golang.org/x/sys v0.0.0-20190302025703-b6889370fb10
77
)
88

9-
go 1.15
9+
go 1.16

go.sum

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
99
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
1010
golang.org/x/sys v0.0.0-20190302025703-b6889370fb10 h1:xQJI9OEiErEQ++DoXOHqEpzsGMrAv2Q2jyCpi7DmfpQ=
1111
golang.org/x/sys v0.0.0-20190302025703-b6889370fb10/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
12-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
1312
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1413
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
1514
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

is_hidden.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 files
45

is_hidden_windows.go

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

34
package files

0 commit comments

Comments
 (0)