Use a weekly cache key for PNPM store (#34656)
Closes #34655 Signed-off-by: Jon Koops <jonkoops@gmail.com>
This commit is contained in:
parent
65e90d2ff4
commit
b44aee7535
7 changed files with 60 additions and 48 deletions
6
.github/actions/build-keycloak/action.yml
vendored
6
.github/actions/build-keycloak/action.yml
vendored
|
@ -24,9 +24,9 @@ runs:
|
||||||
with:
|
with:
|
||||||
create-cache-if-it-doesnt-exist: true
|
create-cache-if-it-doesnt-exist: true
|
||||||
|
|
||||||
- id: frontend-plugin-cache
|
- id: pnpm-store-cache
|
||||||
name: Frontend Plugin Cache
|
name: PNPM store cache
|
||||||
uses: ./.github/actions/frontend-plugin-cache
|
uses: ./.github/actions/pnpm-store-cache
|
||||||
|
|
||||||
- id: build-keycloak
|
- id: build-keycloak
|
||||||
name: Build Keycloak
|
name: Build Keycloak
|
||||||
|
|
20
.github/actions/cypress-cache/action.yml
vendored
Normal file
20
.github/actions/cypress-cache/action.yml
vendored
Normal file
|
@ -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
.github/actions/frontend-plugin-cache/action.yml
vendored
21
.github/actions/frontend-plugin-cache/action.yml
vendored
|
@ -1,21 +0,0 @@
|
||||||
name: Frontend Plugin Cache
|
|
||||||
description: Caches NPM dependencies for the frontend-maven-plugin to speed up builds
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- name: Get PNPM version
|
|
||||||
id: pnpm-version
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "version=$(./mvnw help:evaluate -Dexpression=pnpm.version -q -DforceStdout)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- uses: actions/cache@v4
|
|
||||||
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 }}-frontend-plugin-pnpm-store-${{ steps.pnpm-version.outputs.version }}-${{ hashFiles('pnpm-lock.yaml') }}
|
|
|
@ -25,9 +25,9 @@ runs:
|
||||||
name: Maven cache
|
name: Maven cache
|
||||||
uses: ./.github/actions/maven-cache
|
uses: ./.github/actions/maven-cache
|
||||||
|
|
||||||
- id: frontend-plugin-cache
|
- id: pnpm-store-cache
|
||||||
name: Frontend Plugin Cache
|
name: PNPM store cache
|
||||||
uses: ./.github/actions/frontend-plugin-cache
|
uses: ./.github/actions/pnpm-store-cache
|
||||||
|
|
||||||
- id: download-keycloak
|
- id: download-keycloak
|
||||||
name: Download Keycloak Maven artifacts
|
name: Download Keycloak Maven artifacts
|
||||||
|
|
31
.github/actions/pnpm-setup/action.yml
vendored
31
.github/actions/pnpm-setup/action.yml
vendored
|
@ -20,26 +20,19 @@ runs:
|
||||||
shell: bash
|
shell: bash
|
||||||
run: corepack enable
|
run: corepack enable
|
||||||
|
|
||||||
- name: Get PNPM store directory
|
- name: PNPM store cache
|
||||||
id: pnpm-cache
|
uses: ./.github/actions/pnpm-store-cache
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "store-path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- uses: actions/cache@v4
|
- name: Cypress binary cache
|
||||||
name: Setup PNPM cache
|
uses: ./.github/actions/cypress-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: Install dependencies
|
- name: Install dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
# Run the store prune after the installation to avoid having caches which grow over time
|
run: pnpm install --prefer-offline --frozen-lockfile
|
||||||
run: |
|
|
||||||
pnpm install --prefer-offline --frozen-lockfile
|
# This step is only needed to ensure that the Cypress binary is installed.
|
||||||
pnpm store prune
|
# 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
.github/actions/pnpm-store-cache/action.yml
vendored
Normal file
20
.github/actions/pnpm-store-cache/action.yml
vendored
Normal file
|
@ -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
|
||||||
|
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
.github/actions/unit-test-setup/action.yml
vendored
4
.github/actions/unit-test-setup/action.yml
vendored
|
@ -11,6 +11,6 @@ runs:
|
||||||
name: Maven cache
|
name: Maven cache
|
||||||
uses: ./.github/actions/maven-cache
|
uses: ./.github/actions/maven-cache
|
||||||
|
|
||||||
- id: frontend-plugin-cache
|
- id: pnpm-store-cache
|
||||||
name: Frontend Plugin Cache
|
name: Frontend Plugin Cache
|
||||||
uses: ./.github/actions/frontend-plugin-cache
|
uses: ./.github/actions/pnpm-store-cache
|
||||||
|
|
Loading…
Reference in a new issue