|
| 1 | +name: Gateway Conformance |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + gateway-conformance: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + # 1, Setup Node, install npm dependencies, and build all packages/* |
| 15 | + # see https://github.com/ipdxco/unified-github-workflows/blob/3a1a7870ce5967163d8f5c8210b8ad50b2e659aa/.github/workflows/js-test-and-release.yml#L28-L34 |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + - uses: actions/setup-node@v4 |
| 18 | + with: |
| 19 | + node-version: lts/* |
| 20 | + - uses: ipfs/aegir/actions/cache-node-modules@master |
| 21 | + |
| 22 | + # 2. Set up 'go' so we can install the gateway-conformance binary |
| 23 | + - name: Setup Go |
| 24 | + uses: actions/setup-go@v4 |
| 25 | + with: |
| 26 | + go-version: 1.21.x |
| 27 | + |
| 28 | + # 3. Download the gateway-conformance fixtures using ipfs/gateway-conformance action |
| 29 | + # This will prevent us from needing to install `docker` on the github runner |
| 30 | + - name: Download gateway-conformance fixtures |
| 31 | + uses: ipfs/gateway-conformance/.github/actions/extract-fixtures@v0.5.1 |
| 32 | + # working-directory: ./packages/gateway-conformance |
| 33 | + with: |
| 34 | + output: ./packages/gateway-conformance/dist/src/fixtures/data/gateway-conformance-fixtures |
| 35 | + |
| 36 | + |
| 37 | + # 4. Run the tests |
| 38 | + - name: Run gateway-conformance tests |
| 39 | + run: | |
| 40 | + npm run test |
| 41 | + working-directory: ./packages/gateway-conformance |
| 42 | + |
| 43 | + # 5. Convert json output to reports similar to how it's done at https://github.com/ipfs/gateway-conformance/blob/main/.github/actions/test/action.yml |
| 44 | + # the 'gwc-report-all.json' file is created by the 'has expected total failures and successes' test |
| 45 | + # TODO: remove this when we're passing enough tests to use the 'ipfs/gateway-conformance/.github/actions/test' action |
| 46 | + - name: Create the XML |
| 47 | + if: failure() || success() |
| 48 | + uses: pl-strflt/gotest-json-to-junit-xml@v1 |
| 49 | + with: |
| 50 | + input: ./packages/gateway-conformance/gwc-report-all.json |
| 51 | + output: ./packages/gateway-conformance/gwc-report-all.xml |
| 52 | + - name: Create the HTML |
| 53 | + if: failure() || success() |
| 54 | + uses: pl-strflt/junit-xml-to-html@v1 |
| 55 | + with: |
| 56 | + mode: no-frames |
| 57 | + input: ./packages/gateway-conformance/gwc-report-all.xml |
| 58 | + output: ./packages/gateway-conformance/gwc-report-all.html |
| 59 | + - name: Create the Markdown |
| 60 | + if: failure() || success() |
| 61 | + uses: pl-strflt/junit-xml-to-html@v1 |
| 62 | + with: |
| 63 | + mode: summary |
| 64 | + input: ./packages/gateway-conformance/gwc-report-all.xml |
| 65 | + output: ./packages/gateway-conformance/gwc-report-all.md |
| 66 | + |
| 67 | + # 6. Upload the reports |
| 68 | + - name: Upload MD summary |
| 69 | + if: failure() || success() |
| 70 | + run: cat ./packages/gateway-conformance/gwc-report-all.md >> $GITHUB_STEP_SUMMARY |
| 71 | + - name: Upload HTML report |
| 72 | + if: failure() || success() |
| 73 | + uses: actions/upload-artifact@v4 |
| 74 | + with: |
| 75 | + name: gateway-conformance.html |
| 76 | + path: ./packages/gateway-conformance/gwc-report-all.html |
| 77 | + - name: Upload JSON report |
| 78 | + if: failure() || success() |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: gateway-conformance.json |
| 82 | + path: ./packages/gateway-conformance/gwc-report-all.json |
0 commit comments