diff --git a/.github/workflows/test-implementations-e2e.yml b/.github/workflows/test-implementations-e2e.yml new file mode 100644 index 000000000..40b982e1f --- /dev/null +++ b/.github/workflows/test-implementations-e2e.yml @@ -0,0 +1,85 @@ +name: Generate Implementations Dashboard + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }} + cancel-in-progress: true + +jobs: + pull-outputs: + runs-on: "ubuntu-latest" + strategy: + matrix: + target: ["singulargarden/kubo", "singulargarden/bifrost-gateway2"] + fail-fast: false + defaults: + run: + shell: bash + steps: + - name: get default branch + id: get-default-branch + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OWNER_AND_REPO: ${{ matrix.target }} + run: | + DEFAULT_BRANCH=$(gh api repos/{owner}/{repo} --jq '.default_branch') + echo "default-branch=${DEFAULT_BRANCH}" >> $GITHUB_OUTPUT + - name: Download json output + id: download-artifact + uses: dawidd6/action-download-artifact@v2 # TODO: pin + with: + workflow: gateway-conformance.yml + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ steps.get-default-branch.outputs.default-branch }} + name: gateway-conformance.json + repo: ${{ matrix.target }} + if_no_artifact_found: fail + - name: debug + run: | + ls ./ + ls ./**/* + - name: Upload JSON output + if: (failure() || success()) + uses: actions/upload-artifact@v3 + with: + name: conformance-${{ matrix.target }}.json + path: ./gateway-conformance.json/output.json + aggregate: + runs-on: "ubuntu-latest" + needs: [pull-outputs] + # the tests might have failed + if: always() + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v3 + with: + path: "gateway-conformance" + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + - name: Aggregate results + working-directory: ./artifacts + run: | + mkdir ./aggregates + + # download-artifact downloads artifacts in a directory named after the artifact + # details: https://github.com/actions/download-artifact#download-all-artifacts + for folder in ./conformance-*.json; do + file="${folder}/output.json" + new_file="aggregates/${folder#conformance-}" + jq -ns 'inputs' "$file" | node ../gateway-conformance/aggregate.js 1 > "${new_file}" + done + + node ../gateway-conformance/aggregate-into-table.js ./aggregates/*.json > ./table.md + - name: Set summary + if: (failure() || success()) + run: cat ./artifacts/table.md >> $GITHUB_STEP_SUMMARY