From 0a0ab484b0a634d484d8a002b38019c3f6746e75 Mon Sep 17 00:00:00 2001 From: Ghislain B Date: Fri, 10 Nov 2023 11:51:04 -0500 Subject: [PATCH] chore: refactor CI workflow pnpm cache & test against Node 20 (#1186) * chore: refactor CI workflow pnpm cache & test against Node 20 --- .github/workflows/cypress.yml | 47 ++++++++++++++++++++++++----------- .github/workflows/main.yml | 22 ++++++++-------- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 08f0867b5..b8eb93185 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5e8a0fa32..ad1922181 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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:') }} @@ -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-