github-action icon indicating copy to clipboard operation
github-action copied to clipboard

Videos don't seem to work on GitHub Action default runners

Open webbertakken opened this issue 3 years ago • 12 comments

Context

Bug report regarding videos on GitHub Actions default runners.

Steps

I have just set up cypress for my repository.

Everything seems to be set up correctly, and yarn cypress run yields a video that works.

Now I'd like to reproduce this in CI, and created a workflow with the same settings apart from the URL:

Relevant part of the workflow

      - name: Run Cypress 🌲
        uses: cypress-io/github-action@v2
        env:
          CYPRESS_BASE_URL: ${{ github.event.deployment_status.target_url }}
      - name: Upload video 📼
        uses: actions/upload-artifact@v2
        if: always()
        with:
          name: Test videos
          path: cypress/videos
          retention-days: 14

I'm using default ubuntu-latest runner with default settings.

** Results**

The tests run fine (all 91 succeed as expected) and the video uploads. However the video cuts out after a few seconds. Only the last frame is updated to show the tests. Presumably because the machine runs out of resources while loading the page.

Video artifact

Test videos.zip

Video file

https://user-images.githubusercontent.com/20756439/150003505-a2fcf6b4-08da-4596-925b-9e9cb2dd473b.mp4

Screenshot of last frame

image

Related

I believe that most reports here are also related to this issue.

webbertakken avatar Jan 18 '22 19:01 webbertakken

I'm experiencing the same thing.

henrikq avatar Jan 20 '22 10:01 henrikq

FWIW the GitHub runners' CPUs are terribly slow, and disabling videos entirely was a big performance gain for me (about 50%). While videos are very valuable, the massive run time reduction was worth it for me. It also made my tests less flaky, as there are fewer timeouts.

This CPU bottleneck might also be why Cypress has a hard time recording and encoding the videos.

https://github.com/github/roadmap/issues/161 is scheduled for Q1 of this year, hopefully this will make Cypress videos viable.

MartijnHols avatar Jan 29 '22 10:01 MartijnHols

@MartijnHols How did you disable video?

henrikq avatar Feb 01 '22 12:02 henrikq

For me it doesn't matter too much if it goes slower, as long as it works. Is there no way to throttle the tests more in order to get the video to work somehow?

Personally I don't feel disabling video entirely is a good solution to this issue.

webbertakken avatar Feb 01 '22 13:02 webbertakken

@MartijnHols How did you disable video?

https://docs.cypress.io/guides/guides/screenshots-and-videos#Videos

MartijnHols avatar Feb 01 '22 18:02 MartijnHols

FWIW the GitHub runners' CPUs are terribly slow, and disabling videos entirely was a big performance gain for me (about 50%). While videos are very valuable, the massive run time reduction was worth it for me. It also made my tests less flaky, as there are fewer timeouts.

This CPU bottleneck might also be why Cypress has a hard time recording and encoding the videos.

github/roadmap#161 is scheduled for Q1 of this year, hopefully this will make Cypress videos viable.

Are you running the tests in parallel? I tried disabling videos but I am getting this issue #507

alessioerosferri avatar Feb 18 '22 11:02 alessioerosferri

This is a CPU issue. There is not enough CPU to run Cypress, record video and whatever else is running in the GHA. Default CPU for GHA: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources

CPU Recommendations:

  • 2 CPUs minimum, for Cypress (Node + Browser)
  • 1 additional CPU if video recording is enabled
  • 1 additional CPU per process you run outside of Cypress, such as:
    • App server (frontend)
    • App server (backend)
    • App database
    • Infra component (redis, etc..)

jennifer-shehane avatar Mar 07 '22 17:03 jennifer-shehane

Wonder if switching to the macOS runners would help (eg. macos-latest or macos-12):

Hardware specification for macOS virtual machines:

  • 3-core CPU
  • 14 GB of RAM
  • 14 GB of SSD space

karlhorky avatar Jul 17 '22 13:07 karlhorky

Looks like GitHub has a beta of larger GitHub Actions runners 🙌 : https://github.blog/changelog/2022-09-01-github-actions-larger-runners-are-now-in-public-beta/

187657585-86ebd0ca-4bb2-4bf7-9b7b-add7feba2761 copy

karlhorky avatar Sep 05 '22 07:09 karlhorky

@jennifer-shehane I guess you would recommend at least the 4-cores option here? Or would the minimum be 8-cores instead?

karlhorky avatar Sep 05 '22 07:09 karlhorky

@karlhorky based on our hardware recommendations 4-cores should be fine.

admah avatar Sep 06 '22 19:09 admah

Great, I have requested access to the new larger GitHub Actions runners for installation to our organization and will try the videos on a 4-core runner. I'll report back here with what I find.

karlhorky avatar Sep 06 '22 21:09 karlhorky

Ok, finally got a chance to try GitHub Actions larger runners out and it seems that it still freezes / stutters multiple times on a 4-core runner with 16GB RAM (Ubuntu). This is with [email protected].

The 8-core / 32GB RAM runner produced almost smooth videos (stuttered a bit at the beginning).

Wonder if anything else can be done on Cypress' side to make it more efficient.

cc @admah @jennifer-shehane

karlhorky avatar Nov 10 '22 15:11 karlhorky

@webbertakken

This issue has been discussed and the opinion was that the problem with video capture was due to hardware capacity.

In the meantime, as of Cypress 13.0.0, video capture in Cypress is disabled by default and at the same time Test Replay on Cypress Cloud has been introduced.

github-action cannot correct the hardware issue of video capture, so I would suggest to close this issue now.

MikeMcC399 avatar Nov 06 '23 15:11 MikeMcC399

For anyone seeing this issue at some future point in time, just switch to Playwright - videos work out of the box on default GitHub Actions runners with no problems with hardware capacity or anything (and Playwright also solves many other Cypress-specific problems)

karlhorky avatar Nov 06 '23 15:11 karlhorky

@karlhorky

  • That's interesting. Does Playwright also capture videos for Firefox - something that Cypress can no longer do (https://github.com/cypress-io/cypress/issues/18415)

MikeMcC399 avatar Nov 06 '23 16:11 MikeMcC399

  • Does Playwright also capture videos for Firefox

haven't tried yet, but Playwright supports Firefox, so I would guess so

karlhorky avatar Nov 06 '23 17:11 karlhorky

Closing, since this is not an issue which can be resolved by github-action.

MikeMcC399 avatar Nov 07 '23 07:11 MikeMcC399