Skip to content

Commit

Permalink
ci: simplify self-hosted runner selection (#9813)
Browse files Browse the repository at this point in the history
* ci: simplify self-hosted runner selection

* ci: put interop jobs on self-hosted runners
  • Loading branch information
galargh authored May 9, 2023
1 parent c39b805 commit c9a8d9f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 65 deletions.
34 changes: 25 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/gobuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/gotest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/runner.yml

This file was deleted.

20 changes: 9 additions & 11 deletions .github/workflows/sharness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand Down

0 comments on commit c9a8d9f

Please sign in to comment.