-
Notifications
You must be signed in to change notification settings - Fork 17
103 lines (88 loc) · 3.2 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
name: Gateway Conformance
on:
push:
branches:
- main
pull_request:
env:
LASSIE_ADDRESS: 127.0.0.1
LASSIE_PORT: 8888
jobs:
gateway-conformance:
runs-on: ubuntu-latest
steps:
# 1. Start the Kubo gateway
- name: Download Kubo gateway
uses: ipfs/download-ipfs-distribution-action@v1
- 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/extract-fixtures@v0.2.0
with:
output: fixtures
# 3. Populate the Kubo gateway with the gateway-conformance fixtures
- name: Import fixtures
run: |
find fixtures -name '*.car' -exec ipfs dag import --pin-roots=false {} \;
sudo rm -rf fixtures
# 4. Build the L1
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build local Docker image
uses: docker/build-push-action@v3
with:
context: .
tags: lassie
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
# 5. Start the L1
- name: Start L1
run: |
# Configure lassie to fetch only from the localhost kubo
export LASSIE_ALLOW_PROVIDERS=$(ipfs id | jq --raw-output '.Addresses | @csv | sub("\"";"";"g") ')
export DOCKER_NETWORK=host
export LASSIE_PORT=${{ env.LASSIE_PORT }}
export LASSIE_ADDRESS=${{ env.LASSIE_ADDRESS}}
docker run --name lassie --rm \
--network=$DOCKER_NETWORK \
-e "LASSIE_ALLOW_PPROVIDERS=$LASSIE_ALLOW_PROVIDERS" \
-e "LASSIE_PORT=$LASSIE_PORT" \
-e "LASSIE_ADDRESS=$LASSIE_ADDRESS" lassie daemon &
num_attempts=0
max_attempts=5
url=http://${{ env.LASSIE_ADDRESS }}:${{ env.LASSIE_PORT }}
# wait for the container to be up
until curl -s "$url" -o /dev/null; do
if [ ${num_attempts} -eq ${max_attempts} ];then
echo "Max attempts reached"
exit 1
fi
num_attempts=$(($num_attempts+1))
sleep 5;
done
# 6. Run the gateway-conformance tests
- name: Run gateway-conformance tests
# Wait for release that contains "trustless-car-gateway" specs
uses: ipfs/gateway-conformance/.github/actions/test@v0.2.0
with:
gateway-url: http://${{ env.LASSIE_ADDRESS }}:${{ env.LASSIE_PORT }}
specs: trustless-car-gateway
json: output.json
xml: output.xml
html: output.html
markdown: output.md
args: -skip 'TestGatewayCar/GET_response_for_application/vnd.ipld.car/Header_Content-Length'
# 7. Upload the results
- name: Upload Markdown summary
if: "!cancelled()"
run: cat output.md >> $GITHUB_STEP_SUMMARY
- name: Upload HTML report
if: "!cancelled()"
uses: actions/upload-artifact@v3
with:
name: gateway-conformance.html
path: output.html