CI: Implement better caching#4
Conversation
- Use `RUNNER_TEMP` to determine the cache directory - Key the cache based on the target architecture and type, to provider better matching for the packages - Tell docker buildx to use "local" caching, as the GHA one does not appear to work correctly - Add `GOCACHE` / `GOMODCACHE` to the docker cache layer information - Use arm64 native runners where appropriate - Drop the use of `actions/setup-go` because we never run the go toolchain outside of docker Signed-off-by: Mark Yen <mark.yen@suse.com>
| runs-on: ${{ matrix.runs-on }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: |
There was a problem hiding this comment.
Would it be clearer if we rewrote the matrix as follows?
matrix:
include:
- type: tar.xz
arch: amd64
runs-on: ubuntu-latest
- type: qcow2
arch: amd64
runs-on: ubuntu-latest
- type: qcow2
arch: arm64
runs-on: ubuntu-24.04-arm
We can also remove the exclude.
There was a problem hiding this comment.
Hmm, that makes it less clear that the runs-on is directly tied to arch, but it avoids the need to understand the confusing include syntax.
.github/workflows/build.yaml
Outdated
| - type: tar.xz | ||
| arch: arm64 | ||
| env: | ||
| GO: /bin/false |
There was a problem hiding this comment.
I noticed that Set up go was removed which suggests that the build runs inside Docker/buildx and doesn't need Go on the runner. But I'm curious why to explicitly fail go invocation? is it still necessary? if so, maybe a comment would be helpful.
There was a problem hiding this comment.
It's just there because the Makefile wants it to be set to something to auto-detect GOOS and GOARCH (which we also provide).
Signed-off-by: Mark Yen <mark.yen@suse.com>
| runs-on: ${{ matrix.runs-on }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: |
There was a problem hiding this comment.
Hmm, that makes it less clear that the runs-on is directly tied to arch, but it avoids the need to understand the confusing include syntax.
.github/workflows/build.yaml
Outdated
| - type: tar.xz | ||
| arch: arm64 | ||
| env: | ||
| GO: /bin/false |
There was a problem hiding this comment.
It's just there because the Makefile wants it to be set to something to auto-detect GOOS and GOARCH (which we also provide).
RUNNER_TEMPto determine the cache directoryGOCACHE/GOMODCACHEto the docker cache layer informationactions/setup-gobecause we never run the go toolchain outside of dockerNote that the arm64 build might fail to cache because the cache is too large and the runner runs out of disk :D Unfortunately we can't do anything about that at the moment.
Sample run: https://github.com/mook-as/rancher-desktop-opensuse/actions/runs/19050938327