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

Commit 9e58acb

Browse files
authored
sync: update CI config files (#73)
1 parent 5191300 commit 9e58acb

File tree

6 files changed

+149
-107
lines changed

6 files changed

+149
-107
lines changed

.github/workflows/automerge.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
4+
# Automatically merge pull requests opened by web3-bot, as soon as (and only if) all tests pass.
5+
# This reduces the friction associated with updating with our workflows.
6+
7+
on: [ pull_request ]
8+
name: Automerge
9+
10+
jobs:
11+
automerge-check:
12+
if: github.event.pull_request.user.login == 'web3-bot'
13+
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" != "[email protected]" ]]; 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' }}
37+
steps:
38+
- name: Wait on tests
39+
uses: lewagon/wait-on-check-action@bafe56a6863672c681c3cf671f5e10b20abf2eaa # v0.2
40+
with:
41+
ref: ${{ github.event.pull_request.head.sha }}
42+
repo-token: ${{ secrets.GITHUB_TOKEN }}
43+
wait-interval: 10
44+
running-workflow-name: 'automerge' # the name of this job
45+
- name: Merge PR
46+
uses: pascalgn/automerge-action@741c311a47881be9625932b0a0de1b0937aab1ae # v0.13.1
47+
env:
48+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
49+
MERGE_LABELS: ""
50+
MERGE_METHOD: "squash"
51+
MERGE_DELETE_BRANCH: true

.github/workflows/go-check.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
4+
on: [push, pull_request]
5+
name: Go Checks
6+
7+
jobs:
8+
unit:
9+
runs-on: ubuntu-latest
10+
name: All
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
submodules: recursive
15+
- uses: actions/setup-go@v2
16+
with:
17+
go-version: "1.16.x"
18+
- name: Install staticcheck
19+
run: go install honnef.co/go/tools/cmd/staticcheck@434f5f3816b358fe468fa83dcba62d794e7fe04b # 2021.1 (v0.2.0)
20+
- name: Check that go.mod is tidy
21+
uses: protocol/[email protected]
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
30+
- name: gofmt
31+
if: ${{ success() || failure() }} # run this step even if the previous one failed
32+
run: |
33+
out=$(gofmt -s -l .)
34+
if [[ -n "$out" ]]; then
35+
echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}'
36+
exit 1
37+
fi
38+
- name: go vet
39+
if: ${{ success() || failure() }} # run this step even if the previous one failed
40+
uses: protocol/[email protected]
41+
with:
42+
run: go vet ./...
43+
- name: staticcheck
44+
if: ${{ success() || failure() }} # run this step even if the previous one failed
45+
uses: protocol/[email protected]
46+
with:
47+
run: |
48+
set -o pipefail
49+
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'
50+

.github/workflows/go-test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
4+
on: [push, pull_request]
5+
name: Go Test
6+
7+
jobs:
8+
unit:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ "ubuntu", "windows", "macos" ]
13+
go: [ "1.15.x", "1.16.x" ]
14+
runs-on: ${{ matrix.os }}-latest
15+
name: ${{ matrix.os}} (go ${{ matrix.go }})
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
submodules: recursive
20+
- uses: actions/setup-go@v2
21+
with:
22+
go-version: ${{ matrix.go }}
23+
- name: Go information
24+
run: |
25+
go version
26+
go env
27+
- name: Run tests
28+
uses: protocol/[email protected]
29+
with:
30+
run: go test -v -coverprofile coverage.txt ./...
31+
- name: Run tests (32 bit)
32+
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
33+
uses: protocol/[email protected]
34+
env:
35+
GOARCH: 386
36+
with:
37+
run: go test -v ./...
38+
- name: Run tests with race detector
39+
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
40+
uses: protocol/[email protected]
41+
with:
42+
run: go test -v -race ./...
43+
- name: Upload coverage to Codecov
44+
uses: codecov/codecov-action@a1ed4b322b4b38cb846afb5a0ebfa17086917d27 # v1.5.0
45+
with:
46+
file: coverage.txt
47+
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}

.travis.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ require (
1414
github.com/multiformats/go-multihash v0.0.13
1515
)
1616

17-
go 1.13
17+
go 1.15

0 commit comments

Comments
 (0)