Skip to content

Commit

Permalink
github wokflow: use large runner for race tests
Browse files Browse the repository at this point in the history
Remove the resource limits from `GOGC`, and set the GitHub workflow to
run on a large runners for race tests (ubuntu 8 cores for amd64, and
actuabed 8 cores for arm64).

Signed-off-by: Ivan Valdes <[email protected]>
  • Loading branch information
ivanvc committed Nov 16, 2023
1 parent 33db274 commit 88aefc6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/tests-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ on:
runs-on:
required: false
type: string
default: "['ubuntu-latest']"
default: ubuntu-latest
targets:
required: false
type: string
default: "['linux-unit-test-1-cpu','linux-unit-test-2-cpu','linux-unit-test-4-cpu']"
permissions: read-all

jobs:
test-linux:
strategy:
fail-fast: false
matrix:
target:
- linux-unit-test-1-cpu
- linux-unit-test-2-cpu
- linux-unit-test-4-cpu
- linux-unit-test-4-cpu-race
runs-on: ${{ fromJson(inputs.runs-on) }}
target: ${{ fromJSON(inputs.targets) }}
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v4
- id: goversion
Expand All @@ -42,13 +42,7 @@ jobs:
CPU=4 make test
;;
linux-unit-test-4-cpu-race)
# XXX: By default, the Github Action runner will terminate the process
# if it has high resource usage. Try to use GOGC to limit memory and
# cpu usage here to prevent unexpected terminating. It can be replaced
# with GOMEMLIMIT=2048MiB if the go-version is updated to >=1.19.x.
#
# REF: https://github.com/actions/runner-images/issues/6680#issuecomment-1335778010
GOGC=30 CPU=4 ENABLE_RACE=true make test
CPU=4 ENABLE_RACE=true make test
;;
*)
echo "Failed to find target"
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/tests_amd64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ on: [push, pull_request]
jobs:
test-linux-amd64:
uses: ./.github/workflows/tests-template.yml
test-linux-amd64-race:
uses: ./.github/workflows/tests-template.yml
with:
runs-on: ubuntu-latest-8-cores
targets: "['linux-unit-test-4-cpu-race']"

coverage:
needs: ["test-linux-amd64"]
needs:
- test-linux-amd64
- test-linux-amd64-race
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/tests_arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ jobs:
test-linux-arm64:
uses: ./.github/workflows/tests-template.yml
with:
runs-on: "['actuated-arm64-4cpu-16gb']"
runs-on: actuated-arm64-4cpu-16gb
test-linux-arm64-race:
uses: ./.github/workflows/tests-template.yml
with:
runs-on: actuated-arm64-8cpu-16gb
targets: "['linux-unit-test-4-cpu-race']"

0 comments on commit 88aefc6

Please sign in to comment.