Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove pnpm store caching #1188

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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