Skip to content

Commit

Permalink
chore: refactor CI workflow pnpm cache & test against Node 20 (#1186)
Browse files Browse the repository at this point in the history
* chore: refactor CI workflow pnpm cache & test against Node 20
  • Loading branch information
ghiscoding authored Nov 10, 2023
1 parent 700f8d5 commit 0a0ab48
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 26 deletions.
47 changes: 32 additions & 15 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,52 @@ concurrency:
cancel-in-progress: true

jobs:
cypress:
name: 'E2E Tests / NodeJS ${{ matrix.node }}'
runs-on: ubuntu-latest
run:
strategy:
fail-fast: false
matrix:
node: [20]
platform:
- ubuntu-latest

name: '${{matrix.platform}} / Node ${{ matrix.node }}'
runs-on: ${{matrix.platform}}
if: ${{ !startsWith(github.event.head_commit.message, 'docs:') }}

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Use latest version of Node.js
- name: Set NodeJS
uses: actions/setup-node@v4
with:
node-version: "*"
node-version: ${{ matrix.node }}

- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: true
run_install: false

- run: node --version
- run: pnpm --version

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Run pnpm install dependencies
run: pnpm install

- name: TSC Build (esm)
run: pnpm build:esm:styles

Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18]
node: [20]
platform:
- ubuntu-latest

name: '${{matrix.platform}} / NodeJS ${{ matrix.node }}'
name: '${{matrix.platform}} / Node ${{ matrix.node }}'
runs-on: ${{matrix.platform}}
if: ${{ !startsWith(github.event.head_commit.message, 'docs:') }}

Expand All @@ -32,29 +32,29 @@ jobs:
with:
fetch-depth: 2 # codecov-bash seems to require this

- name: Install pnpm itself
uses: pnpm/action-setup@v2
with:
version: 8

- name: Set NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- run: node --version
- run: pnpm --version

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
Expand Down

0 comments on commit 0a0ab48

Please sign in to comment.