Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit ebc9d77

Browse files
authored
Merge pull request #253 from ipfs/web3-bot/sync
sync: update CI config files
2 parents bd8cc1f + d1e044d commit ebc9d77

File tree

10 files changed

+212
-46
lines changed

10 files changed

+212
-46
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# To prevent CRLF breakages on Windows for fragile files, like testdata.
2+
testdata/* -text
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: installipfs
2+
description: install go-ipfs
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Install go-ipfs
8+
shell: bash
9+
run: (cd /tmp && go install github.com/ipfs/go-ipfs/cmd/ipfs@master)
10+
- name: Initialize go-ipfs
11+
shell: bash
12+
run: (ipfs init)
13+
- name: Run go-ipfs
14+
shell: bash
15+
run: (ipfs daemon --enable-pubsub-experiment &)

.github/workflows/automerge.yml

Lines changed: 53 additions & 0 deletions
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

Lines changed: 74 additions & 0 deletions
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

Lines changed: 55 additions & 0 deletions
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 }}

.gx/lastpubver

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

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

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
go 1.13
1+
go 1.16
22

33
module github.com/ipfs/go-ipfs-api
44

go.sum

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA
135135
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
136136
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
137137
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
138-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
139138
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
140139
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
141140
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=

mfs_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ func TestMain(m *testing.M) {
2828
}
2929
}
3030

31+
stat, err := s.FilesStat(context.Background(), "/testdata")
32+
if err != nil {
33+
fmt.Fprintf(os.Stderr, "Failed to stat test data, not running tests: %v\n", err)
34+
os.Exit(1)
35+
}
36+
37+
expectedTestdataCIDString := "QmfZtacPc5nch976ZsiBw6nhLmTzy5JjW2pzZg8j7GjqWq"
38+
if stat.Hash != expectedTestdataCIDString {
39+
fmt.Fprintf(os.Stderr, "CID of /testdata is %s which does not match the expected %s, not running tests\n", stat.Hash, expectedTestdataCIDString)
40+
os.Exit(1)
41+
}
42+
3143
exitVal := m.Run()
3244
if err := s.FilesRm(context.Background(), "/testdata", true); err != nil {
3345
fmt.Fprintf(os.Stderr, "Failed to remove test data: %v\n", err)

0 commit comments

Comments
 (0)