-
Notifications
You must be signed in to change notification settings - Fork 12
160 lines (142 loc) · 5.38 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Gateway Conformance
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
paths-ignore:
- '**/*.md'
env:
GATEWAY_CONFORMANCE_TEST: true # rainbow preset for conformance testing
KUBO_VER: 'v0.30.0' # kubo daemon used as no-libp2p-remote-* backend
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
backend: ["libp2p-bitswap", "remote-block-gw", "remote-car-gw"]
steps:
# 1. Start the Kubo gateway
- name: Install Kubo
uses: ipfs/download-ipfs-distribution-action@v1
with:
name: kubo
version: "${{ env.KUBO_VER }}"
- name: Setup kubo config
run: |
ipfs init --profile=test
ipfs config Addresses.Gateway "/ip4/127.0.0.1/tcp/8080"
ipfs config Addresses.API "/ip4/127.0.0.1/tcp/5001"
ipfs config --json Gateway.ExposeRoutingAPI true
ipfs config Routing.Type "autoclient"
# 2. Download the gateway-conformance fixtures
- name: Download gateway-conformance fixtures
uses: ipfs/gateway-conformance/.github/actions/extract-fixtures@v0.6
with:
output: fixtures
# 3. Populate the Kubo node 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 "/ipns/$key" "$record"
done
# Import dnslink records
# the IPFS_NS_MAP env will be used by the daemon
echo "IPFS_NS_MAP=$(cat ./fixtures/dnslinks.IPFS_NS_MAP)" >> $GITHUB_ENV
- name: Start Kubo gateway
uses: ipfs/start-ipfs-daemon-action@v1
# 4. Build rainbow
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.23.x
- name: Checkout rainbow
uses: actions/checkout@v4
with:
path: rainbow
- name: Build rainbow
run: go build
working-directory: rainbow
# 5. Start rainbow variant
- name: Start rainbow (libp2p and bitswap)
if: ${{ matrix.backend == 'libp2p-bitswap' }}
env:
RAINBOW_DHT_ROUTING: off
RAINBOW_HTTP_ROUTERS: http://127.0.0.1:8080
run: |
# set up peering with kubo to ensure fixtures can be found fast
kuboNodeMultiaddr=$(ipfs --api=/ip4/127.0.0.1/tcp/5001 swarm addrs local --id | head -n 1)
./rainbow --peering=$kuboNodeMultiaddr &
working-directory: rainbow
# 5. Start rainbow variant
- name: Start rainbow (no libp2p, remote block gateway)
if: ${{ matrix.backend == 'remote-block-gw' }}
env:
RAINBOW_REMOTE_BACKENDS: http://127.0.0.1:8080
RAINBOW_REMOTE_BACKENDS_MODE: block
RAINBOW_REMOTE_BACKENDS_IPNS: true
RAINBOW_LIBP2P: false
RAINBOW_BITSWAP: false
RAINBOW_DHT_ROUTING: off
RAINBOW_HTTP_ROUTERS: http://127.0.0.1:8080
run: |
./rainbow &
working-directory: rainbow
#
# 5. Start rainbow variant
- name: Start rainbow (no libp2p, remote car gateway)
if: ${{ matrix.backend == 'remote-car-gw' }}
env:
RAINBOW_REMOTE_BACKENDS: http://127.0.0.1:8080
RAINBOW_REMOTE_BACKENDS_MODE: car
RAINBOW_REMOTE_BACKENDS_IPNS: true
RAINBOW_LIBP2P: false
RAINBOW_BITSWAP: false
RAINBOW_DHT_ROUTING: off
RAINBOW_HTTP_ROUTERS: http://127.0.0.1:8080
run: |
./rainbow &
working-directory: rainbow
# 6. Run the gateway-conformance tests
- name: Run gateway-conformance tests
uses: ipfs/gateway-conformance/.github/actions/test@v0.6
with:
gateway-url: http://127.0.0.1:8090
subdomain-url: http://example.com:8090
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: rainbow does not guarantee local cache, we will adjust upstream test (which was Kubo-specific)
# for now disabling these test cases
args: -skip 'TestGatewayCache/.*_with_only-if-cached_succeeds_when_in_local_datastore'
json: output.json
xml: output.xml
html: output.html
markdown: output.md
# 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@v4
with:
name: ${{ matrix.backend }}_gateway-conformance.html
path: output.html
- name: Upload JSON report
if: failure() || success()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.backend }}_gateway-conformance.json
path: output.json