| 1 | name: Sharness |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | pull_request: |
| 6 | paths-ignore: |
| 7 | - "**/*.md" |
| 8 | push: |
| 9 | branches: |
| 10 | - "master" |
| 11 | |
| 12 | concurrency: |
| 13 | group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }} |
| 14 | cancel-in-progress: true |
| 15 | |
| 16 | jobs: |
| 17 | sharness-test: |
| 18 | if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' |
| 19 | runs-on: ${{ fromJSON(github.repository == 'ipfs/kubo' && '["self-hosted", "linux", "x64", "4xlarge"]' || '"ubuntu-latest"') }} |
| 20 | timeout-minutes: ${{ github.repository == 'ipfs/kubo' && 15 || 60 }} |
| 21 | defaults: |
| 22 | run: |
| 23 | shell: bash |
| 24 | steps: |
| 25 | - name: Checkout Kubo |
| 26 | uses: actions/checkout@v6 |
| 27 | with: |
| 28 | path: kubo |
| 29 | - name: Setup Go |
| 30 | uses: actions/setup-go@v6 |
| 31 | with: |
| 32 | go-version-file: 'kubo/go.mod' |
| 33 | - name: Install missing tools |
| 34 | run: sudo apt update && sudo apt install -y socat net-tools fish libxml2-utils |
| 35 | - uses: actions/cache@v5 |
| 36 | with: |
| 37 | path: test/sharness/lib/dependencies |
| 38 | key: ${{ runner.os }}-test-generate-junit-html-${{ hashFiles('test/sharness/lib/test-generate-junit-html.sh') }} |
| 39 | - name: Run Sharness tests |
| 40 | run: | |
| 41 | make -O -j "$PARALLEL" \ |
| 42 | test_sharness \ |
| 43 | coverage/sharness_tests.coverprofile \ |
| 44 | test/sharness/test-results/sharness.xml |
| 45 | working-directory: kubo |
| 46 | env: |
| 47 | TEST_DOCKER: 1 |
| 48 | TEST_PLUGIN: 0 |
| 49 | TEST_FUSE: 0 |
| 50 | TEST_VERBOSE: 1 |
| 51 | TEST_JUNIT: 1 |
| 52 | TEST_EXPENSIVE: 1 |
| 53 | IPFS_CHECK_RCMGR_DEFAULTS: 1 |
| 54 | CONTINUE_ON_S_FAILURE: 1 |
| 55 | # increasing parallelism beyond 10 doesn't speed up the tests much |
| 56 | PARALLEL: ${{ github.repository == 'ipfs/kubo' && 10 || 3 }} |
| 57 | - name: Upload coverage report |
| 58 | uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 |
| 59 | if: failure() || success() |
| 60 | with: |
| 61 | name: sharness |
| 62 | files: kubo/coverage/sharness_tests.coverprofile |
| 63 | token: ${{ secrets.CODECOV_TOKEN }} |
| 64 | fail_ci_if_error: false |
| 65 | - name: Aggregate results |
| 66 | run: find kubo/test/sharness/test-results -name 't*-*.sh.*.counts' | kubo/test/sharness/lib/sharness/aggregate-results.sh > kubo/test/sharness/test-results/summary.txt |
| 67 | - name: 👉️ If this step failed, go to «Summary» (top left) → «HTML Report» → inspect the «Failures» column |
| 68 | run: | |
| 69 | cat kubo/test/sharness/test-results/summary.txt && |
| 70 | grep 'failed\s*0' kubo/test/sharness/test-results/summary.txt |
| 71 | - name: Add aggregate results to the summary |
| 72 | if: failure() || success() |
| 73 | run: | |
| 74 | echo "# Summary" >> $GITHUB_STEP_SUMMARY |
| 75 | echo >> $GITHUB_STEP_SUMMARY |
| 76 | cat kubo/test/sharness/test-results/summary.txt >> $GITHUB_STEP_SUMMARY |
| 77 | - name: Generate one-page HTML report |
| 78 | uses: ipdxco/junit-xml-to-html@v1 |
| 79 | if: failure() || success() |
| 80 | with: |
| 81 | mode: no-frames |
| 82 | input: kubo/test/sharness/test-results/sharness.xml |
| 83 | output: kubo/test/sharness/test-results/sharness.html |
| 84 | - name: Upload one-page HTML report to S3 |
| 85 | id: one-page |
| 86 | uses: ipdxco/custom-github-runners/.github/actions/upload-artifact@main |
| 87 | if: github.repository == 'ipfs/kubo' && (failure() || success()) |
| 88 | with: |
| 89 | source: kubo/test/sharness/test-results/sharness.html |
| 90 | destination: sharness.html |
| 91 | - name: Upload one-page HTML report |
| 92 | if: github.repository != 'ipfs/kubo' && (failure() || success()) |
| 93 | uses: actions/upload-artifact@v7 |
| 94 | with: |
| 95 | name: sharness.html |
| 96 | path: kubo/test/sharness/test-results/sharness.html |
| 97 | - name: Generate full HTML report |
| 98 | uses: ipdxco/junit-xml-to-html@v1 |
| 99 | if: failure() || success() |
| 100 | with: |
| 101 | mode: frames |
| 102 | input: kubo/test/sharness/test-results/sharness.xml |
| 103 | output: kubo/test/sharness/test-results/sharness-html |
| 104 | - name: Upload full HTML report to S3 |
| 105 | id: full |
| 106 | uses: ipdxco/custom-github-runners/.github/actions/upload-artifact@main |
| 107 | if: github.repository == 'ipfs/kubo' && (failure() || success()) |
| 108 | with: |
| 109 | source: kubo/test/sharness/test-results/sharness-html |
| 110 | destination: sharness-html/ |
| 111 | - name: Upload full HTML report |
| 112 | if: github.repository != 'ipfs/kubo' && (failure() || success()) |
| 113 | uses: actions/upload-artifact@v7 |
| 114 | with: |
| 115 | name: sharness-html |
| 116 | path: kubo/test/sharness/test-results/sharness-html |
| 117 | - name: Add S3 links to the summary |
| 118 | if: github.repository == 'ipfs/kubo' && (failure() || success()) |
| 119 | run: echo "$MD" >> $GITHUB_STEP_SUMMARY |
| 120 | env: |
| 121 | MD: | |
| 122 | # HTML Reports |
| 123 | |
| 124 | - View the [one page HTML report](${{ steps.one-page.outputs.url }}) |
| 125 | - View the [full HTML report](${{ steps.full.outputs.url }}index.html) |