mysterious-belgium-25713
10/18/2022, 11:30 AMgreen-queen-82383
10/18/2022, 11:30 AMgreen-queen-82383
10/18/2022, 11:33 AMinstall: false
out and have the cypress package do the installs, it bugs out because it expects lock files in each project in the monorepo, which pnpm workspaces do not add (there is only 1 lock file in the root). So the instructions that I've found prompt us to skip the install phase (because it happened in a previous step, but it requires caching).mysterious-belgium-25713
10/18/2022, 11:34 AMgreen-queen-82383
10/18/2022, 11:35 AMgreen-queen-82383
10/18/2022, 11:36 AMpnpm i
. It just doesn't know where to get the file from, because caching the binary folder isn't working.mysterious-belgium-25713
10/18/2022, 11:38 AMgreen-queen-82383
10/18/2022, 11:40 AMgreen-queen-82383
10/18/2022, 11:42 AMyaml
env:
CYPRESS_CACHE_FOLDER: cypress/cache
# jobs and other steps...
- name: Cache Cypress Binary
id: cache-cypress-binary
uses: actions/cache@v3
with:
path: cypress/cache
key: ${{ runner.os }}-cypress-binary-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-cypress-binary-
- run: pnpm i
- name: Cypress run
uses: cypress-io/github-action@v4
env:
# Have tried with and without the ../..
CYPRESS_CACHE_FOLDER: ../../cypress/cache
with:
install: false
working-directory: apps/myapp
command: pnpm cypress:ci
start: pnpm dev
wait-on: 'http://localhost:3000'
green-queen-82383
10/18/2022, 11:42 AMgreen-queen-82383
10/18/2022, 11:45 AMcypress run
command is run inside the step, because at that point it fails to find the binary.mysterious-belgium-25713
10/18/2022, 12:00 PMmysterious-belgium-25713
10/18/2022, 12:01 PMmysterious-belgium-25713
10/18/2022, 12:05 PMyaml
name: pnpm Cypress Example Workflow
env:
CYPRESS_CACHE_FOLDER: '$GITHUB_WORKSPACE/mycache'
on:
push:
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.2
with:
version: 7
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'
- name: Cache folder
uses: actions/cache@v3
with:
path: '$GITHUB_WORKSPACE/mycache'
key: ${{ runner.os}}-cypress
- name: Install dependencies
run: pnpm install
- name: Install cypress
run: pnpm dlx cypress install
- name: Run Cypress
uses: cypress-io/github-action@v4
with:
browser: chrome
install: false
green-queen-82383
10/18/2022, 12:06 PMmysterious-belgium-25713
10/18/2022, 12:08 PMgreen-queen-82383
10/18/2022, 12:09 PMmysterious-belgium-25713
10/18/2022, 12:11 PMmysterious-belgium-25713
10/18/2022, 12:11 PMmysterious-belgium-25713
10/18/2022, 12:11 PMgreen-queen-82383
10/18/2022, 12:15 PMpnpm dlx cypress install
command actually does reinstall cypress, doesn't skip the step.
2. It now looks in the wrong place for the binary:
We expected the binary to be installed here: /home/runner/work/project/project/apps/myapp/$GITHUB_WORKSPACE/mycache/10.10.0/Cypress/Cypress
This is likely due to the working directory being set (for the monorepo app).green-queen-82383
10/18/2022, 12:29 PMCannot find module 'cypress'
mysterious-belgium-25713
10/18/2022, 12:32 PMgreen-queen-82383
10/18/2022, 12:35 PMyaml
name: CI Push
on:
push:
branches:
- main
jobs:
build:
name: Nx Build - Main Job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- uses: nrwl/nx-set-shas@v3
- uses: pnpm/action-setup@v2.2.2
with:
version: 7
- name: Use Node.js 16.17
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'
- run: pnpm i
- run: pnpm nx workspace-lint
- run: pnpm nx run-many --target=lint
- run: pnpm nx run-many --target=test
- name: Cypress run
uses: cypress-io/github-action@v4
with:
install: false
browser: chrome
working-directory: apps/myapp
command: pnpm cypress:ci
start: pnpm dev
wait-on: 'http://localhost:3000'
- run: pnpm nx run-many --target=build
- name: Upload built artifact
uses: actions/upload-artifact@v3
with:
name: build-artifact
path: apps/myapp/dist
retention-days: 1
green-queen-82383
10/18/2022, 12:37 PMBrowser: Electron 106 (headless)
2. The test runs (there's only 1 atm), but it fails.
CypressError: Timed out retrying after 5000ms: cy.wait() timed out waiting 5000ms for the 1st request to the route: getAttempt. No request ever occurred.
The test runs perfectly fine locally...mysterious-belgium-25713
10/18/2022, 12:38 PMgreen-queen-82383
10/18/2022, 2:01 PMsalmon-computer-88142
10/18/2022, 2:30 PMfew-night-45066
10/18/2022, 2:33 PMfew-night-45066
10/18/2022, 2:37 PM