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

pnpm executable not there with github-action@v5 + the docker cypress/browsers image #947

Closed
gkatsanos opened this issue Jun 20, 2023 · 4 comments

Comments

@gkatsanos
Copy link

gkatsanos commented Jun 20, 2023

github workflow:

jobs:
  cypress:
    runs-on: default-visable
    container:
      image: cypress/browsers:node16.17.0-chrome106
    env:
      GITHUB_TOKEN: ${{ secrets.PACKAGES_READ_ONLY_TOKEN_GITHUB }}
    steps:
      - name: Define proper Checkout REF
        shell: bash
        run: echo "ref=$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF}})" >> $GITHUB_OUTPUT
        id: extract_ref
      - uses: actions/checkout@v3
        with:
          ref: "${{ steps.extract_ref.outputs.ref }}"
      - name: setup github packages authentication
        run: 'echo "//npm.pkg.github.com/:_authToken=${{ secrets.PACKAGES_READ_ONLY_TOKEN_GITHUB }}" > ~/.npmrc'
      - uses: cypress-io/github-action@v5
        id: cypress
        with:
          install-command: pnpm install --frozen-lockfile
          build: pnpm build
          start: pnpm start
          browser: chrome
          wait-on: 'http://localhost:3000'
      - name: cleanup repo files
        if: always()
        run: find . -mindepth 1 -delete
Run cypress-io/github-action@v5
  with:
    install-command: pnpm install --frozen-lockfile
    build: pnpm build
    start: pnpm start
    browser: chrome
    wait-on: http://localhost:3000
    record: false
    publish-summary: true
    component: false
  env:
    GITHUB_TOKEN: ***
/bin/docker exec  db[2](https://github.com/visable-dev/requests-frontend/actions/runs/5325024291/jobs/9645162231#step:6:2)cd8fa41abf165a55298e54cd4ab5d[3](https://github.com/visable-dev/requests-frontend/actions/runs/5325024291/jobs/9645162231#step:6:3)dec9e9e96fc5f87a[4](https://github.com/visable-dev/requests-frontend/actions/runs/5325024291/jobs/9645162231#step:6:4)9da[6](https://github.com/visable-dev/requests-frontend/actions/runs/5325024291/jobs/9645162231#step:6:6)0a[8](https://github.com/visable-dev/requests-frontend/actions/runs/5325024291/jobs/9645162231#step:6:8)ed36d21 sh -c "cat /etc/*release | grep ^ID"
install command command "pnpm install --frozen-lockfile"
current working directory "/__w/requests-frontend/requests-frontend"
Error: Unable to locate executable file: pnpm. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
@MikeMcC399
Copy link
Collaborator

@gkatsanos

Please refer to the documentation
https://github.com/cypress-io/github-action#pnpm
for using pnpm.

You will need to add

      - name: Install pnpm
        uses: pnpm/action-setup@v2
        with:
          version: xx

where xx is your preferred version of pnpm.

You should not need
install-command: pnpm install --frozen-lockfile
as github-action will automatically execute this command if it finds pnpm-lock.yaml

See https://github.com/cypress-io/github-action/blob/master/.github/workflows/example-basic-pnpm.yml for a working example (although this is not with a Docker container).

Are you using Docker to have the explicit Node.js 16.17.0 chrome106 environment or are you flexible about which version of Node.js / Chrome you are using? If you only need to tie down the version of Node.js you can use actions/setup-node@v3 instead of using a Docker image.

@MikeMcC399
Copy link
Collaborator

I confirmed that the following workflow executes successfully as expected on a GitHub-hosted runner runs-on: ubuntu-22.04:

  basic-pnpm-ubuntu-22-docker:
    runs-on: ubuntu-22.04
    container: cypress/browsers:node16.17.0-chrome106
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Install pnpm
        uses: pnpm/action-setup@v2
        with:
          version: 8

      - name: Cypress tests
        uses: ./
        with:
          working-directory: examples/basic-pnpm
          build: npx cypress info

@gkatsanos
Copy link
Author

@MikeMcC399 thank you - indeed, the pnpm/action-setup worked fine.
With regards to the other issue, I think it's something on the docker images, as this issue disappears when using :latest : cypress-io/cypress-docker-images#903 (comment) I hope we can get a more specific Docker image (without FF/EDGE for example) after which this was handled

@MikeMcC399
Copy link
Collaborator

It is not clear if the issue is coming from the Docker image since cypress/browsers:node16.17.0-chrome106 worked on a GitHub-hosted runner and not on your self-hosted runner. That would need further investigation, however it does not seem to be caused by github-action, so this issue should stay closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants