Skip to content

Commit

Permalink
Merge pull request #5185 from MikeMcC399/gha/docker
Browse files Browse the repository at this point in the history
fix GHA docker example
  • Loading branch information
jaffrepaul authored Apr 14, 2023
2 parents 6c95189 + 326aad3 commit 3aaeed0
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions docs/guides/continuous-integration/github-actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,18 @@ the above example to select Chrome instead of the default browser Electron, add
For more examples, see the action's
[Browser](https://github.com/cypress-io/github-action#browser) section.

## Testing in Chrome and Firefox with Cypress Docker Images
## Testing with Cypress Docker Images

GitHub Actions provides the option to specify a container image for the job.
Cypress offers various
[Docker Images](https://github.com/cypress-io/cypress-docker-images) for running
Cypress locally and in CI.

Below we add the `container` attribute using a
Below we extend the previous example by adding the `container` attribute using a
[Cypress Docker Image](https://github.com/cypress-io/cypress-docker-images)
built with Google Chrome and Firefox. For example, this allows us to run the
tests in Firefox by passing the `browser: firefox` attribute to the
[Cypress GitHub Action](https://github.com/marketplace/actions/cypress-io).
built with Google Chrome `107`. This allows us to fix our test to a specific
browser version without any influence due to browser version changes in the
GitHub runner image.

```yaml
name: Cypress Tests using Cypress Docker Image
Expand All @@ -175,18 +175,16 @@ on: push
jobs:
cypress-run:
runs-on: ubuntu-22.04
container: cypress/browsers:node12.18.3-chrome87-ff82
container: cypress/browsers:node18.12.0-chrome107
steps:
- name: Checkout
uses: actions/checkout@v3
# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
uses: cypress-io/github-action@v5
with:
# Specify Browser since container image is compiled with Firefox
browser: firefox
build: npm run build
start: npm start
browser: chrome
```

## Caching Dependencies and Build Artifacts
Expand Down

0 comments on commit 3aaeed0

Please sign in to comment.