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

Commit 4330444

Browse files
Merge pull request #132 from ipfs/web3-bot/sync
sync: update CI config files
2 parents 926cd51 + e773c3e commit 4330444

File tree

6 files changed

+110
-15
lines changed

6 files changed

+110
-15
lines changed

Diff for: .circleci/config.yml

-11
This file was deleted.

Diff for: .github/workflows/automerge.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
9+
jobs:
10+
automerge:
11+
if: github.event.pull_request.user.login == 'web3-bot'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Wait on tests
15+
uses: lewagon/wait-on-check-action@bafe56a6863672c681c3cf671f5e10b20abf2eaa # v0.2
16+
with:
17+
ref: ${{ github.event.pull_request.head.sha }}
18+
repo-token: ${{ secrets.GITHUB_TOKEN }}
19+
wait-interval: 10
20+
running-workflow-name: 'automerge' # the name of this job
21+
- name: Merge PR
22+
uses: pascalgn/automerge-action@741c311a47881be9625932b0a0de1b0937aab1ae # v0.13.1
23+
env:
24+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
25+
MERGE_LABELS: ""
26+
MERGE_METHOD: "squash"
27+
MERGE_DELETE_BRANCH: true

Diff for: .github/workflows/go-check.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
6+
jobs:
7+
unit:
8+
runs-on: ubuntu-latest
9+
name: Go checks
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-go@v2
13+
with:
14+
go-version: "1.16.x"
15+
- name: Install staticcheck
16+
run: go install honnef.co/go/tools/cmd/staticcheck@be534f007836a777104a15f2456cd1fffd3ddee8 # v2020.2.2
17+
- 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
25+
- name: gofmt
26+
if: ${{ success() || failure() }} # run this step even if the previous one failed
27+
run: |
28+
out=$(gofmt -s -l .)
29+
if [[ -n "$out" ]]; then
30+
echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}'
31+
exit 1
32+
fi
33+
- name: go vet
34+
if: ${{ success() || failure() }} # run this step even if the previous one failed
35+
run: go vet ./...
36+
- name: staticcheck
37+
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'
41+

Diff for: .github/workflows/go-test.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
6+
jobs:
7+
unit:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os: [ "ubuntu", "windows", "macos" ]
12+
go: [ "1.15.x", "1.16.x" ]
13+
runs-on: ${{ matrix.os }}-latest
14+
name: Unit tests (${{ matrix.os}}, Go ${{ matrix.go }})
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-go@v2
18+
with:
19+
go-version: ${{ matrix.go }}
20+
- name: Go information
21+
run: |
22+
go version
23+
go env
24+
- name: Run tests
25+
run: go test -v -coverprofile coverage.txt ./...
26+
- name: Run tests (32 bit)
27+
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
28+
env:
29+
GOARCH: 386
30+
run: go test -v ./...
31+
- name: Run tests with race detector
32+
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
33+
run: go test -v -race ./...
34+
- name: Upload coverage to Codecov
35+
uses: codecov/codecov-action@967e2b38a85a62bd61be5529ada27ebc109948c2 # v1.4.1
36+
with:
37+
file: coverage.txt
38+
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ require (
88
github.com/multiformats/go-multiaddr v0.3.1
99
)
1010

11-
go 1.14
11+
go 1.15

Diff for: init.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ func InitWithIdentity(identity Identity) (*Config, error) {
6868
NoFetch: false,
6969
PathPrefixes: []string{},
7070
HTTPHeaders: map[string][]string{
71-
"Access-Control-Allow-Origin": []string{"*"},
72-
"Access-Control-Allow-Methods": []string{"GET"},
73-
"Access-Control-Allow-Headers": []string{"X-Requested-With", "Range", "User-Agent"},
71+
"Access-Control-Allow-Origin": {"*"},
72+
"Access-Control-Allow-Methods": {"GET"},
73+
"Access-Control-Allow-Headers": {"X-Requested-With", "Range", "User-Agent"},
7474
},
7575
APICommands: []string{},
7676
},

0 commit comments

Comments
 (0)