Skip to content

Commit

Permalink
test: remove pnpm store caching (#1188)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcC399 authored May 27, 2024
1 parent 8c3db3a commit d1971e9
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 92 deletions.
55 changes: 0 additions & 55 deletions .github/workflows/example-basic-pnpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/example-start-and-pnpm-workspaces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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".
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit d1971e9

Please sign in to comment.