forked from cypress-io/cypress-example-kitchensink
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (76 loc) · 2.63 KB
/
single.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# GitHub Actions
# https://help.github.com/en/articles/configuring-a-workflow
name: Cypress tests
on: push
jobs:
test1:
name: Cypress test
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
# install a specific version of Node using
# https://github.com/actions/setup-node
- name: Use Node.js v12
uses: actions/setup-node@v1
with:
node-version: 12
# just so we learn about available environment variables GitHub provides
- name: Print env variables
run: |
npm i -g @bahmutov/print-env
print-env GITHUB
# Restore the previous NPM modules and Cypress binary archives.
# Any updated archives will be saved automatically after the entire
# workflow successfully finishes.
# See https://github.com/actions/cache
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache Cypress binary
uses: actions/cache@v1
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-cypress-${{ hashFiles('**/package.json') }}
restore-keys: |
cypress-${{ runner.os }}-cypress-
- name: install dependencies and verify Cypress
env:
# make sure every Cypress install prints minimal information
CI: 1
# print Cypress and OS info
run: |
npm ci
npx cypress verify
npx cypress info
npx cypress version
npx cypress version --component package
npx cypress version --component binary
npx cypress version --component electron
npx cypress version --component node
# Starts local server, then runs Cypress tests and records results on the dashboard
- name: Cypress tests
run: npm run test:ci:record
env:
# place your secret record key at
# https://github.com/cypress-io/cypress-example-kitchensink/settings/secrets
CYPRESS_RECORD_KEY: ${{ secrets.dashboardRecordKey }}
TERM: xterm
# Save videos and screenshots as test artifacts
# https://github.com/actions/upload-artifact
- uses: actions/upload-artifact@master
with:
name: screenshots
path: cypress/screenshots
# there might be no screenshots created when:
# - there are no test failures
# so only upload screenshots if previous step has failed
if: failure()
# video should always be generated
- uses: actions/upload-artifact@master
with:
name: videos
path: cypress/videos