Merge #6361: ci: better caching gh actions

a856b81f0e ci: drop unneeded comments (pasta)
189233b987 ci: handle ccache / depends based on build_target not host to avoid failing to cache all the linux 86_64 runs (pasta)
cbeeb9e00d ci: adjust caching strategy (pasta)
354d6a9aab ci: cache depends sources in a seperate step (pasta)

Pull request description:

  ## Issue being fixed or feature implemented
  Improve GitHub Actions caching to not have such large caches that get evicted frequently

  ## What was done?
  Use hash files on depends for depends related caching
  bring all depends sources under shared cache

  ## How Has This Been Tested?
  CI in my branches

  ## Breaking Changes
  None

  ## Checklist:
    _Go over all the following points, and put an `x` in all the boxes that apply._
  - [ ] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  UdjinM6:
    utACK a856b81f0e

Tree-SHA512: f3d6cfeccfed0c811686a8becc548097b63c34a338cd5ff84445a8e9254c6aa03a394125c90aab705873f39156375bbbbd6d90979d6fa78b7479f10508b21d6e
This commit is contained in:
pasta 2024-10-25 15:47:36 -05:00
commit 54bec782d3
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38
2 changed files with 32 additions and 19 deletions

View File

@ -91,19 +91,24 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
- name: Cache depends sources
uses: actions/cache@v4
with:
path: |
depends/sources
key: depends-sources-${{ hashFiles('depends/packages/*') }}
restore-keys: |
depends-sources-
- name: Cache dependencies - name: Cache dependencies
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: | path: |
depends/built
depends/${{ matrix.host }} depends/${{ matrix.host }}
depends/sdk-sources key: ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }}
# We don't care about no specific key as depends system will handle that for us
key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }}
${{ runner.os }}-depends-${{ matrix.host }} ${{ runner.os }}-depends-${{ matrix.build_target }}
${{ runner.os }}-depends
- name: Build dependencies - name: Build dependencies
run: make -j$(nproc) -C depends HOST=${{ matrix.host }} run: make -j$(nproc) -C depends HOST=${{ matrix.host }}
@ -146,26 +151,27 @@ jobs:
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
with: with:
path: | path: |
depends/built
depends/${{ matrix.host }} depends/${{ matrix.host }}
depends/sdk-sources key: ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }}
# We don't care about no specific key as depends system will handle that for us
key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }}
${{ runner.os }}-depends-${{ matrix.host }} ${{ runner.os }}-depends-${{ matrix.build_target }}
${{ runner.os }}-depends
- name: Determine PR Base SHA
id: vars
run: |
echo "PR_BASE_SHA=${{ github.event.pull_request.base.sha || '' }}" >> $GITHUB_OUTPUT
- name: CCache - name: CCache
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: | path: |
/cache /cache
key: ${{ runner.os }}-${{ matrix.host }}-${{ github.sha }} key: ${{ runner.os }}-${{ matrix.build_target }}-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-${{ matrix.host }}-${{ github.sha }} ${{ runner.os }}-${{ matrix.build_target }}-${{ github.sha }}
${{ runner.os }}-${{ matrix.host }} ${{ runner.os }}-${{ matrix.build_target }}-${{ steps.vars.outputs.PR_BASE_SHA }}
${{ runner.os }} ${{ runner.os }}-${{ matrix.build_target }}
- name: Build source and run tests - name: Build source and run tests
run: | run: |

View File

@ -79,6 +79,14 @@ jobs:
path: dash path: dash
fetch-depth: 0 fetch-depth: 0
- name: Cache depends sources
uses: actions/cache@v4
with:
path: dash/depends/sources
key: depends-sources-${{ hashFiles('dash/depends/packages/*') }}
restore-keys: |
depends-sources-
- name: Cache Guix and depends - name: Cache Guix and depends
id: guix-cache-restore id: guix-cache-restore
uses: actions/cache@v3 uses: actions/cache@v3
@ -86,7 +94,6 @@ jobs:
path: | path: |
${{ github.workspace }}/.cache ${{ github.workspace }}/.cache
${{ github.workspace }}/dash/depends/built ${{ github.workspace }}/dash/depends/built
${{ github.workspace }}/dash/depends/sources
${{ github.workspace }}/dash/depends/work ${{ github.workspace }}/dash/depends/work
/gnu/store /gnu/store
key: ${{ runner.os }}-guix-${{ matrix.build_target }}-${{ github.sha }} key: ${{ runner.os }}-guix-${{ matrix.build_target }}-${{ github.sha }}