Skip to content

Commit

Permalink
upgrade to Cypress v6 and fix GitHub actions (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov authored Dec 2, 2020
1 parent 9689cbb commit b72e66f
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 73 deletions.
10 changes: 7 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,17 @@ workflows:
- run: npx cypress version --component electron
- run: npx cypress version --component node

- cypress/install:
- cypress/run:
name: 'Linux lint'
requires:
- Linux install
# run all lint checks
build: 'npm run build'
# the previous job has already installed every dependency
# and saved the workspace. "cypress/run" automatically restores the workspace
install-command: echo 'Already installed'
# run all lint checks
command: 'npm run build'
# this job does not need to save its files
no-workspace: true

# runs on 3 machines, load balances tests
# and records on Cypress Dashboard
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Code analysis

jobs:
test:
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04
name: check tests
steps:
- uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
name: Chrome 80
name: Chrome Docker

on: push

jobs:
# run Chrome inside a Docker container
chrome:
runs-on: ubuntu-latest
# https://github.com/cypress-io/cypress-docker-images
container: cypress/browsers:node13.6.0-chrome80-ff72
container: cypress/browsers:node12.18.3-chrome87-ff82
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Chrome
uses: cypress-io/github-action@v1
uses: cypress-io/github-action@v2
timeout-minutes: 10
with:
build: npm run build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/chrome-headless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on: push

jobs:
chrome-headless:
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Headless Chrome
uses: cypress-io/github-action@v1
uses: cypress-io/github-action@v2
timeout-minutes: 10
with:
build: npm run build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/chrome.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on: push

jobs:
chrome:
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Chrome
uses: cypress-io/github-action@v1
uses: cypress-io/github-action@v2
timeout-minutes: 10
with:
build: npm run build
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/parallel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on: push
jobs:
install:
name: Install NPM and Cypress
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master

Expand All @@ -29,6 +29,8 @@ jobs:
# Any updated archives will be saved automatically after the entire
# workflow successfully finishes.
# See https://github.com/actions/cache
# we use exact restore key to avoid NPM module snowballing
# https://glebbahmutov.com/blog/do-not-let-npm-cache-snowball/
- name: Cache central NPM modules
uses: actions/cache@v1
with:
Expand All @@ -37,6 +39,8 @@ jobs:
restore-keys: |
${{ runner.os }}-node-${{ github.ref }}-${{ hashFiles('**/package-lock.json') }}
# we use the exact restore key to avoid Cypress binary snowballing
# https://glebbahmutov.com/blog/do-not-let-cypress-cache-snowball/
- name: Cache Cypress binary
uses: actions/cache@v1
with:
Expand Down Expand Up @@ -69,7 +73,7 @@ jobs:
# anchor definitions yet, thus we cannot put same steps into a template object yet
test1:
name: Cypress test 1
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04
needs: install
steps:
- uses: actions/checkout@master
Expand Down Expand Up @@ -133,7 +137,7 @@ jobs:

test2:
name: Cypress test 2
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04
needs: install
steps:
- uses: actions/checkout@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/single.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on: push
jobs:
test1:
name: Cypress test
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/using-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ on: push

jobs:
single-run:
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Cypress run
uses: cypress-io/github-action@v1
uses: cypress-io/github-action@v2
timeout-minutes: 10
with:
build: npm run build
start: npm start

parallel-runs:
name: Parallel 4x
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
Expand All @@ -38,7 +38,7 @@ jobs:
# because of "record" and "parallel" parameters
# these containers will load balance all found tests among themselves
- name: run tests
uses: cypress-io/github-action@v1
uses: cypress-io/github-action@v2
timeout-minutes: 5
with:
record: true
Expand All @@ -60,7 +60,7 @@ jobs:
matrix:
# run 2 copies of the current job in parallel
# and they will load balance all specs
os: ['ubuntu-16.04', 'windows-latest', 'macos-latest']
os: ['ubuntu-18.04', 'windows-latest', 'macos-latest']
machines: [1, 2]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -70,7 +70,7 @@ jobs:
# because of "record" and "parallel" parameters
# these containers will load balance all found tests among themselves
- name: run tests
uses: cypress-io/github-action@v1
uses: cypress-io/github-action@v2
timeout-minutes: 10
with:
record: true
Expand Down
Loading

0 comments on commit b72e66f

Please sign in to comment.