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

Commit ce728e4

Browse files
authored
sync: update CI config files (#30)
1 parent 596d336 commit ce728e4

File tree

3 files changed

+61
-19
lines changed

3 files changed

+61
-19
lines changed

.github/workflows/automerge.yml

+25-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,35 @@
55
# This reduces the friction associated with updating with our workflows.
66

77
on: [ pull_request ]
8+
name: Automerge
89

910
jobs:
10-
automerge:
11+
automerge-check:
1112
if: github.event.pull_request.user.login == 'web3-bot'
1213
runs-on: ubuntu-latest
14+
outputs:
15+
status: ${{ steps.should-automerge.outputs.status }}
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Check if we should automerge
21+
id: should-automerge
22+
run: |
23+
for commit in $(git rev-list --first-parent origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}); do
24+
committer=$(git show --format=$'%ce' -s $commit)
25+
echo "Committer: $committer"
26+
if [[ "$committer" != "web3-bot@users.noreply.github.com" ]]; then
27+
echo "Commit $commit wasn't committed by web3-bot, but by $committer."
28+
echo "::set-output name=status::false"
29+
exit
30+
fi
31+
done
32+
echo "::set-output name=status::true"
33+
automerge:
34+
needs: automerge-check
35+
runs-on: ubuntu-latest
36+
if: ${{ needs.automerge-check.outputs.status == 'true' }}
1337
steps:
1438
- name: Wait on tests
1539
uses: lewagon/wait-on-check-action@bafe56a6863672c681c3cf671f5e10b20abf2eaa # v0.2

.github/workflows/go-check.yml

+22-13
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,31 @@
22
# See https://github.com/protocol/.github/ for details.
33

44
on: [push, pull_request]
5+
name: Go Checks
56

67
jobs:
78
unit:
89
runs-on: ubuntu-latest
9-
name: Go checks
10+
name: All
1011
steps:
1112
- uses: actions/checkout@v2
13+
with:
14+
submodules: recursive
1215
- uses: actions/setup-go@v2
1316
with:
1417
go-version: "1.16.x"
1518
- name: Install staticcheck
16-
run: go install honnef.co/go/tools/cmd/staticcheck@be534f007836a777104a15f2456cd1fffd3ddee8 # v2020.2.2
19+
run: go install honnef.co/go/tools/cmd/staticcheck@434f5f3816b358fe468fa83dcba62d794e7fe04b # 2021.1 (v0.2.0)
1720
- name: Check that go.mod is tidy
18-
run: |
19-
go mod tidy
20-
if [[ -n $(git ls-files --other --exclude-standard --directory -- go.sum) ]]; then
21-
echo "go.sum was added by go mod tidy"
22-
exit 1
23-
fi
24-
git diff --exit-code -- go.sum go.mod
21+
uses: protocol/multiple-go-modules@v1.0
22+
with:
23+
run: |
24+
go mod tidy
25+
if [[ -n $(git ls-files --other --exclude-standard --directory -- go.sum) ]]; then
26+
echo "go.sum was added by go mod tidy"
27+
exit 1
28+
fi
29+
git diff --exit-code -- go.sum go.mod
2530
- name: gofmt
2631
if: ${{ success() || failure() }} # run this step even if the previous one failed
2732
run: |
@@ -32,10 +37,14 @@ jobs:
3237
fi
3338
- name: go vet
3439
if: ${{ success() || failure() }} # run this step even if the previous one failed
35-
run: go vet ./...
40+
uses: protocol/multiple-go-modules@v1.0
41+
with:
42+
run: go vet ./...
3643
- name: staticcheck
3744
if: ${{ success() || failure() }} # run this step even if the previous one failed
38-
run: |
39-
set -o pipefail
40-
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'
45+
uses: protocol/multiple-go-modules@v1.0
46+
with:
47+
run: |
48+
set -o pipefail
49+
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'
4150

.github/workflows/go-test.yml

+14-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# See https://github.com/protocol/.github/ for details.
33

44
on: [push, pull_request]
5+
name: Go Test
56

67
jobs:
78
unit:
@@ -11,9 +12,11 @@ jobs:
1112
os: [ "ubuntu", "windows", "macos" ]
1213
go: [ "1.15.x", "1.16.x" ]
1314
runs-on: ${{ matrix.os }}-latest
14-
name: Unit tests (${{ matrix.os}}, Go ${{ matrix.go }})
15+
name: ${{ matrix.os}} (go ${{ matrix.go }})
1516
steps:
1617
- uses: actions/checkout@v2
18+
with:
19+
submodules: recursive
1720
- uses: actions/setup-go@v2
1821
with:
1922
go-version: ${{ matrix.go }}
@@ -22,17 +25,23 @@ jobs:
2225
go version
2326
go env
2427
- name: Run tests
25-
run: go test -v -coverprofile coverage.txt ./...
28+
uses: protocol/multiple-go-modules@v1.0
29+
with:
30+
run: go test -v -coverprofile coverage.txt ./...
2631
- name: Run tests (32 bit)
2732
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
33+
uses: protocol/multiple-go-modules@v1.0
2834
env:
2935
GOARCH: 386
30-
run: go test -v ./...
36+
with:
37+
run: go test -v ./...
3138
- name: Run tests with race detector
3239
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
33-
run: go test -v -race ./...
40+
uses: protocol/multiple-go-modules@v1.0
41+
with:
42+
run: go test -v -race ./...
3443
- name: Upload coverage to Codecov
35-
uses: codecov/codecov-action@967e2b38a85a62bd61be5529ada27ebc109948c2 # v1.4.1
44+
uses: codecov/codecov-action@a1ed4b322b4b38cb846afb5a0ebfa17086917d27 # v1.5.0
3645
with:
3746
file: coverage.txt
3847
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}

0 commit comments

Comments
 (0)