This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
generated from ipfs/ipfs-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 20
112 lines (100 loc) · 4 KB
/
gateway-conformance.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Gateway Conformance
on:
push:
branches:
- main
pull_request:
jobs:
gateway-conformance:
runs-on: ubuntu-latest
strategy:
matrix:
car-env: ["GRAPH_BACKEND=false", "GRAPH_BACKEND=true"]
steps:
# 1. Start the Kubo gateway
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x
- uses: protocol/cache-go-action@v1
- name: Install Kubo gateway from source
#uses: ipfs/download-ipfs-distribution-action@v1
run: |
go install github.com/ipfs/kubo/cmd/ipfs@73552dfd9c6f73fdab887c4d2e99cf7e848a3c23
- name: Start Kubo gateway
uses: ipfs/start-ipfs-daemon-action@v1
# 2. Download the gateway-conformance fixtures
- name: Download gateway-conformance fixtures
uses: ipfs/gateway-conformance/.github/actions/[email protected]
with:
output: fixtures
# 3. Populate the Kubo gateway with the gateway-conformance fixtures
- name: Import fixtures
run: |
# Import car files
find ./fixtures -name '*.car' -exec ipfs dag import --pin-roots=false --offline {} \;
# Import ipns records
records=$(find ./fixtures -name '*.ipns-record')
for record in $records
do
key=$(basename -s .ipns-record "$record" | cut -d'_' -f1)
ipfs routing put --allow-offline --offline "/ipns/$key" "$record"
done
# Import dnslink records
# the IPFS_NS_MAP env will be used by the daemon
export IPFS_NS_MAP=$(cat "./fixtures/dnslinks.json" | jq -r '.subdomains | to_entries | map("\(.key).example.com:\(.value)") | join(",")')
export IPFS_NS_MAP="$(cat "./fixtures/dnslinks.json" | jq -r '.domains | to_entries | map("\(.key):\(.value)") | join(",")'),${IPFS_NS_MAP}"
echo "IPFS_NS_MAP=${IPFS_NS_MAP}" >> $GITHUB_ENV
# 4. Build the bifrost-gateway
- name: Checkout bifrost-gateway
uses: actions/checkout@v3
with:
path: bifrost-gateway
- name: Build bifrost-gateway
run: go build
working-directory: bifrost-gateway
# 5. Start the bifrost-gateway
- name: Start bifrost-gateway
env:
PROXY_GATEWAY_URL: http://127.0.0.1:8080
KUBO_RPC_URL: http://127.0.0.1:5001
GATEWAY_CONFORMANCE_TEST: true
run: |
# NOTE: we export car-env this way ON PURPOSE, to have full key=value
# present on PR status instead of just true/false without context
export ${{ matrix.car-env }}
# run gw
./bifrost-gateway &
working-directory: bifrost-gateway
# 6. Run the gateway-conformance tests
- name: Run gateway-conformance tests
uses: ipfs/gateway-conformance/.github/actions/[email protected]
with:
gateway-url: http://127.0.0.1:8081
json: output.json
xml: output.xml
html: output.html
markdown: output.md
specs: +trustless-gateway,+path-gateway,+subdomain-gateway,+dnslink-gateway,+redirects-file
# use below to skip specific test if needed
# args: -skip 'TestFooBr/GET_response_for_something'
#
# only-if-cached: bifrost-gateway does not guarantee local cache, we will adjust upstream test (which was Kubo-specific)
# for now disabling these test cases
args: -skip 'TestGatewayCache/.*_for_/ipfs/_with_only-if-cached_succeeds_when_in_local_datastore'
# 7. Upload the results
- name: Upload MD summary
if: failure() || success()
run: cat output.md >> $GITHUB_STEP_SUMMARY
- name: Upload HTML report
if: failure() || success()
uses: actions/upload-artifact@v3
with:
name: gateway-conformance.html
path: output.html
- name: Upload JSON report
if: failure() || success()
uses: actions/upload-artifact@v3
with:
name: gateway-conformance.json
path: output.json