Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gateway conformance test workflow #452

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/workflows/gateway-conformance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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/[email protected]
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/[email protected]
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/ipld/go-codec-dagpb v1.6.0
github.com/ipld/go-fixtureplate v0.0.2
github.com/ipld/go-ipld-prime v0.21.0
github.com/ipld/go-trustless-utils v0.4.1
github.com/ipld/go-trustless-utils v0.4.2-0.20231012190436-123cbce5f32a
github.com/ipld/ipld/specs v0.0.0-20231012031213-54d3b21deda4
github.com/ipni/go-libipni v0.5.3
github.com/ipni/storetheindex v0.8.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ github.com/ipld/go-fixtureplate v0.0.2/go.mod h1:z7AnsVOetEl6sQ7j5iMyqVGrS9BgGGE
github.com/ipld/go-ipld-prime v0.21.0 h1:n4JmcpOlPDIxBcY037SVfpd1G+Sj1nKZah0m6QH9C2E=
github.com/ipld/go-ipld-prime v0.21.0/go.mod h1:3RLqy//ERg/y5oShXXdx5YIp50cFGOanyMctpPjsvxQ=
github.com/ipld/go-ipld-prime/storage/bsadapter v0.0.0-20230102063945-1a409dc236dd h1:gMlw/MhNr2Wtp5RwGdsW23cs+yCuj9k2ON7i9MiJlRo=
github.com/ipld/go-trustless-utils v0.4.1 h1:puA14381Hg2LzH724mZ5ZFKFx+FFjjT5fPFs01vwlgM=
github.com/ipld/go-trustless-utils v0.4.1/go.mod h1:DgGuyfJ33goYwYVisjnxrlra0HVmZuHWVisVIkzVo1o=
github.com/ipld/go-trustless-utils v0.4.2-0.20231012190436-123cbce5f32a h1:r/2+mULEZzDHQ/BP/jHTOblALaZ0sHT3T1HgQuKaJVU=
github.com/ipld/go-trustless-utils v0.4.2-0.20231012190436-123cbce5f32a/go.mod h1:DgGuyfJ33goYwYVisjnxrlra0HVmZuHWVisVIkzVo1o=
github.com/ipld/ipld/specs v0.0.0-20231012031213-54d3b21deda4 h1:0VXv637/xpI0Pb5J8K+K8iRtTw4DOcxs0MB1HMzfwNY=
github.com/ipld/ipld/specs v0.0.0-20231012031213-54d3b21deda4/go.mod h1:WcT0DfRe+e2QFY0kcbsOnuT6jL5Q0JNZ83I5DHIdStg=
github.com/ipni/go-libipni v0.5.3 h1:OtyQsetnTjIeXFMHcuEFUmCyAlrKEiOfZrv4FpCFj5A=
Expand Down
Loading