From d1971e91b3a4b685eaa6fc1a9fb50049b262dfa9 Mon Sep 17 00:00:00 2001 From: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> Date: Mon, 27 May 2024 13:47:46 +0200 Subject: [PATCH] test: remove pnpm store caching (#1188) --- .github/workflows/example-basic-pnpm.yml | 55 ------------------- .../example-start-and-pnpm-workspaces.yml | 27 --------- README.md | 11 +--- 3 files changed, 1 insertion(+), 92 deletions(-) diff --git a/.github/workflows/example-basic-pnpm.yml b/.github/workflows/example-basic-pnpm.yml index 3600ea5ea..2d43dec58 100644 --- a/.github/workflows/example-basic-pnpm.yml +++ b/.github/workflows/example-basic-pnpm.yml @@ -17,17 +17,6 @@ jobs: - name: Install pnpm run: npm install -g pnpm@9 - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/basic-pnpm/pnpm-lock.yaml') }} - - name: Cypress tests # normally you would write # uses: cypress-io/github-action@v6 @@ -50,17 +39,6 @@ jobs: - name: Install pnpm run: npm install -g pnpm@9 - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/basic-pnpm/pnpm-lock.yaml') }} - - name: Cypress tests uses: ./ with: @@ -76,17 +54,6 @@ jobs: - name: Install pnpm run: npm install -g pnpm@9 - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/basic-pnpm/pnpm-lock.yaml') }} - - name: Cypress tests uses: ./ with: @@ -102,17 +69,6 @@ jobs: - name: Install pnpm run: npm install -g pnpm@9 - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/basic-pnpm/pnpm-lock.yaml') }} - - name: Cypress tests uses: ./ with: @@ -131,17 +87,6 @@ jobs: - name: Install pnpm run: npm install -g pnpm@9 - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/basic-pnpm/pnpm-lock.yaml') }} - - name: Cypress tests uses: ./ with: diff --git a/.github/workflows/example-start-and-pnpm-workspaces.yml b/.github/workflows/example-start-and-pnpm-workspaces.yml index 6c11cbc41..a8e49beab 100644 --- a/.github/workflows/example-start-and-pnpm-workspaces.yml +++ b/.github/workflows/example-start-and-pnpm-workspaces.yml @@ -13,7 +13,6 @@ jobs: single-ws: # This job installs pnpm, # installs all dependencies, - # caches the pnpm store, # caches the Cypress binary cache, # then runs Cypress tests in the single workspace # of the subfolder "packages/workspace-1". @@ -27,20 +26,6 @@ jobs: - name: Install pnpm run: npm install -g pnpm@9 - # locate the pnpm store directory where pnpm dependencies are installed - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - # Cypress github-action does not cache pnpm dependencies by default. - # Cache the dependencies. - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/start-and-pnpm-workspaces/pnpm-lock.yaml') }} - - name: Install dependencies # with Cypress GitHub Action. # Calling the Cypress GitHub Action causes all dependencies from @@ -75,7 +60,6 @@ jobs: multiple-ws: # This job installs pnpm, # installs all dependencies, - # caches the pnpm store, # caches the Cypress binary cache, # then runs Cypress tests in each of the workspaces. runs-on: ubuntu-22.04 @@ -93,17 +77,6 @@ jobs: - name: Install pnpm run: npm install -g pnpm@9 - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/start-and-pnpm-workspaces/pnpm-lock.yaml') }} - - name: Install dependencies uses: ./ # approximately equivalent to using cypress-io/github-action@v6 with: diff --git a/README.md b/README.md index 201338143..81d6bbf27 100644 --- a/README.md +++ b/README.md @@ -1105,7 +1105,7 @@ jobs: ### pnpm The package manager `pnpm` is not pre-installed in [GitHub Actions runner images](https://github.com/actions/runner-images) (unlike `npm` and `yarn`) and so it must be installed in a separate workflow step (see below). If the action finds a `pnpm-lock.yaml` file, it uses the [pnpm](https://pnpm.io/cli/install) command `pnpm install --frozen-lockfile` by default to install dependencies. -At this time the action does not automatically cache dependencies installed by pnpm. The example below includes steps to locate the pnpm store directory and to cache its contents for later use. +At this time, the action does not automatically cache dependencies installed by pnpm. We advise against attempting to work around this restriction, by caching the pnpm store directory through additional workflow steps, as this can lead to the action skipping installation of the Cypress binary, causing workflow failure. ```yaml name: example-basic-pnpm @@ -1118,15 +1118,6 @@ jobs: uses: actions/checkout@v4 - name: Install pnpm run: npm install -g pnpm@9 - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/basic-pnpm/pnpm-lock.yaml') }} - name: Cypress run uses: cypress-io/github-action@v6 with: