tmp: testing gateway conformance #114
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Gateway Conformance | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
gateway-conformance: | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Start the Kubo gateway | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
- name: Install Kubo gateway from source | |
#uses: ipfs/download-ipfs-distribution-action@v1 | |
run: | | |
go install github.com/ipfs/kubo/cmd/[email protected] | |
- name: Setup kubo config | |
run: | | |
ipfs init --profile=test | |
ipfs config Addresses.Gateway "/ip4/127.0.0.1/tcp/8080" | |
# 2. Download the gateway-conformance fixtures | |
- name: Download gateway-conformance fixtures | |
uses: ipfs/gateway-conformance/.github/actions/[email protected] | |
with: | |
output: fixtures | |
- name: Start Kubo gateway | |
uses: ipfs/start-ipfs-daemon-action@v1 | |
# 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 "/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 helia-http-gateway | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Checkout helia-http-gateway | |
uses: actions/checkout@v3 | |
with: | |
path: helia-http-gateway | |
- name: Install dependencies | |
run: npm ci | |
working-directory: helia-http-gateway | |
- name: Build helia-http-gateway | |
run: npm run build | |
working-directory: helia-http-gateway | |
# 5. Start helia-http-gateway | |
- name: Start helia-http-gateway | |
env: | |
GATEWAY_CONFORMANCE_TEST: true | |
TRUSTLESS_GATEWAYS: "http://127.0.0.1:8080" | |
USE_LIBP2P: false | |
PORT: 8090 | |
run: | | |
# run gw | |
node dist/src/index.js & | |
working-directory: helia-http-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:8090 | |
subdomain-url: http://127.0.0.1:8090 | |
json: output.json | |
xml: output.xml | |
html: output.html | |
markdown: output.md | |
# specs: subdomain-ipfs-gateway,subdomain-ipns-gateway | |
# use below to skip specific test if needed | |
# args: -skip 'TestFooBr/GET_response_for_something' | |
# | |
# only-if-cached: helia-ht does not guarantee local cache, we will adjust upstream test (which was Kubo-specific) | |
# for now disabling these test cases | |
args: -skip '^.*(DirectoryListing|TestGatewayCache|proxy|Trustless|TestGatewayIPNSRecord|RedirectsFile|TestGatewayUnixFSFileRanges|TestGatewayJSONCborAndIPNS|TestTar|Symlink|TestPathGatewayMiscellaneous|TestGatewayBlock|TestNativeDag|TestPlainCodec|TestDagPbConversion|TestGatewayJsonCbor|TestCors).*$' | |
# args: -skip '^.*(DirectoryListing|TestGatewayCache|TestSubdomainGatewayDNSLinkInlining|proxy|TestGatewaySubdomainAndIPNS|TestGatewaySubdomains|Trustless|TestGatewayIPNSRecord|RedirectsFile|TestGatewayUnixFSFileRanges|TestGatewayJSONCborAndIPNS|TestTar|Symlink|TestPathGatewayMiscellaneous|TestGatewayBlock|TestRedirectCanonicalIPNS|TestGatewayIPNSPath|TestNativeDag|TestPathing|TestPlainCodec|TestDagPbConversion|TestGatewayJsonCbor|TestCors).*$' | |
# 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 |