Skip to content

Commit

Permalink
Chore(ci): Clear cache after testing
Browse files Browse the repository at this point in the history
  • Loading branch information
literat committed Sep 30, 2024
1 parent 2a1f3d5 commit d4d09d9
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
NX_BRANCH: ${{ github.event.number || github.ref_name }}
NX_VERBOSE_LOGGING: true
NX_NO_CLOUD: true
CACHE_KEY: repository-cache-key-${{ github.run_id }}

jobs:
install-build:
Expand All @@ -30,10 +31,11 @@ jobs:
run: yarn workspace @lmc-eu/spirit-design-tokens build

- name: Save Repository to Cache
id: save-repository-cache
uses: actions/cache/save@v4
with:
path: ./
key: repository-builds-cache-${{ hashFiles('.*') }}
key: ${{ env.CACHE_KEY }}

lint:
name: 📐 Code Linting
Expand All @@ -49,7 +51,7 @@ jobs:
id: restore-repository-cache
with:
path: ./
key: repository-builds-cache-${{ hashFiles('.*') }}
key: ${{ env.CACHE_KEY }}

- name: Setup Node
uses: ./.github/actions/setup-node
Expand All @@ -71,7 +73,7 @@ jobs:
id: restore-repository-cache
with:
path: ./
key: repository-builds-cache-${{ hashFiles('.*') }}
key: ${{ env.CACHE_KEY }}

- name: Setup Node
uses: ./.github/actions/setup-node
Expand Down Expand Up @@ -140,10 +142,28 @@ jobs:
id: restore-repository-cache
with:
path: ./
key: repository-builds-cache-${{ hashFiles('**/build') }}
key: ${{ env.CACHE_KEY }}

- name: Setup Node
uses: ./.github/actions/setup-node

- name: Types Check
run: yarn types

cleanup:
name: 🧹 Cleanup
needs: [lint, unit-tests, types]
runs-on: ubuntu-24.04
timeout-minutes: 10

steps:
- name: Checkout
uses: actions/checkout@v4

# @see: https://github.com/actions/cache/blob/main/tips-and-workarounds.md#force-deletion-of-caches-overriding-default-cache-eviction-policy
- name: Cleanup cache
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete "${{ env.CACHE_KEY }}" --confirm
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit d4d09d9

Please sign in to comment.