diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1f16d9bf399..e59532597b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,10 @@ concurrency: group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }} cancel-in-progress: true +defaults: + run: + shell: bash + jobs: interop-prep: if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' @@ -44,7 +48,7 @@ jobs: path: cmd/ipfs/ipfs interop: needs: [interop-prep] - runs-on: ubuntu-latest + runs-on: ${{ fromJSON(github.repository == 'ipfs/kubo' && '["self-hosted", "linux", "x64", "2xlarge"]' || '"ubuntu-latest"') }} timeout-minutes: 20 defaults: run: @@ -75,7 +79,7 @@ jobs: npm install ipfs-interop@^10.0.1 working-directory: interop # Run the interop tests while ignoring the js-js interop test cases - - run: npx ipfs-interop -- -t node --grep '^(?!.*(js\d? -> js\d?|js-js-js))' + - run: npx ipfs-interop -- -t node --grep '^(?!.*(js\d? -> js\d?|js-js-js))' --parallel env: LIBP2P_TCP_REUSEPORT: false LIBP2P_ALLOW_WEAK_RSA_KEYS: 1 @@ -156,7 +160,7 @@ jobs: working-directory: go-ipfs-http-client ipfs-webui: needs: [interop-prep] - runs-on: ubuntu-latest + runs-on: ${{ fromJSON(github.repository == 'ipfs/kubo' && '["self-hosted", "linux", "x64", "2xlarge"]' || '"ubuntu-latest"') }} timeout-minutes: 20 env: NO_SANDBOX: true @@ -191,14 +195,26 @@ jobs: key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-${{ github.job }}- - - run: | - npm ci --prefer-offline --no-audit --progress=false - npx playwright install + - env: + NPM_CACHE_DIR: ${{ steps.npm-cache-dir.outputs.dir }} + run: | + npm ci --prefer-offline --no-audit --progress=false --cache "$NPM_CACHE_DIR" + npx playwright install --with-deps + working-directory: ipfs-webui + - id: ref + run: echo "ref=$(git rev-parse --short HEAD)" | tee -a $GITHUB_OUTPUT working-directory: ipfs-webui - - name: Run ipfs-webui@main build and smoke-test to confirm the upstream repo is not broken - run: npm test + - id: state + env: + GITHUB_REPOSITORY: ipfs/ipfs-webui + GITHUB_REF: ${{ steps.ref.outputs.ref }} + GITHUB_TOKEN: ${{ github.token }} + run: | + echo "state=$(curl -L -H "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$GITHUB_REF/status" --jq '.state')" | tee -a $GITHUB_OUTPUT + - name: Build ipfs-webui@main (state=${{ steps.state.outputs.state }}) + run: npm run test:build working-directory: ipfs-webui - - name: Test ipfs-webui@main E2E against the locally built Kubo binary + - name: Test ipfs-webui@main (state=${{ steps.state.outputs.state }}) E2E against the locally built Kubo binary run: npm run test:e2e env: IPFS_GO_EXEC: ${{ github.workspace }}/cmd/ipfs/ipfs diff --git a/.github/workflows/gobuild.yml b/.github/workflows/gobuild.yml index f1e3a60b776..8591213c4b2 100644 --- a/.github/workflows/gobuild.yml +++ b/.github/workflows/gobuild.yml @@ -12,12 +12,9 @@ concurrency: cancel-in-progress: true jobs: - go-build-runner: - if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' - uses: ipfs/kubo/.github/workflows/runner.yml@master go-build: - needs: [go-build-runner] - runs-on: ${{ fromJSON(needs.go-build-runner.outputs.config).labels }} + if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' + runs-on: ${{ fromJSON(github.repository == 'ipfs/kubo' && '["self-hosted", "linux", "x64", "4xlarge"]' || '"ubuntu-latest"') }} timeout-minutes: 20 env: TEST_DOCKER: 0 diff --git a/.github/workflows/gotest.yml b/.github/workflows/gotest.yml index 81c39fd5e51..b20dca2a38e 100644 --- a/.github/workflows/gotest.yml +++ b/.github/workflows/gotest.yml @@ -12,12 +12,9 @@ concurrency: cancel-in-progress: true jobs: - go-test-runner: - if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' - uses: ipfs/kubo/.github/workflows/runner.yml@master go-test: - needs: [go-test-runner] - runs-on: ${{ fromJSON(needs.go-test-runner.outputs.config).labels }} + if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' + runs-on: ${{ fromJSON(github.repository == 'ipfs/kubo' && '["self-hosted", "linux", "x64", "2xlarge"]' || '"ubuntu-latest"') }} timeout-minutes: 20 env: TEST_DOCKER: 0 @@ -41,8 +38,11 @@ jobs: with: name: ${{ github.job }} - name: 👉️ If this step failed, go to «Summary» (top left) → inspect the «Failures/Errors» table + env: + # increasing parallelism beyond 2 doesn't speed up the tests much + PARALLEL: 2 run: | - make -j 2 test/unit/gotest.junit.xml && + make -j "$PARALLEL" test/unit/gotest.junit.xml && [[ ! $(jq -s -c 'map(select(.Action == "fail")) | .[]' test/unit/gotest.json) ]] - name: Upload coverage to Codecov uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml deleted file mode 100644 index 74a8b41d764..00000000000 --- a/.github/workflows/runner.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Runner - -on: - workflow_call: - outputs: - config: - description: "The runner's configuration" - value: ${{ jobs.choose.outputs.config }} - -jobs: - choose: - runs-on: ubuntu-latest - timeout-minutes: 1 - outputs: - config: ${{ steps.config.outputs.result }} - steps: - - uses: actions/github-script@v6 - id: config - with: - script: | - if (`${context.repo.owner}/${context.repo.repo}` === 'ipfs/kubo') { - return { - labels: ['self-hosted', 'linux', 'x64', 'kubo'], - parallel: 10, - aws: true - } - } else { - return { - labels: ['ubuntu-latest'], - parallel: 3, - aws: false - } - } - - run: echo ${{ steps.config.outputs.result }} diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 2d9dfb41da2..a4c2241bee4 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -12,12 +12,9 @@ concurrency: cancel-in-progress: true jobs: - sharness-runner: - if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' - uses: ipfs/kubo/.github/workflows/runner.yml@master sharness-test: - needs: [sharness-runner] - runs-on: ${{ fromJSON(needs.sharness-runner.outputs.config).labels }} + if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' + runs-on: ${{ fromJSON(github.repository == 'ipfs/kubo' && '["self-hosted", "linux", "x64", "4xlarge"]' || '"ubuntu-latest"') }} timeout-minutes: 20 defaults: run: @@ -57,7 +54,8 @@ jobs: TEST_EXPENSIVE: 1 IPFS_CHECK_RCMGR_DEFAULTS: 1 CONTINUE_ON_S_FAILURE: 1 - PARALLEL: ${{ fromJSON(needs.sharness-runner.outputs.config).parallel }} + # increasing parallelism beyond 10 doesn't speed up the tests much + PARALLEL: ${{ github.repository == 'ipfs/kubo' && 10 || 3 }} - name: Upload coverage report uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 if: failure() || success() @@ -86,12 +84,12 @@ jobs: - name: Upload one-page HTML report to S3 id: one-page uses: pl-strflt/tf-aws-gh-runner/.github/actions/upload-artifact@main - if: fromJSON(needs.sharness-runner.outputs.config).aws && (failure() || success()) + if: github.repository == 'ipfs/kubo' && (failure() || success()) with: source: kubo/test/sharness/test-results/sharness.html destination: sharness.html - name: Upload one-page HTML report - if: (! fromJSON(needs.sharness-runner.outputs.config).aws) && (failure() || success()) + if: github.repository != 'ipfs/kubo' && (failure() || success()) uses: actions/upload-artifact@v3 with: name: sharness.html @@ -106,18 +104,18 @@ jobs: - name: Upload full HTML report to S3 id: full uses: pl-strflt/tf-aws-gh-runner/.github/actions/upload-artifact@main - if: fromJSON(needs.sharness-runner.outputs.config).aws && (failure() || success()) + if: github.repository == 'ipfs/kubo' && (failure() || success()) with: source: kubo/test/sharness/test-results/sharness-html destination: sharness-html/ - name: Upload full HTML report - if: (! fromJSON(needs.sharness-runner.outputs.config).aws) && (failure() || success()) + if: github.repository != 'ipfs/kubo' && (failure() || success()) uses: actions/upload-artifact@v3 with: name: sharness-html path: kubo/test/sharness/test-results/sharness-html - name: Add S3 links to the summary - if: fromJSON(needs.sharness-runner.outputs.config).aws && (failure() || success()) + if: github.repository == 'ipfs/kubo' && (failure() || success()) run: echo "$MD" >> $GITHUB_STEP_SUMMARY env: MD: |