Skip to content

Commit d4cd414

Browse files
authored
test: port CircleCI to GH Actions and improve sharness reporting (#9355)
Closes #8991 Part of #8804
1 parent 255e64e commit d4cd414

30 files changed

+708
-380
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
executor: continuation/default
88
steps:
99
- checkout
10-
- run:
10+
- run:
1111
name: Generate params
1212
# for builds on the ipfs/kubo repo, use 2xlarge for faster builds
1313
# but since this is not available for many contributors, we otherwise use medium

.circleci/main.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,17 @@ jobs:
143143
path: /tmp/circleci-test-results
144144
sharness:
145145
machine:
146-
image: ubuntu-2004:202010-01
146+
image: ubuntu-2204:2022.10.1
147147
resource_class: << pipeline.parameters.resource_class >>
148148
working_directory: ~/ipfs/kubo
149149
environment:
150150
<<: *default_environment
151151
TEST_NO_DOCKER: 0
152+
TEST_NO_PLUGIN: 1
152153
TEST_NO_FUSE: 1
153154
TEST_VERBOSE: 1
155+
TEST_JUNIT: 1
156+
TEST_EXPENSIVE: 1
154157
steps:
155158
- run: sudo apt update
156159
- run: |
@@ -159,7 +162,7 @@ jobs:
159162
tar xfz go1.19.1.linux-amd64.tar.gz
160163
echo "export PATH=$(pwd)/go/bin:\$PATH" >> ~/.bashrc
161164
- run: go version
162-
- run: sudo apt install socat net-tools fish
165+
- run: sudo apt install socat net-tools fish libxml2-utils
163166
- checkout
164167

165168
- run:
@@ -183,7 +186,7 @@ jobs:
183186
command: echo "export TEST_DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> $BASH_ENV
184187
- run:
185188
echo TEST_DOCKER_HOST=$TEST_DOCKER_HOST &&
186-
make -O -j << pipeline.parameters.make_jobs >> coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml TEST_GENERATE_JUNIT=1 CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST
189+
make -O -j << pipeline.parameters.make_jobs >> test_sharness coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST
187190
- run:
188191
when: always
189192
command: bash <(curl -s https://codecov.io/bash) -cF sharness -X search -f coverage/sharness_tests.coverprofile
@@ -345,13 +348,13 @@ jobs:
345348
npx playwright install
346349
working_directory: ~/ipfs/kubo/ipfs-webui
347350
- run:
348-
name: Running upstream tests (finish early if they fail)
351+
name: Run ipfs-webui@main build and smoke-test to confirm the upstream repo is not broken
349352
command: |
350-
npm test || circleci-agent step halt
353+
npm test
351354
working_directory: ~/ipfs/kubo/ipfs-webui
352355
- run:
353-
name: Running tests with kubo built from current commit
354-
command: npm test
356+
name: Test ipfs-webui@main E2E against the locally built Kubo binary
357+
command: npm run test:e2e
355358
working_directory: ~/ipfs/kubo/ipfs-webui
356359
environment:
357360
IPFS_GO_EXEC: /tmp/circleci-workspace/bin/ipfs

.github/workflows/build.yml

+200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
name: 'ci/gh-experiment: interop'
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- 'master'
9+
10+
env:
11+
GO_VERSION: 1.19.1
12+
13+
jobs:
14+
prepare:
15+
if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch'
16+
runs-on: ubuntu-latest
17+
env:
18+
TEST_NO_DOCKER: 1
19+
TEST_NO_FUSE: 1
20+
TEST_VERBOSE: 1
21+
TRAVIS: 1
22+
GIT_PAGER: cat
23+
IPFS_CHECK_RCMGR_DEFAULTS: 1
24+
defaults:
25+
run:
26+
shell: bash
27+
steps:
28+
- uses: actions/setup-go@v3
29+
with:
30+
go-version: ${{ env.GO_VERSION }}
31+
- uses: actions/checkout@v3
32+
- uses: protocol/cache-go-action@v1
33+
with:
34+
name: ${{ github.job }}
35+
- run: make build
36+
- uses: actions/upload-artifact@v3
37+
with:
38+
name: kubo
39+
path: cmd/ipfs/ipfs
40+
ipfs-interop:
41+
needs: [prepare]
42+
runs-on: ubuntu-latest
43+
strategy:
44+
matrix:
45+
suites:
46+
- 'exchange-files'
47+
- 'files pin circuit ipns cid-version-agnostic ipns-pubsub pubsub'
48+
fail-fast: false
49+
defaults:
50+
run:
51+
shell: bash
52+
steps:
53+
- uses: actions/setup-node@v3
54+
with:
55+
node-version: 16.12.0
56+
- uses: actions/download-artifact@v3
57+
with:
58+
name: kubo
59+
path: cmd/ipfs
60+
- run: chmod +x cmd/ipfs/ipfs
61+
- run: |
62+
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
63+
id: npm-cache-dir
64+
- uses: actions/cache@v3
65+
with:
66+
path: ${{ steps.npm-cache-dir.outputs.dir }}
67+
key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/package-lock.json') }}
68+
restore-keys: |
69+
${{ runner.os }}-${{ github.job }}-
70+
- run: mkdir interop
71+
- run: |
72+
npm init -y
73+
npm install ipfs@^0.61.0
74+
npm install ipfs-interop@^8.0.10
75+
working-directory: interop
76+
- run: npx ipfs-interop -- -t node $(sed -e 's#[^ ]*#-f test/&.js#g' <<< '${{ matrix.suites }}')
77+
env:
78+
LIBP2P_TCP_REUSEPORT: false
79+
LIBP2P_ALLOW_WEAK_RSA_KEYS: 1
80+
IPFS_GO_EXEC: ${{ github.workspace }}/cmd/ipfs/ipfs
81+
working-directory: interop
82+
go-ipfs-api:
83+
needs: [prepare]
84+
runs-on: ubuntu-latest
85+
env:
86+
TEST_NO_DOCKER: 1
87+
TEST_NO_FUSE: 1
88+
TEST_VERBOSE: 1
89+
TRAVIS: 1
90+
GIT_PAGER: cat
91+
IPFS_CHECK_RCMGR_DEFAULTS: 1
92+
defaults:
93+
run:
94+
shell: bash
95+
steps:
96+
- uses: actions/setup-go@v3
97+
with:
98+
go-version: ${{ env.GO_VERSION }}
99+
- uses: actions/download-artifact@v3
100+
with:
101+
name: kubo
102+
path: cmd/ipfs
103+
- run: chmod +x cmd/ipfs/ipfs
104+
- uses: actions/checkout@v3
105+
with:
106+
repository: ipfs/go-ipfs-api
107+
path: go-ipfs-api
108+
- run: cmd/ipfs/ipfs daemon --init --enable-namesys-pubsub &
109+
- run: |
110+
while ! cmd/ipfs/ipfs id --api=/ip4/127.0.0.1/tcp/5001 2>/dev/null; do
111+
sleep 1
112+
done
113+
timeout-minutes: 5
114+
- uses: protocol/cache-go-action@v1
115+
with:
116+
name: ${{ github.job }}
117+
- run: go test -count=1 -v ./...
118+
working-directory: go-ipfs-api
119+
- run: cmd/ipfs/ipfs shutdown
120+
if: always()
121+
go-ipfs-http-client:
122+
needs: [prepare]
123+
runs-on: ubuntu-latest
124+
env:
125+
TEST_NO_DOCKER: 1
126+
TEST_NO_FUSE: 1
127+
TEST_VERBOSE: 1
128+
TRAVIS: 1
129+
GIT_PAGER: cat
130+
IPFS_CHECK_RCMGR_DEFAULTS: 1
131+
defaults:
132+
run:
133+
shell: bash
134+
steps:
135+
- uses: actions/setup-go@v3
136+
with:
137+
go-version: ${{ env.GO_VERSION }}
138+
- uses: actions/download-artifact@v3
139+
with:
140+
name: kubo
141+
path: cmd/ipfs
142+
- run: chmod +x cmd/ipfs/ipfs
143+
- uses: actions/checkout@v3
144+
with:
145+
repository: ipfs/go-ipfs-http-client
146+
path: go-ipfs-http-client
147+
- uses: protocol/cache-go-action@v1
148+
with:
149+
name: ${{ github.job }}
150+
- run: echo '${{ github.workspace }}/cmd/ipfs' >> $GITHUB_PATH
151+
- run: go test -count=1 -v ./...
152+
working-directory: go-ipfs-http-client
153+
ipfs-webui:
154+
needs: [prepare]
155+
runs-on: ubuntu-latest
156+
env:
157+
NO_SANDBOX: true
158+
LIBP2P_TCP_REUSEPORT: false
159+
LIBP2P_ALLOW_WEAK_RSA_KEYS: 1
160+
E2E_IPFSD_TYPE: go
161+
TRAVIS: 1
162+
GIT_PAGER: cat
163+
IPFS_CHECK_RCMGR_DEFAULTS: 1
164+
defaults:
165+
run:
166+
shell: bash
167+
steps:
168+
- uses: actions/setup-node@v3
169+
with:
170+
node-version: 16.12.0
171+
- uses: actions/download-artifact@v3
172+
with:
173+
name: kubo
174+
path: cmd/ipfs
175+
- run: chmod +x cmd/ipfs/ipfs
176+
- uses: actions/checkout@v3
177+
with:
178+
repository: ipfs/ipfs-webui
179+
path: ipfs-webui
180+
- run: |
181+
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
182+
id: npm-cache-dir
183+
- uses: actions/cache@v3
184+
with:
185+
path: ${{ steps.npm-cache-dir.outputs.dir }}
186+
key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/package-lock.json') }}
187+
restore-keys: |
188+
${{ runner.os }}-${{ github.job }}-
189+
- run: |
190+
npm ci --prefer-offline --no-audit --progress=false
191+
npx playwright install
192+
working-directory: ipfs-webui
193+
- name: Run ipfs-webui@main build and smoke-test to confirm the upstream repo is not broken
194+
run: npm test
195+
working-directory: ipfs-webui
196+
- name: Test ipfs-webui@main E2E against the locally built Kubo binary
197+
run: npm run test:e2e
198+
env:
199+
IPFS_GO_EXEC: ${{ github.workspace }}/cmd/ipfs/ipfs
200+
working-directory: ipfs-webui

.github/workflows/codeql-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
2-
name: "CodeQL"
2+
name: CodeQL
33

44
on:
55
workflow_dispatch:

.github/workflows/docker-build.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'ci/gh-experiment: docker-build'
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- 'master'
9+
10+
jobs:
11+
docker-build:
12+
if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch'
13+
runs-on: ubuntu-latest
14+
env:
15+
IMAGE_NAME: ipfs/kubo
16+
WIP_IMAGE_TAG: wip
17+
defaults:
18+
run:
19+
shell: bash
20+
steps:
21+
- uses: actions/setup-go@v3
22+
with:
23+
go-version: 1.19.1
24+
- uses: actions/checkout@v3
25+
- run: docker build -t $IMAGE_NAME:$WIP_IMAGE_TAG .

.github/workflows/docker-image.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
run: |
3333
TAGS="$(./bin/get-docker-tags.sh $(date -u +%F))"
3434
TAGS="${TAGS//$'\n'/'%0A'}"
35-
echo "::set-output name=value::$(echo $TAGS)"
35+
echo "value=$(echo $TAGS)" >> $GITHUB_OUTPUT
3636
shell: bash
3737

3838
- name: Log in to Docker Hub

.github/workflows/gobuild.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: 'ci/gh-experiment: go build'
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- 'master'
9+
10+
jobs:
11+
runner:
12+
if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch'
13+
uses: ipfs/kubo/.github/workflows/runner.yml@ci/move-to-github-actions # TODO: change to master
14+
gobuild:
15+
needs: [runner]
16+
runs-on: ${{ fromJSON(needs.runner.outputs.config).labels }}
17+
env:
18+
TEST_NO_DOCKER: 1
19+
TEST_VERBOSE: 1
20+
TRAVIS: 1
21+
GIT_PAGER: cat
22+
IPFS_CHECK_RCMGR_DEFAULTS: 1
23+
defaults:
24+
run:
25+
shell: bash
26+
steps:
27+
- uses: actions/setup-go@v3
28+
with:
29+
go-version: 1.19.1
30+
- uses: actions/checkout@v3
31+
- uses: protocol/cache-go-action@v1
32+
with:
33+
name: ${{ github.job }}
34+
- run: make cmd/ipfs-try-build
35+
env:
36+
TEST_NO_FUSE: 0
37+
- run: make cmd/ipfs-try-build
38+
env:
39+
TEST_NO_FUSE: 1

.github/workflows/golang-analysis.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
on: [push, pull_request]
21
name: Go Checks
32

3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- 'master'
9+
410
jobs:
511
unit:
12+
if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch'
613
runs-on: ubuntu-latest
714
name: All
815
steps:

.github/workflows/golint.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'ci/gh-experiment: go lint'
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- 'master'
9+
10+
jobs:
11+
golint:
12+
if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch'
13+
runs-on: ubuntu-latest
14+
env:
15+
TEST_NO_DOCKER: 1
16+
TEST_NO_FUSE: 1
17+
TEST_VERBOSE: 1
18+
TRAVIS: 1
19+
GIT_PAGER: cat
20+
IPFS_CHECK_RCMGR_DEFAULTS: 1
21+
defaults:
22+
run:
23+
shell: bash
24+
steps:
25+
- uses: actions/setup-go@v3
26+
with:
27+
go-version: 1.19.1
28+
- uses: actions/checkout@v3
29+
- uses: protocol/cache-go-action@v1
30+
with:
31+
name: ${{ github.job }}
32+
- run: make -O test_go_lint

0 commit comments

Comments
 (0)