mirror of
https://github.com/zen-browser/www.git
synced 2025-07-08 01:10:02 +02:00
refactor(ci): improve cache restore logic in ci pipeline
This commit is contained in:
parent
5c88a249ff
commit
83f070ada2
2 changed files with 52 additions and 12 deletions
40
.github/composite-actions/restore-cache/action.yml
vendored
Normal file
40
.github/composite-actions/restore-cache/action.yml
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
name: "Restore Node.js and pnpm caches"
|
||||||
|
description: "Restore Node.js, pnpm, and cached dependencies without installing"
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
turbo-cache-key:
|
||||||
|
description: "Cache key for Turborepo"
|
||||||
|
required: true
|
||||||
|
node-modules-cache-key:
|
||||||
|
description: "Cache key for node_modules"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Restore Turborepo cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: .turbo
|
||||||
|
key: ${{ inputs.turbo-cache-key }}
|
||||||
|
lookup-only: true
|
||||||
|
|
||||||
|
- name: Restore node_modules cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
node_modules
|
||||||
|
*/node_modules
|
||||||
|
key: ${{ inputs.node-modules-cache-key }}
|
||||||
|
lookup-only: true
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: lts/*
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 10.11.0
|
||||||
|
run_install: false
|
24
.github/workflows/ci-pipeline.yml
vendored
24
.github/workflows/ci-pipeline.yml
vendored
|
@ -56,8 +56,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js and pnpm
|
- name: Restore Node.js and pnpm caches
|
||||||
uses: ./.github/composite-actions/setup-node-pnpm
|
uses: ./.github/composite-actions/restore-cache
|
||||||
with:
|
with:
|
||||||
turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }}
|
turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }}
|
||||||
node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
@ -73,8 +73,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js and pnpm
|
- name: Restore Node.js and pnpm caches
|
||||||
uses: ./.github/composite-actions/setup-node-pnpm
|
uses: ./.github/composite-actions/restore-cache
|
||||||
with:
|
with:
|
||||||
turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }}
|
turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }}
|
||||||
node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
@ -90,8 +90,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js and pnpm
|
- name: Restore Node.js and pnpm caches
|
||||||
uses: ./.github/composite-actions/setup-node-pnpm
|
uses: ./.github/composite-actions/restore-cache
|
||||||
with:
|
with:
|
||||||
turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }}
|
turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }}
|
||||||
node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
@ -107,8 +107,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js and pnpm
|
- name: Restore Node.js and pnpm caches
|
||||||
uses: ./.github/composite-actions/setup-node-pnpm
|
uses: ./.github/composite-actions/restore-cache
|
||||||
with:
|
with:
|
||||||
turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }}
|
turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }}
|
||||||
node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
@ -124,8 +124,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js and pnpm
|
- name: Restore Node.js and pnpm caches
|
||||||
uses: ./.github/composite-actions/setup-node-pnpm
|
uses: ./.github/composite-actions/restore-cache
|
||||||
with:
|
with:
|
||||||
turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }}
|
turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }}
|
||||||
node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
@ -143,8 +143,8 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Node.js and pnpm
|
- name: Restore Node.js and pnpm caches
|
||||||
uses: ./.github/composite-actions/setup-node-pnpm
|
uses: ./.github/composite-actions/restore-cache
|
||||||
with:
|
with:
|
||||||
turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }}
|
turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }}
|
||||||
node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue