Skip to content

Commit

Permalink
Merge #6361: ci: better caching gh actions
Browse files Browse the repository at this point in the history
a856b81 ci: drop unneeded comments (pasta)
189233b ci: handle ccache / depends based on build_target not host to avoid failing to cache all the linux 86_64 runs (pasta)
cbeeb9e ci: adjust caching strategy (pasta)
354d6a9 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 a856b81

Tree-SHA512: f3d6cfeccfed0c811686a8becc548097b63c34a338cd5ff84445a8e9254c6aa03a394125c90aab705873f39156375bbbbd6d90979d6fa78b7479f10508b21d6e
  • Loading branch information
PastaPastaPasta committed Oct 25, 2024
2 parents e12afdf + a856b81 commit 54bec78
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
42 changes: 24 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,24 @@ jobs:
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
uses: actions/cache@v4
with:
path: |
depends/built
depends/${{ matrix.host }}
depends/sdk-sources
# We don't care about no specific key as depends system will handle that for us
key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }}
key: ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }}
restore-keys: |
${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }}
${{ runner.os }}-depends-${{ matrix.host }}
${{ runner.os }}-depends
${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }}
${{ runner.os }}-depends-${{ matrix.build_target }}
- name: Build dependencies
run: make -j$(nproc) -C depends HOST=${{ matrix.host }}
Expand Down Expand Up @@ -146,26 +151,27 @@ jobs:
uses: actions/cache/restore@v4
with:
path: |
depends/built
depends/${{ matrix.host }}
depends/sdk-sources
# We don't care about no specific key as depends system will handle that for us
key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }}
key: ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }}
restore-keys: |
${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }}
${{ runner.os }}-depends-${{ matrix.host }}
${{ runner.os }}-depends
${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }}
${{ runner.os }}-depends-${{ matrix.build_target }}
- name: Determine PR Base SHA
id: vars
run: |
echo "PR_BASE_SHA=${{ github.event.pull_request.base.sha || '' }}" >> $GITHUB_OUTPUT
- name: CCache
uses: actions/cache@v4
with:
path: |
/cache
key: ${{ runner.os }}-${{ matrix.host }}-${{ github.sha }}
key: ${{ runner.os }}-${{ matrix.build_target }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.host }}-${{ github.sha }}
${{ runner.os }}-${{ matrix.host }}
${{ runner.os }}
${{ runner.os }}-${{ matrix.build_target }}-${{ github.sha }}
${{ runner.os }}-${{ matrix.build_target }}-${{ steps.vars.outputs.PR_BASE_SHA }}
${{ runner.os }}-${{ matrix.build_target }}
- name: Build source and run tests
run: |
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/guix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,21 @@ jobs:
path: dash
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
id: guix-cache-restore
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.cache
${{ github.workspace }}/dash/depends/built
${{ github.workspace }}/dash/depends/sources
${{ github.workspace }}/dash/depends/work
/gnu/store
key: ${{ runner.os }}-guix-${{ matrix.build_target }}-${{ github.sha }}
Expand Down

0 comments on commit 54bec78

Please sign in to comment.