Skip to content

Commit

Permalink
ci.yml: fix caching
Browse files Browse the repository at this point in the history
Aux requires more dependencies than other jobs. It also doesn't fail as often as others.
Because of these two points aux will be the cache updating job.

Other jobs use actions/cache/restore and are the cache readers.
Old and gvisor are the special cases that are not gcr.io/syzkaller/env based and require additional GOMODCACHE param.
  • Loading branch information
tarasmadan committed Jan 30, 2025
1 parent ec43420 commit 4c6ac32
Showing 1 changed file with 43 additions and 18 deletions.
61 changes: 43 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ jobs:
path: gopath/src/github.com/google/syzkaller
# This is needed for tools/check-commits.sh
fetch-depth: 100
- id: get-date
run: echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
shell: bash
- name: update cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: /syzkaller/.cache
key: ${{ runner.os }}-syzenv-${{ steps.get-date.outputs.date }}
# Run make presubmit_aux.
- name: run
env:
Expand All @@ -53,17 +61,11 @@ jobs:
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
path: gopath/src/github.com/google/syzkaller

- id: get-date
run: echo "date=$(/bin/date -u "+%Y%m%d+%T")" >> $GITHUB_OUTPUT
shell: bash
- name: test build cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
- name: restore cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: /root/.cache
key: ${{ runner.os }}-go-test-build-${{ steps.get-date.outputs.date }} #always miss and upload fresh item
restore-keys: ${{ runner.os }}-go-test-build- #read the freshest available after miss

path: /syzkaller/.cache
key: ${{ runner.os }}-syzenv-
- name: run
run: |
cd gopath/src/github.com/google/syzkaller
Expand All @@ -90,6 +92,11 @@ jobs:
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
path: gopath/src/github.com/google/syzkaller
- name: restore cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: /syzkaller/.cache
key: ${{ runner.os }}-syzenv-
- name: run
run: |
cd gopath/src/github.com/google/syzkaller
Expand Down Expand Up @@ -118,6 +125,11 @@ jobs:
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
path: gopath/src/github.com/google/syzkaller
- name: restore cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: /syzkaller/.cache
key: ${{ runner.os }}-syzenv-
- name: run
run: |
cd gopath/src/github.com/google/syzkaller
Expand All @@ -138,15 +150,11 @@ jobs:
path: gopath/src/github.com/google/syzkaller

# https://github.com/golang/go/issues/61608 to cache -race results.
- id: get-date
run: echo "date=$(/bin/date -u "+%Y%m%d+%T")" >> $GITHUB_OUTPUT
shell: bash
- name: test race cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
- name: restore cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: /root/.cache
key: ${{ runner.os }}-go-test-race-${{ steps.get-date.outputs.date }} #always miss and upload fresh item
restore-keys: ${{ runner.os }}-go-test-race- #read the freshest available after miss
path: /syzkaller/.cache
key: ${{ runner.os }}-syzenv-

- name: run
run: |
Expand All @@ -165,6 +173,11 @@ jobs:
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
path: gopath/src/github.com/google/syzkaller
- name: restore cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: /syzkaller/.cache
key: ${{ runner.os }}-syzenv-
- name: run
run: |
cd gopath/src/github.com/google/syzkaller
Expand All @@ -175,13 +188,19 @@ jobs:
container: gcr.io/syzkaller/old-env:latest
env:
GOPATH: /__w/syzkaller/syzkaller/gopath
GOMODCACHE: /syzkaller/.cache/gomod
CI: true
TERM: dumb
steps:
- name: checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
path: gopath/src/github.com/google/syzkaller
- name: restore cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: /syzkaller/.cache
key: ${{ runner.os }}-syzenv-
- name: run
run: |
cd gopath/src/github.com/google/syzkaller
Expand All @@ -193,6 +212,7 @@ jobs:
options: --privileged
env:
GOPATH: /__w/syzkaller/syzkaller/gopath
GOMODCACHE: /syzkaller/.cache/gomod
CI: true
TERM: dumb
GITHUB_ACTIONS: true
Expand All @@ -201,6 +221,11 @@ jobs:
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
path: gopath/src/github.com/google/syzkaller
- name: restore cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: /syzkaller/.cache
key: ${{ runner.os }}-syzenv-
- name: run
run: |
cd gopath/src/github.com/google/syzkaller
Expand Down

0 comments on commit 4c6ac32

Please sign in to comment.