Skip to content

Commit

Permalink
CI: Optimisations
Browse files Browse the repository at this point in the history
  • Loading branch information
dankelleher committed Sep 3, 2024
1 parent c2cbc88 commit b4c5f54
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/actions/cache-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ description: install and Cache Node Modules
runs:
using: composite
steps:
- name: Timestamp 1
run: echo "Before installing Node" $(date "+%F %T.%3N")

- name: Set up Node
uses: actions/setup-node@v4
with:
Expand All @@ -12,20 +15,42 @@ runs:
yarn.lock
ui/yarn.lock
- name: Timestamp 2
run: echo "Before restoring top-level node modules" $(date "+%F %T.%3N")

- name: Cache top-level node modules
id: top-node-modules
uses: actions/cache@v4
with:
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
path: node_modules

- name: Timestamp 3
run: echo "Before restoring ui node modules" $(date "+%F %T.%3N")

- name: Cache ui node modules
id: ui-node-modules
uses: actions/cache@v4
with:
key: node_modules-${{ runner.os }}-${{ hashFiles('ui/yarn.lock') }}
path: ui/node_modules

- name: Timestamp 4
run: echo "Before restoring next build cache" $(date "+%F %T.%3N")

- name: Cache nextjs build cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Timestamp 5
run: echo "Before running yarn install" $(date "+%F %T.%3N")

- name: Install dependencies
shell: bash
run: |
Expand Down

0 comments on commit b4c5f54

Please sign in to comment.