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

Provide pnpm workflow caching without action enhancement #1227

Closed
MikeMcC399 opened this issue Jul 29, 2024 · 4 comments
Closed

Provide pnpm workflow caching without action enhancement #1227

MikeMcC399 opened this issue Jul 29, 2024 · 4 comments
Assignees
Labels
type: enhancement New feature or request

Comments

@MikeMcC399
Copy link
Collaborator

What would you like

Provide tested recommendations and examples for pnpm workflow caching in the absence of built-in pnpm workflow caching in cypress-io/github-action.

This should be implemented in the workflows:

and documented in the README > pnpm section.

Why is this needed

@MikeMcC399
Copy link
Collaborator Author

MikeMcC399 commented Jul 29, 2024

The pnpm documentation recommends the following:

GitHub Actions

On GitHub Actions, you can use pnpm for installing and caching your dependencies
like so (belongs in .github/workflows/NAME.yml):

name: pnpm Example Workflow
on:
  push:

jobs:
  build:
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        node-version: [20]
    steps:
    - uses: actions/checkout@v4
    - name: Install pnpm
      uses: pnpm/action-setup@v4
      with:
        version: 9
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'pnpm'
    - name: Install dependencies
      run: pnpm install

It remains open how applicable the above recommendations are for use together with cypress-io/github-action.

@MikeMcC399
Copy link
Collaborator Author

  • The previous recommendation for pnpm caching came from an earlier recommendation of the pnpm documentation.

  • Testing again with the relevant commit 8c3db3a before caching was removed through PR test: remove pnpm store caching #1188 shows that it sometimes works and sometimes does not work. When the example-basic-pnpm fails, the Linux workflows are affected, and there are 3 of them running in parallel. The failure mechanism is however not clear. Before the test all GitHub Action caches were cleared.

https://github.com/cypress-io/github-action/blob/8c3db3a4795a005ea7de1f04087c97a3b9ddda84/README.md#pnpm

name: example-basic-pnpm
on: push
jobs:
  basic-pnpm:
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        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:
          working-directory: examples/basic-pnpm

@MikeMcC399
Copy link
Collaborator Author

@MikeMcC399
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant