Git Product home page Git Product logo

Comments (13)

enjikaka avatar enjikaka commented on September 7, 2024 1

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

from github-action.

MikeMcC399 avatar MikeMcC399 commented on September 7, 2024 1

@enjikaka

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?

from github-action.

enjikaka avatar enjikaka commented on September 7, 2024 1

It's running fine in our workflow now. Thanks.

from github-action.

MikeMcC399 avatar MikeMcC399 commented on September 7, 2024

@enjikaka

from github-action.

MikeMcC399 avatar MikeMcC399 commented on September 7, 2024

@enjikaka

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 test to player.

from github-action.

MikeMcC399 avatar MikeMcC399 commented on September 7, 2024

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.

from github-action.

enjikaka avatar enjikaka commented on September 7, 2024

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

from github-action.

MikeMcC399 avatar MikeMcC399 commented on September 7, 2024

@enjikaka

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

from github-action.

enjikaka avatar enjikaka commented on September 7, 2024

@enjikaka

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 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.

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?

from github-action.

enjikaka avatar enjikaka commented on September 7, 2024

Hm, my second run failed on the binary missing again. I don't see a ${{ runner.os }}-cypress-${{ hashFiles('pnpm-lock.yaml') }} entry in caches though... https://github.com/tidal-music/tidal-sdk-web/actions/runs/8170953305/job/22338441775?pr=82

from github-action.

enjikaka avatar enjikaka commented on September 7, 2024

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

from github-action.

MikeMcC399 avatar MikeMcC399 commented on September 7, 2024

@enjikaka

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.

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?

The Cypress binary cache is outside of the scope of the pnpm cache store.

from github-action.

MikeMcC399 avatar MikeMcC399 commented on September 7, 2024

@enjikaka

I suggest to close this issue now, as this is not a bug in the action.

  • I've added also an enhancement request #1144

from github-action.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.