Skip to content

Commit

Permalink
ci: use the same go mod cache across test-core jobs (#15006)
Browse files Browse the repository at this point in the history
* ci: use the same go mod cache for test-core jobs

* ci: precache go modules

* ci: add a mods precache job
  • Loading branch information
shoenig committed Oct 21, 2022
1 parent 5732eb2 commit dbd742d
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/test-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,20 @@ env:
NOMAD_SLOW_TEST: 0
NOMAD_TEST_LOG_LEVEL: OFF
jobs:
mods:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: magnetikonline/action-golang-cache@v1
with:
go-version: ${{env.GO_VERSION}}
- name: Pre-cache Go modules
run: |
make tidy
make bootstrap
checks:
needs: [mods]
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
Expand All @@ -40,13 +53,14 @@ jobs:
- uses: magnetikonline/action-golang-cache@v1
with:
go-version: ${{env.GO_VERSION}}
cache-key-suffix: -checks
cache-key-suffix: -core
- name: Run make check
run: |
make missing
make bootstrap
make check
compile:
needs: [mods]
strategy:
fail-fast: false
matrix:
Expand All @@ -58,22 +72,23 @@ jobs:
- uses: magnetikonline/action-golang-cache@v1
with:
go-version: ${{env.GO_VERSION}}
cache-key-suffix: -compile
cache-key-suffix: -core
- name: Run make dev
env:
GOBIN: ${{env.GOROOT}}/bin # windows kludge
run: |
make bootstrap
make dev
tests-api:
needs: [mods]
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: magnetikonline/action-golang-cache@v1
with:
go-version: ${{env.GO_VERSION}}
cache-key-suffix: -api
cache-key-suffix: -core
- name: Run API tests
env:
GOTEST_MOD: api
Expand All @@ -83,6 +98,7 @@ jobs:
sudo sed -i 's!Defaults!#Defaults!g' /etc/sudoers
sudo -E env "PATH=$PATH" make test-nomad-module
tests-pkgs:
needs: [mods]
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
Expand Down Expand Up @@ -139,7 +155,7 @@ jobs:
- uses: magnetikonline/action-golang-cache@v1
with:
go-version: ${{env.GO_VERSION}}
cache-key-suffix: -pkgs
cache-key-suffix: -core
- name: Run Matrix Tests
env:
GOTEST_PKGS: ./${{matrix.pkg}}
Expand Down

0 comments on commit dbd742d

Please sign in to comment.