ci: add gateway-conformance tests for kubo-gateway (#9780)
Piotr Galar committed
Mar 31, 2023 at 12:07 UTC
c81d2da87103a731260e3d62c2bf060ad0ded870
1 file changed
+86
.github/workflows/gateway-conformance.yml
new
+86
@@ -0,0 +1,86 @@
1
+name: Gateway Conformance
2
+
3
+on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+concurrency:
10
+ group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
11
+ cancel-in-progress: true
12
+
13
+defaults:
14
+ run:
15
+ shell: bash
16
+
17
+jobs:
18
+ gateway-conformance:
19
+ runs-on: ubuntu-latest
20
+ timeout-minutes: 10
21
+ steps:
22
+ # 1. Download the gateway-conformance fixtures
23
+ - name: Download gateway-conformance fixtures
24
+ uses: ipfs/gateway-conformance/.github/actions/extract-fixtures@v0.0
25
+ with:
26
+ output: fixtures
27
+
28
+ # 2. Build the kubo-gateway
29
+ - name: Setup Go
30
+ uses: actions/setup-go@v3
31
+ with:
32
+ go-version: 1.19.x
33
+ - name: Checkout kubo-gateway
34
+ uses: actions/checkout@v3
35
+ with:
36
+ path: kubo-gateway
37
+ - name: Build kubo-gateway
38
+ run: make build
39
+ working-directory: kubo-gateway
40
+
41
+ # 3. Start the kubo-gateway
42
+ - name: Start kubo-gateway
43
+ env:
44
+ GATEWAY_PUBLIC_GATEWAYS: |
45
+ {
46
+ "example.com": {
47
+ "UseSubdomains": true,
48
+ "Paths": ["/ipfs", "/ipns"]
49
+ },
50
+ "localhost": {
51
+ "UseSubdomains": true,
52
+ "InlineDNSLink": true,
53
+ "Paths": ["/ipfs", "/ipns"]
54
+ }
55
+ }
56
+ run: |
57
+ ./ipfs init
58
+ ./ipfs config --json Gateway.PublicGateways "$GATEWAY_PUBLIC_GATEWAYS"
59
+ ./ipfs daemon --offline &
60
+ working-directory: kubo-gateway/cmd/ipfs
61
+
62
+ # 4. Populate the Kubo gateway with the gateway-conformance fixtures
63
+ - name: Import fixtures
64
+ run: find ./fixtures -name '*.car' -exec kubo-gateway/cmd/ipfs/ipfs dag import --pin-roots=false {} \;
65
+
66
+ # 5. Run the gateway-conformance tests
67
+ - name: Run gateway-conformance tests
68
+ uses: ipfs/gateway-conformance/.github/actions/test@v0.0
69
+ with:
70
+ gateway-url: http://127.0.0.1:8080
71
+ json: output.json
72
+ xml: output.xml
73
+ html: output.html
74
+ markdown: output.md
75
+ args: -skip 'TestGatewayCar/GET_response_for_application/vnd.ipld.car/Header_Content-Length'
76
+
77
+ # 6. Upload the results
78
+ - name: Upload MD summary
79
+ if: failure() || success()
80
+ run: cat output.md >> $GITHUB_STEP_SUMMARY
81
+ - name: Upload HTML report
82
+ if: failure() || success()
83
+ uses: actions/upload-artifact@v3
84
+ with:
85
+ name: gateway-conformance.html
86
+ path: output.html