8000 Use a weekly cache key for PNPM store by jonkoops · Pull Request #34656 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/actions/build-keycloak/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ runs:
with:
create-cache-if-it-doesnt-exist: true

- id: frontend-plugin-cache
name: Frontend Plugin Cache
uses: ./.github/actions/frontend-plugin-cache
- id: pnpm-store-cache
name: PNPM store cache
uses: ./.github/actions/pnpm-store-cache

- id: build-keycloak
name: Build Keycloak
Expand Down
20 changes: 20 additions & 0 deletions .github/actions/cypress-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Cache Cypress
description: Caches Cypress binary to speed up the build.

runs:
using: composite
steps:
- id: cache-key
name: Cache key based on Cypress version
shell: bash
run: echo "key=cypress-binary-$(jq -r '.devDependencies.cypress' js/apps/admin-ui/package.json)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
name: Cache Cypress binary
with:
# See: https://docs.cypress.io/app/references/advanced-installation#Binary-cache
path: |
~/.cache/Cypress
/AppData/Local/Cypress/Cache
~/Library/Caches/Cypress
key: ${{ runner.os }}-${{ steps.cache-key.outputs.key }}
21 changes: 0 additions & 21 deletions .github/actions/frontend-plugin-cache/action.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/actions/integration-test-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ runs:
name: Maven cache
uses: ./.github/actions/maven-cache

- id: frontend-plugin-cache
name: Frontend Plugin Cache
uses: ./.github/actions/frontend-plugin-cache
- id: pnpm-store-cache
name: PNPM store cache
uses: ./.github/actions/pnpm-store-cache

- id: download-keycloak
name: Download Keycloak Maven artifacts
Expand Down
31 changes: 12 additions & 19 deletions .github/actions/pnpm-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,19 @@ runs:
shell: bash
run: corepack enable

- name: Get PNPM store directory
id: pnpm-cache
shell: bash
run: |
echo "store-path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- name: PNPM store cache
uses: ./.github/actions/pnpm-store-cache

- uses: actions/cache@v4
name: Setup PNPM cache
with:
# Also cache Cypress binary.
path: |
~/.cache/Cypress
${{ steps.pnpm-cache.outputs.store-path }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Cypress binary cache
uses: ./.github/actions/cypress-cache

- name: Install dependencies
shell: bash
# Run the store prune after the installation to avoid having caches which grow over time
run: |
pnpm install --prefer-offline --frozen-lockfile
pnpm store prune
run: pnpm install --prefer-offline --frozen-lockfile

# This step is only needed to ensure that the Cypress binary is installed.
# If the binary was retrieved from the cache, this step is a no-op.
- name: Install Cypress dependencies
shell: bash
working-directory: js/apps/admin-ui
run: pnpm exec cypress install
20 changes: 20 additions & 0 deletions .github/actions/pnpm-store-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Cache PNPM store
description: Caches the PNPM store to speed up the build.

runs:
using: composite
steps:
- id: weekly-cache-key
name: Key for weekly rotation of cache
shell: bash
run: echo "key=pnpm-store-`date -u "+%Y-%U"`" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
Comment thread
stianst marked this conversation as resolved.
Resolved
name: Cache PNPM store
with:
# See: https://pnpm.io/npmrc#store-dir
path: |
~/.local/share/pnpm/store
~/AppData/Local/pnpm/store
~/Library/pnpm/store
key: ${{ runner.os }}-${{ steps.weekly-cache-key.outputs.key }}
4 changes: 2 additions & 2 deletions .github/actions/unit-test-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ runs:
name: Maven cache
uses: ./.github/actions/maven-cache

- id: frontend-plugin-cache
- id: pnpm-store-cache
name: Frontend Plugin Cache
uses: ./.github/actions/frontend-plugin-cache
uses: ./.github/actions/pnpm-store-cache
0