Skip to content

Commit

Permalink
ci: let's free up some space and try merging all caches
Browse files Browse the repository at this point in the history
  • Loading branch information
develop7 committed Nov 28, 2023
1 parent dd5da89 commit 3d2a2cb
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,16 @@ jobs:
# NOTE: Regular users don't have permission to delete cache entries, which this job tries to do (see `purge: true` below).
merge-nix-caches-linux:
name: "Merge Nix caches (Linux)"
# needs: [Test-Nix, Test-Pg-Nix, Test-Memory-Nix, Build-Static-Nix, Lint-Style] # Honestly, we don't really care of the order of cache merge job. Let's see how this works.
needs: [Test-Nix, Test-Pg-Nix, Test-Memory-Nix, Build-Static-Nix, Lint-Style] # Honestly, we don't really care of the order of cache merge job. Let's see how this works.
runs-on: ubuntu-latest
strategy:
max-parallel: 1 # This hopefully prevents reserving cache entries by a single job, which would cause other jobs to fail to store "common" cache.
matrix:
cache-id: ['static-nix', 'test-pg', 'style', 'test-memory', 'loadtest']
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v26
with:
nix_version: '2.13.6'
- uses: jlumbroso/[email protected]
with:
android: false # Free up 14-ish GB of disk space by removing Android SDK
- name: Restore and cache Nix store
uses: nix-community/cache-nix-action@v4
with:
Expand All @@ -162,11 +161,11 @@ jobs:
# Specifying single per-job-type cache key effectively restores only 2 caches: the "common" cache and the cache for the current job type.
# They are restored over one another, so resulting cache has all the nix store entries merged.
extra-restore-keys: |
cache-nix-${{ runner.os }}-id-${{ matrix.cache-id }}-
cache-nix-${{ runner.os }}-id-
purge: true
# This purges current_job_type cache and the "common" cache older than 1 day, to save cache space.
purge-keys: |
cache-nix-${{ runner.os }}-id-${{ matrix.cache-id }}-
cache-nix-${{ runner.os }}-id-
cache-nix-${{ runner.os }}-common-
purge-created-max-age: 86400 # 1 day
# TODO: enable garbage collection
Expand Down

0 comments on commit 3d2a2cb

Please sign in to comment.