-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (128 loc) · 4.2 KB
/
test.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Tests
on:
# Triggers the workflow manually from the GitHub Actions tab
workflow_dispatch:
inputs:
sorry_cypress:
description: 'Choose whether to send results to Sorry-Cypress'
required: true
default: 'false'
# Runs the workflow on every push to the repository
push:
env:
NODE_VERSION: 20.10.0
SORRY_CYPRESS_DIRECTOR_URL: ${{ secrets.SORRY_CYPRESS_DIRECTOR_URL}}
sorry_cypress: false
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
cy-test:
runs-on: ubuntu-20.04
name: Run Cypress Tests
strategy:
# don't fail the entire matrix on failure
fail-fast: false
matrix:
# Run the job in parallel on different browser
browser:
- chrome
- electron
- edge
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION}}
- name: Install dependencies
run: |
npm ci
- name: Unblock Cypress
run: |
echo ### Download Free Cypress ###
CYPRESS_DOWNLOAD_MIRROR=https://cy-cdn.currents.dev npx cypress install --force
echo ### Verify Cypress ###
npx cypress verify
echo ### Cypress Cache ###
npx cypress cache list
npx cypress cache path
- name: Run Cypress Tests
uses: cypress-io/github-action@v6
continue-on-error: true
if: env.sorry_cypress == 'true'
with:
install: false
build: npm run cy:info
wait-on-timeout: 180
browser: ${{ matrix.browser }}
config-file: cypress.config.js
command: |
npx cypress-cloud run --browser ${{ matrix.browser }} --key ${{ secrets.SORRY_CYPRESS_RECORD_KEY }} --ci-build-id Run#${{ github.run_id }}-${{ matrix.browser }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEBUG: 'cypress:server:args'
- name: Run Cypress Tests And send Data to Sorry-Cypress
uses: cypress-io/github-action@v6
continue-on-error: true
if: env.sorry_cypress != 'true'
with:
install: false
build: npm run cy:info
wait-on-timeout: 180
browser: ${{ matrix.browser }}
config-file: cypress.config.js
command: |
npm run cy:run:sorry-cypress:${{ matrix.browser }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEBUG: 'cypress:server:args'
- name: Upload Cypress HTML Reports
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.browser }}-report
path: 'cypress/reports'
retention-days: 3
cy-reports:
runs-on: ubuntu-20.04
needs: cy-test
steps:
- uses: actions/checkout@v4
name: Checkout Repository
- name: Download Chrome Report
uses: actions/download-artifact@v4
with:
name: chrome-report
path: chrome-report
- name: Download Electron Report
uses: actions/download-artifact@v4
with:
name: electron-report
path: electron-report
- name: Download Edge Report
uses: actions/download-artifact@v4
with:
name: edge-report
path: edge-report
- name: Copy Reports to Specific Directories
run: |
mkdir -p gh-pages/chrome
mkdir -p gh-pages/electron
mkdir -p gh-pages/edge
cp report/index.html gh-pages
cp -r chrome-report gh-pages/chrome/
cp -r electron-report gh-pages/electron/
cp -r edge-report gh-pages/edge/
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages
publish_branch: gh-pages