Skip to content

feat: test production gateways #21

feat: test production gateways

feat: test production gateways #21

Workflow file for this run

name: Test Production (e2e)
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
jobs:
upload-fixtures:
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.20.4
- uses: actions/checkout@v3
with:
path: "gateway-conformance"
- name: Extract fixtures
uses: ./gateway-conformance/.github/actions/extract-fixtures
with:
output: ./
merged: true
# https://web3.storage/docs/how-tos/store/#storing-ipfs-content-archives
- name: Upload fixtures
id: upload
env:
W3STORAGE_TOKEN: ${{ secrets.W3STORAGE_TOKEN }}
run: |
set -e
set -o pipefail
response=$(curl --fail --oauth2-bearer "$W3STORAGE_TOKEN" --data-binary @fixtures.car "https://api.web3.storage/car")
cid=$(echo $response | jq -r .cid)
echo "Pinned fixtures to w3.storage with CID: $cid"
echo "cid=$cid" >> "$GITHUB_OUTPUT"
- name: Wait for pinning
env:
W3STORAGE_TOKEN: ${{ secrets.W3STORAGE_TOKEN }}
CID: ${{ steps.upload.outputs.cid }}
run: |
set -e
set -o pipefail
pin_status=""
start_time=$(date +%s)
timeout=$((2 * 60)) # Timeout set to 2 minutes
while [[ "$pin_status" != "Pinned" ]]; do
response=$(curl --fail --oauth2-bearer "$W3STORAGE_TOKEN" "https://api.web3.storage/status/$CID")
pin_status=$(echo $response | jq -r '.pins[0].status')
echo "Current pin status: $pin_status"
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [[ "$pin_status" != "Pinned" && $elapsed_time -lt $timeout ]]; then
sleep 10 # Sleep for 10 seconds before trying again
else
break
fi
done
test:
runs-on: "ubuntu-latest"
strategy:
matrix:
target: ["ipfs.runfission.com", "w3s.link"]
fail-fast: false
defaults:
run:
shell: bash
needs: upload-fixtures
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.20.4
- uses: actions/checkout@v3
with:
path: "gateway-conformance"
- name: Run the tests
uses: ./gateway-conformance/.github/actions/test
with:
gateway-url: https://${{ matrix.target }}
subdomain-url: https://${{ matrix.target }}
json: output.json
xml: output.xml
html: output.html
markdown: output.md
- name: Set summary
if: (failure() || success())
run: cat ./output.md >> $GITHUB_STEP_SUMMARY
- name: Upload one-page HTML report
if: (failure() || success())
uses: actions/upload-artifact@v3
with:
name: conformance-${{ matrix.target }}.html
path: ./output.html
- name: Upload JSON output
if: (failure() || success())
uses: actions/upload-artifact@v3
with:
name: conformance-${{ matrix.target }}.json
path: ./output.json
aggregate:
runs-on: "ubuntu-latest"
needs: [test]
# the tests might have failed
if: always()
defaults:
run:
shell: bash
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Aggregate results
run: |
set -e
set -o pipefail
mkdir aggregates/
for file in ./conformance-*.json; do
echo $file;
new_file="aggregates/${file#conformance-}"
jq -ns 'inputs' "$file" | node aggregate.js 1 > "${new_file}"
done
node ./aggregate-into-table.js ./aggregates/*.json > ./table.md
working-directory: ./artifacts
- name: Set summary
if: (failure() || success())
run: cat ./artifacts/table.md >> $GITHUB_STEP_SUMMARY
- name: Upload one-page MD report
if: (failure() || success())
uses: actions/upload-artifact@v3
with:
name: conformance.md
path: ./table.md