Rayrun
← Back to Discord Forum

Github actions sharding problem with pnpm

fellogen_77366posted in #help-playwright
Open in Discord
fellogen_77366

name: Playwright e2e tests

on: workflow_dispatch: pull_request: branches: - master - playwright-poc

jobs: run-e2es: runs-on: ubuntu-latest strategy: fail-fast: false matrix: shard: [1/2, 2/2] env: NODE_OPTIONS: "--max-old-space-size=6144" TZ: 'Europe/Warsaw'

steps:
  - name: Checkout code
    uses: actions/checkout@v4

  - name: Setup Node.js
    uses: actions/setup-node@v4
    with:
      node-version: '18'
      cache: 'pnpm'

  - uses: pnpm/action-setup@v2
    with:
      version: 8
      run_install: true

  - name: Set Time Zone
    run: |
      sudo timedatectl set-timezone ${{ env.TZ }}
      echo "Time zone set to $(date)"

  - name: Install Chromium for Playwright
    run: pnpm exec playwright install chromium

  - name: Run Playwright Tests with sharding
    run: pnpm run test:ci -- --shard ${{ matrix.shard }}

  - name: Upload blob report to GitHub Actions Artifacts
    if: always()
    uses: actions/upload-artifact@v2
    with:
      name: blob-report-${{ matrix.shard }}
      path: blob-report

merge-reports: needs: run-e2es runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4

- name: Setup Node.js
    uses: actions/setup-node@v4
    with:
      node-version: '18'

  - uses: pnpm/action-setup@v2
    with:
      version: 8
      run_install: true

  - name: Download blob reports from GitHub Actions Artifacts
    uses: actions/download-artifact@v2
    with:
      path: all-blob-reports

  - name: Merge Blob Reports
    run: pnpm exec playwright merge-reports --reporter html ./all-blob-reports --output ./playwright-report

  - name: Upload merged HTML report to S3
     ...rest is realted to AWS serving the report - that is not relevant for now

This thread is trying to answer question "How to fix the issue where GitHub Actions fails to locate the executable file for 'pnpm' when using sharding in a workflow?"

1 reply
fellogen_77366

so for above I laways crash at start with below info

Run actions/setup-node@v4 with: node-version: 18 cache: pnpm always-auth: false check-latest: false token: *** env: NODE_OPTIONS: --max-old-space-size=6144 TZ: Europe/Warsaw Found in cache @ /opt/hostedtoolcache/node/18.18.2/x64 Environment details node: v18.18.2 npm: 9.8.1 yarn: 1.22.21 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.

how to fix this issue?

working part without sharding was

name: Playwright e2e tests

on: workflow_dispatch: pull_request: branches: - master - playwright-poc

jobs: run-e2es: runs-on: ubuntu-latest env: NODE_OPTIONS: "--max-old-space-size=6144" TZ: 'Europe/Warsaw'

steps:
  - name: Checkout code
    uses: actions/checkout@v2

  # Node Setup
  - name: Setup Node
    uses: actions/setup-node@v3
    with:
      node-version: 18

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

  # Install Dependencies
  - name: Install dependencies
    run: pnpm install

  # Set Time Zone
  - name: Set Time Zone
    run: |
      sudo timedatectl set-timezone ${{ env.TZ }}
      echo "Time zone set to $(date)"

  # Install Chromium for Playwright
  - run: pnpm playwright install chromium

  # Run Playwright Tests
  - name: Run tests and capture exit code
    id: test_step
    run: |
      set +e
      pnpm run test:ci
      echo "::set-output name=exit_code::$?"

....rest of the code

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].