-
-
Notifications
You must be signed in to change notification settings - Fork 16
182 lines (158 loc) · 5.13 KB
/
main.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: Main CI workflow
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * MON,THU" # every MON,THU at midnight run E2E tests
push:
branches:
- main
- "*"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CYPRESS_CACHE_FOLDER: ${{ github.workspace }}/.cache/Cypress
CYPRESS_EMAIL_POST: ${{ secrets.CYPRESS_EMAIL_POST }}
CYPRESS_EMAIL_PRE: ${{ secrets.CYPRESS_EMAIL_PRE }}
CYPRESS_MAILOSAUR_API_KEY: ${{ secrets.CYPRESS_MAILOSAUR_API_KEY }}
CYPRESS_MAILSLURP_API_KEY: ${{ secrets.CYPRESS_MAILSLURP_API_KEY }}
STATIC_IP_HTTP_PROXY: ${{ secrets.STATIC_IP_HTTP_PROXY }}
CACHE_VER: v01
PNPM_VER: 6.32.6
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
build:
name: Install ⚙️ & Examples Matrix 🔧
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Install pnpm 🔧
uses: pnpm/[email protected]
with:
version: ${{env.PNPM_VER}}
## from https://github.com/vercel/next.js/blob/canary/.github/workflows/build_test_deploy.yml#L28
- name: Cache all Repo for next jobs 💾
uses: actions/cache@v3
id: cache-build
with:
path: ./*
key: ${{ github.sha }}
- name: Cache .pnpm-store 💾
if: steps.cache-build.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{env.CACHE_VER}}-${{ hashFiles('**/pnpm-lock.yaml')}}
restore-keys: |
${{ runner.os }}-pnpm-${{env.CACHE_VER}}-
- name: Cache Cypress 💾
if: steps.cache-build.outputs.cache-hit != 'true'
id: cypress-cache
uses: actions/cache@v3
with:
path: ${{env.CYPRESS_CACHE_FOLDER}}
key: ${{ runner.os }}-cypress-${{ github.ref }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-cypress-${{ github.ref }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Install dependencies 🔧
if: steps.cache-build.outputs.cache-hit != 'true'
run: |
pnpm install
- name: Check Cypress Cache list
run: cd examples/sitemap && pnpm cypress cache list
- name: Create Matrix Examples ⚡
id: matrix
run: pnpm ts-node ./scripts/listExamples.ts
examplesTest:
name: Test Example
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [build]
strategy:
fail-fast: false
matrix:
example: ${{fromJson(needs.build.outputs.matrix)}}
steps:
- name: Install pnpm 🔧
uses: pnpm/[email protected]
with:
version: ${{env.PNPM_VER}}
- name: Restore Cache 💾
uses: actions/cache@v3
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
- name: Test 🏗️
id: cypress-test
run: |
cd examples/${{ matrix.example }}
pnpm postsetup || echo "no postsetup"
pnpm test
- name: Upload Video 📹
uses: actions/upload-artifact@v3
if: failure()
with:
name: video from example ${{ matrix.example }}
path: ${{ github.workspace }}/examples/${{ matrix.example }}/cypress/videos
retention-days: 10
- name: Store Report XML Results
uses: actions/upload-artifact@v3
if: success()
with:
name: report-xml-${{ matrix.example }}
path: report/*.xml
retention-days: 1
examplesResults:
name: Result Examples 📊
runs-on: ubuntu-latest
timeout-minutes: 2
if: always()
needs: [build, examplesTest]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Install pnpm 🔧
uses: pnpm/[email protected]
with:
version: ${{env.PNPM_VER}}
- name: Install only packages needed for core
run: pnpm add -W ts-node
- name: Downlod report Artifacts
uses: actions/download-artifact@v3
with:
path: report
- name: Move all reports to root report folder
run: |
mv ./report/*/*.xml ./report/ # dont use '-force' to check for errors
- name: Merge all Reports
run: |
pnpm merge
- name: Publish Cypress E2E Report 📖
uses: dorny/test-reporter@v1
with:
name: Cypress Tests Results 📖
path: report.xml
reporter: java-junit
fail-on-error: "false"
examplesClean:
name: Clean Example
runs-on: ubuntu-latest
timeout-minutes: 1
needs: [build, examplesResults]
if: always()
strategy:
matrix:
example: ${{fromJson(needs.build.outputs.matrix)}}
steps:
- name: Delete Report XML Artifact
uses: geekyeggo/delete-artifact@v2
id: restore-build
with:
name: report-xml-${{ matrix.example }}
failOnError: false