-
Notifications
You must be signed in to change notification settings - Fork 348
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
Cypress binary randomly missing with pnpm #1138
Comments
|
Disabled the cypress workflow in that branch and enabled it here in a new one instead: tidal-music/tidal-sdk-web#82 Run: https://github.com/tidal-music/tidal-sdk-web/actions/runs/8157333147/job/22296765645 |
The branch https://github.com/tidal-music/tidal-sdk-web/tree/player-release/0.1.3 which I was going to look at has been deleted, so it's difficult for me to investigate your latest attempt. (OK - I saw you just moved it.)
jobs:
run-test:
runs-on: ubuntu-22.04
name: Run test
timeout-minutes: 60
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Setup Node 18
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Set up Cypress binary cache
uses: actions/cache@v3
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-cypress-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install dependencies
run: |
pnpm i --frozen-lockfile
- name: Test
uses: cypress-io/github-action@v6
with:
install: false
working-directory: ./packages/test/
browser: chrome That would probably work in principle for you too, updating the versions of the actions used and changing the directory from |
You can let me know if you want to try that out for yourself, or if you want me to work on your branch https://github.com/tidal-music/tidal-sdk-web/tree/re-enable-cypress. |
I tried that in this commit: https://github.com/tidal-music/tidal-sdk-web/blob/2f296807920c63dfffe5108b3c03112977065310/.github/workflows/cypress.yml Output for that run was the same: https://github.com/tidal-music/tidal-sdk-web/actions/runs/8153523957/job/22285090231 |
I ran the following successfully in a fork of your repo. I suspect this failed for you previously due to the pnpm cache preventing the Cypress binary installing. If you cache the pnpm store and then you add caching for Cypress without allowing for Cypress to install and run the postinstallation script (again) to install the Cypress binary, then the Cypress binary will never be installed and can't be cached. If you delete the relevant cache from https://github.com/tidal-music/tidal-sdk-web/actions/caches after you have added Cypress binary caching then pnpm will reinstall everything and Cypress will get its binary installed and cached. jobs:
cypress-run:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/setup
- uses: ./.github/actions/build-projects
- name: Prepare test user for player tests
id: json
run: |
echo ${{ env.TEST_USER }} | base64 -d > test-user.json
json=$(cat test-user.json)
replacement=${{ secrets.PLAYER_REFRESH_TOKEN }}
fixed_json="$(echo ${json/\[TOKEN\]/$replacement})"
encoded_json=$(echo "$fixed_json" | base64 | tr -d '\n')
echo "encoded=\"$encoded_json\"" >> $GITHUB_OUTPUT
env:
TEST_USER: ${{ secrets.PLAYER_TEST_USER }}
- name: Set up Cypress binary cache
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: ${{ runner.os }}-cypress-${{ hashFiles('pnpm-lock.yaml') }}
- name: Cypress run
uses: cypress-io/github-action@v6
env:
CYPRESS_TEST_USER: ${{ steps.json.outputs.encoded }}
with:
install: false
browser: chrome
start: pnpm --dir packages/player/ dev
wait-on: 'http://localhost:5173/demo/test-case-1.html'
command: pnpm --dir packages/player/ internal:cypress:run
|
That worked! Now it runs again. Thank you very much Mike! Would the hash not changing be an issue for pnpm/action-setup or is the fact that Cypress store it outside the module folder the "issue" (outside their scope/concern), which needs this extra cache step? |
Hm, my second run failed on the binary missing again. I don't see a |
Found this, I guess this is what I'm seeing. I need to run on the main branch. https://github.com/orgs/community/discussions/27059 |
GitHub caches are linked to the branch of the workflow which addresses the cache. To test workflows using caches you always need to run a workflow twice. Once to populate the cache and then a second time to make sure that the cached contents is being picked up. It sounds like you have found your issue. Come back here again if you still can't get it to work and I will take another look.
The Cypress binary cache is outside of the scope of the pnpm cache store. |
We've added a new example .github/workflows/example-start-and-pnpm-workspaces.yml to show how the action can be used with pnpm workspaces and there is an explanation about the principle behind it on README > pnpm workspaces. The workflow itself is heavily commented. You don't need to use this to solve your issue, it just avoids having to handle the Cypress binary cache manually. Have you already got your workflow running? |
I suggest to close this issue now, as this is not a bug in the action.
|
It's running fine in our workflow now. Thanks. |
Branching out my case from #1054
I added the cypess GH action a few days ago in this repo and it has run fine, until I open a PR with a version bump to a package in the monorepo and it suddenly decided to fail on the cypress binary being missing.
I've tried the following solutions after looking through old issues here:
install: true
working-dir:
withpnpm command
instead ofpnpm --dir workdir command
Neither yield any different result. Still:
Mr PR with alot of different commits where I've tried different combos: tidal-music/tidal-sdk-web#80
I hope someone is able to help finding out the issue :)
The text was updated successfully, but these errors were encountered: