-
Notifications
You must be signed in to change notification settings - Fork 2
180 lines (160 loc) · 5.61 KB
/
e2e-tests.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
name: E2E Tests
# (thuang): Chromatic recommends ONLY running on push instead of pull_request
# https://www.chromatic.com/docs/github-actions/#recommended-configuration-for-build-events
on: push
env:
JEST_ENV: prod
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
run-smoke-tests:
runs-on: ubuntu-22.04
# (thuang): We now run the smoke tests against 2 datasets sequentially, so need longer timeout
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4, 5]
shardTotal: [5]
steps:
- uses: actions/checkout@v4
with:
# Chromatic needs full Git history graph
fetch-depth: 0
- name: Set up Python 3.12
uses: actions/setup-python@v1
with:
python-version: 3.12
- name: Python cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-node@v4
with:
node-version-file: "client/.nvmrc"
cache: "npm"
cache-dependency-path: "client/package-lock.json"
- name: Install dependencies
run: |
make dev-env-server build-for-server-dev
cd client
npx playwright install
- name: Smoke tests (without annotations feature)
run: |
cd client && CURRENT_SHARD=${{ matrix.shardIndex }} TOTAL_SHARDS=${{ matrix.shardTotal }} make smoke-test
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/[email protected]
with:
root_dir: ../
flags: frontend,javascript,smokeTest
verbose: true
commit_parent: false
directory: client/
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload Chromatic artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: chromatic-report-${{ matrix.shardIndex }}
path: /home/runner/work/single-cell-explorer/single-cell-explorer/client/playwright-report/chromatic-archives
retention-days: 14
- name: Upload FE test results as an artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report-${{ matrix.shardIndex }}
path: /home/runner/work/single-cell-explorer/single-cell-explorer/client/playwright-report
retention-days: 14
- name: Upload blob report to GitHub Actions Artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: blob-report-${{ matrix.shardIndex }}
path: /home/runner/work/single-cell-explorer/single-cell-explorer/client/blob-report
retention-days: 1
merge-reports:
# Merge reports after playwright-tests, even if some shards have failed
if: always()
needs: [run-smoke-tests]
runs-on: ubuntu-latest
defaults:
run:
working-directory: client
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: "client/.nvmrc"
cache: "npm"
cache-dependency-path: "client/package-lock.json"
- name: Install dependencies
run: npm ci
- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
pattern: blob-report-*
merge-multiple: true
path: /home/runner/work/single-cell-explorer/single-cell-explorer/client/blob-report
- name: Merge into HTML Report
run: npx playwright merge-reports --reporter html ./blob-report
- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: html-report--attempt-${{ github.run_attempt }}
path: /home/runner/work/single-cell-explorer/single-cell-explorer/client/playwright-report
retention-days: 14
# https://github.com/myieye/web-languageforge/blob/develop/.github/workflows/e2e-tests.yml
smoke-tests:
if: always()
name: smoke-tests
runs-on: ubuntu-latest
needs:
- run-smoke-tests
steps:
- name: Check result
run: |
passed="${{ needs.run-smoke-tests.result }}"
if [[ $passed == "success" ]]; then
echo "Shards passed"
exit 0
else
echo "Shards failed"
exit 1
fi
merge-chromatic:
name: Run Chromatic
needs: [run-smoke-tests]
runs-on: ubuntu-latest
defaults:
run:
working-directory: client
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
with:
# (thuang): Matches the `name` and `path` specified in `Upload Chromatic artifacts` step
path: /home/runner/work/single-cell-explorer/single-cell-explorer/client/playwright-report/chromatic-archives
pattern: chromatic-report-*
merge-multiple: true
- name: Run Chromatic tests
uses: chromaui/action@latest
with:
workingDir: ./client
buildScriptName: "build-archive-storybook"
exitOnceUploaded: true
autoAcceptChanges: "main"
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
env:
# 👇 Sets environment variables
CHROMATIC_ARCHIVE_LOCATION: playwright-report/