Skip to content

Commit c5420cf

Browse files
sync: update CI config files (#191)
* disable CircleCI * bump go.mod to Go 1.16 and run go fix * bump go.mod to Go 1.16 and run go fix * run go mod tidy * run gofmt -s * add .github/workflows/automerge.yml * add .github/workflows/go-test.yml * add .github/workflows/go-check.yml * style(testplans): fix staticcheck error * test(responsemanager): fix flaky TestCancellationQueryInProgress resolve possible failure from request finishing early -- simply to fix for TestCancellationViaCommand * test(responsemanager): fix flaky TestValidationAndExtensions Co-authored-by: web3-bot <[email protected]> Co-authored-by: hannahhoward <[email protected]>
1 parent 1c9de96 commit c5420cf

File tree

11 files changed

+214
-82
lines changed

11 files changed

+214
-82
lines changed

.circleci/config.yml

-72
This file was deleted.

.github/workflows/automerge.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
# 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'
39+
steps:
40+
- name: Wait on tests
41+
uses: lewagon/wait-on-check-action@bafe56a6863672c681c3cf671f5e10b20abf2eaa # v0.2
42+
with:
43+
ref: ${{ github.event.pull_request.head.sha }}
44+
repo-token: ${{ secrets.GITHUB_TOKEN }}
45+
wait-interval: 10
46+
running-workflow-name: 'automerge' # the name of this job
47+
- name: Merge PR
48+
uses: pascalgn/automerge-action@741c311a47881be9625932b0a0de1b0937aab1ae # v0.13.1
49+
env:
50+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
51+
MERGE_LABELS: ""
52+
MERGE_METHOD: "squash"
53+
MERGE_DELETE_BRANCH: true

.github/workflows/go-check.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
env:
12+
RUNGOGENERATE: false
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
submodules: recursive
17+
- uses: actions/setup-go@v2
18+
with:
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
29+
- name: Install staticcheck
30+
run: go install honnef.co/go/tools/cmd/staticcheck@df71e5d0e0ed317ebf43e6e59cf919430fa4b8f2 # 2021.1.1 (v0.2.1)
31+
- name: Check that go.mod is tidy
32+
uses: protocol/[email protected]
33+
with:
34+
run: |
35+
go mod tidy
36+
if [[ -n $(git ls-files --other --exclude-standard --directory -- go.sum) ]]; then
37+
echo "go.sum was added by go mod tidy"
38+
exit 1
39+
fi
40+
git diff --exit-code -- go.sum go.mod
41+
- name: gofmt
42+
if: ${{ success() || failure() }} # run this step even if the previous one failed
43+
run: |
44+
out=$(gofmt -s -l .)
45+
if [[ -n "$out" ]]; then
46+
echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}'
47+
exit 1
48+
fi
49+
- name: go vet
50+
if: ${{ success() || failure() }} # run this step even if the previous one failed
51+
uses: protocol/[email protected]
52+
with:
53+
run: go vet ./...
54+
- name: staticcheck
55+
if: ${{ success() || failure() }} # run this step even if the previous one failed
56+
uses: protocol/[email protected]
57+
with:
58+
run: |
59+
set -o pipefail
60+
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
74+

.github/workflows/go-test.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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.16.x", "1.17.x" ]
14+
env:
15+
COVERAGES: ""
16+
runs-on: ${{ matrix.os }}-latest
17+
name: ${{ matrix.os}} (go ${{ matrix.go }})
18+
steps:
19+
- uses: actions/checkout@v2
20+
with:
21+
submodules: recursive
22+
- uses: actions/setup-go@v2
23+
with:
24+
go-version: ${{ matrix.go }}
25+
- name: Go information
26+
run: |
27+
go version
28+
go env
29+
- name: Run repo-specific setup
30+
uses: ./.github/actions/go-test-setup
31+
if: hashFiles('./.github/actions/go-test-setup') != ''
32+
- name: Run tests
33+
uses: protocol/[email protected]
34+
with:
35+
run: go test -v -coverprofile module-coverage.txt ./...
36+
- name: Run tests (32 bit)
37+
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
38+
uses: protocol/[email protected]
39+
env:
40+
GOARCH: 386
41+
with:
42+
run: go test -v ./...
43+
- name: Run tests with race detector
44+
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
45+
uses: protocol/[email protected]
46+
with:
47+
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
51+
- name: Upload coverage to Codecov
52+
uses: codecov/codecov-action@51d810878be5422784e86451c0e7c14e5860ec47 # v2.0.2
53+
with:
54+
files: '${{ env.COVERAGES }}'
55+
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/ipfs/go-graphsync
22

3-
go 1.13
3+
go 1.16
44

55
require (
66
github.com/gogo/protobuf v1.3.2

go.sum

-7
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6 h1:u/UEqS66A5ckRmS4yNp
7070
github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ=
7171
github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY=
7272
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
73-
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
7473
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
7574
github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
7675
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
@@ -79,7 +78,6 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP
7978
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
8079
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
8180
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
82-
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I=
8381
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
8482
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
8583
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -558,18 +556,15 @@ github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXS
558556
github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
559557
github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY=
560558
github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
561-
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
562559
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
563560
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
564561
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
565562
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
566563
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
567-
github.com/onsi/ginkgo v1.12.1 h1:mFwc4LvZ0xpSvDZ3E+k8Yte0hLOMxXUlP+yXtJqkYfQ=
568564
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
569565
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
570566
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
571567
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
572-
github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg=
573568
github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
574569
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
575570
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
@@ -809,11 +804,9 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
809804
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
810805
gopkg.in/src-d/go-cli.v0 v0.0.0-20181105080154-d492247bbc0d/go.mod h1:z+K8VcOYVYcSwSjGebuDL6176A1XskgbtNl64NSg+n8=
811806
gopkg.in/src-d/go-log.v1 v1.0.1/go.mod h1:GN34hKP0g305ysm2/hctJ0Y8nWP3zxXXJ8GFabTyABE=
812-
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
813807
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
814808
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
815809
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
816-
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
817810
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
818811
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
819812
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)