Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

Commit aec4faa

Browse files
web3-botStebalien
andauthored
sync: update CI config files (#189)
* disable Travis * set Go version to 1.15 and run go mod tidy * add .github/workflows/automerge.yml * add .github/workflows/go-test.yml * add .github/workflows/go-check.yml * chore: tidy submodule * chore: give vet something to vet * test: disable timing dependent bandwidth test unless we're on linux Co-authored-by: web3-bot <web3-bot@users.noreply.github.com> Co-authored-by: Steven Allen <steven@stebalien.com>
1 parent d0fb9ba commit aec4faa

File tree

8 files changed

+155
-49
lines changed

8 files changed

+155
-49
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" != "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' }}
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/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
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/multiple-go-modules@v1.0
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/multiple-go-modules@v1.0
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/multiple-go-modules@v1.0
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/multiple-go-modules@v1.0
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/multiple-go-modules@v1.0
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 & 37 deletions
This file was deleted.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/libp2p/go-libp2p-core
22

3-
go 1.13
3+
go 1.15
44

55
require (
66
github.com/btcsuite/btcd v0.20.1-beta

metrics/bandwidth_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package metrics
33
import (
44
"fmt"
55
"math"
6+
"runtime"
67
"sync"
78
"testing"
89
"time"
@@ -135,6 +136,10 @@ func TestBandwidthCounter(t *testing.T) {
135136
}
136137

137138
func TestResetBandwidthCounter(t *testing.T) {
139+
if runtime.GOOS != "linux" {
140+
// Specifically, it fails on MacOS because we need a high precision timer.
141+
t.Skip("this test is highly timing dependent and only passes reliably on Linux")
142+
}
138143
bwc := NewBandwidthCounter()
139144

140145
p := peer.ID("peer-0")

tools/go.sum

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
33
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
44
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
55
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
6-
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
76
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
87
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0=
98
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
@@ -12,44 +11,34 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
1211
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
1312
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=
1413
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
15-
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
1614
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
17-
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
1815
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
19-
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
2016
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
2117
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
2218
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
2319
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
2420
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
2521
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
26-
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
2722
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
2823
github.com/smola/gocompat v0.2.0 h1:6b1oIMlUXIpz//VKEDzPVBK8KG7beVwmHIUEBIs/Pns=
2924
github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY=
30-
github.com/src-d/envconfig v1.0.0 h1:/AJi6DtjFhZKNx3OB2qMsq7y4yT5//AeSZIe7rk+PX8=
3125
github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc=
3226
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
3327
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
3428
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
35-
github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJzfthRT6usrui8uGmg=
3629
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
37-
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
3830
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
3931
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
4032
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
4133
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
42-
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
4334
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
4435
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
4536
golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce h1:Gi26mRaGtAreZ9IadlBiwSJT1EDsfk4BSHBD9oxXEFY=
4637
golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
4738
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
4839
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
4940
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
50-
gopkg.in/src-d/go-cli.v0 v0.0.0-20181105080154-d492247bbc0d h1:mXa4inJUuWOoA4uEROxtJ3VMELMlVkIxIfcR0HBekAM=
5141
gopkg.in/src-d/go-cli.v0 v0.0.0-20181105080154-d492247bbc0d/go.mod h1:z+K8VcOYVYcSwSjGebuDL6176A1XskgbtNl64NSg+n8=
52-
gopkg.in/src-d/go-log.v1 v1.0.1 h1:heWvX7J6qbGWbeFS/aRmiy1eYaT+QMV6wNvHDyMjQV4=
5342
gopkg.in/src-d/go-log.v1 v1.0.1/go.mod h1:GN34hKP0g305ysm2/hctJ0Y8nWP3zxXXJ8GFabTyABE=
5443
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
5544
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

tools/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package tools

0 commit comments

Comments
 (0)