-
Notifications
You must be signed in to change notification settings - Fork 1
178 lines (147 loc) Β· 6.27 KB
/
CI.yaml
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
name: CI (on PRs and master branch)
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
IS_PR_WITH_PERCY: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.title, 'SKIP_PERCY') && !contains(github.event.pull_request.body, 'SKIP_PERCY') }}
IS_PR_JUST_MERGED: ${{ github.ref_name == 'master' && contains(github.event.head_commit.message, 'Merge pull request') && !contains(github.event.head_commit.message, 'SKIP_PERCY') }}
jobs:
install_and_cache_dependencies:
if: "!contains(github.event.head_commit.message, 'SKIP_CI')"
runs-on: ubuntu-latest
steps:
- name: Checkout ποΈ
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.16.0
cache: yarn
- name: Install Dependencies π§
run: yarn install --immutable
build_and_test:
runs-on: ubuntu-latest
needs: install_and_cache_dependencies
steps:
- name: Log Interesting Info βΉοΈ
run: |
echo "The job is triggered by a ${{ github.event_name }} event."
echo "This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- name: Checkout ποΈ
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.16.0
cache: yarn
- name: Install Dependencies π§
run: yarn install --immutable
- name: Type Check Κ¦
run: yarn run typecheck
- name: Linting π΅
run: yarn run lint
- name: Formatting π
run: yarn run format:check
- name: Build π¨
run: yarn run build:public
- name: Run Tests (Cypress excluded) β
run: yarn run test
- name: "Cancel build on failure"
if: failure()
uses: andymckay/[email protected]
cypress_tests:
needs: install_and_cache_dependencies
strategy:
fail-fast: true
matrix:
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
runs-on: ubuntu-latest # note: macos doesn't have docker installed!
container: cypress/browsers:node16.16.0-chrome107-ff107-edge
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_parallel: true
steps:
- name: Log Interesting Info βΉοΈ
run: |
echo "The job is triggered by a ${{ github.event_name }} event."
echo "This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- name: Checkout ποΈ
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.16.0
cache: yarn
- name: Install Dependencies π§
run: yarn install --immutable
- name: Run Cypress Tests β
if: ${{ env.IS_PR_JUST_MERGED == 'true' || env.IS_PR_WITH_PERCY == 'true' }}
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
# Without this, we would need to "finalize" percy build explicitly. More info: https://docs.percy.io/docs/parallel-test-suites
PERCY_PARALLEL_TOTAL: 15 # 10 for component tests, 5 for e2e
# Percy's nonce is supposed to be set to run id by default, but it's not. Plus, appending run_number makes it more reliable in case of rerunning
PERCY_PARALLEL_NONCE: ${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
run: yarn run cypress:component --record --parallel --group component
- name: Run Cypress Tests (without percy) β
if: ${{ !(env.IS_PR_JUST_MERGED == 'true' || env.IS_PR_WITH_PERCY == 'true') }}
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
run: yarn run cypress:component --record --parallel --group component
cypress_tests_e2e:
needs: install_and_cache_dependencies
strategy:
fail-fast: true
matrix:
group: [1, 2, 3, 4, 5]
runs-on: ubuntu-latest # note: macos doesn't have docker installed!
container: cypress/browsers:node16.16.0-chrome107-ff107-edge
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_parallel: true
steps:
- name: Checkout ποΈ
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.16.0
cache: yarn
- name: Install Dependencies π§
run: yarn install --immutable
- name: Build example-app π¨
run: yarn workspace jui-example-app run build
- name: Run Cypress Tests β
if: ${{ env.IS_PR_JUST_MERGED == 'true' || env.IS_PR_WITH_PERCY == 'true' }}
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
# Without this, we would need to "finalize" percy build explicitly. More info: https://docs.percy.io/docs/parallel-test-suites
PERCY_PARALLEL_TOTAL: 15 # 10 for component tests, 5 for e2e
# Percy's nonce is supposed to be set to run id by default, but it's not. Plus, appending run_number makes it more reliable in case of rerunning
PERCY_PARALLEL_NONCE: ${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
run: |
yarn workspace jui-example-app run serve &
yarn run cypress:e2e --record --parallel --group e2e
- name: Run Cypress Tests (without percy) β
if: ${{ !(env.IS_PR_JUST_MERGED == 'true' || env.IS_PR_WITH_PERCY == 'true') }}
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
run: |
yarn workspace jui-example-app run serve &
yarn run cypress:e2e --record --parallel --group e2e
# just because there is no way to add a required status check based on a matrix job. In order to avoid adding
# individual status check for each parallel job. Based on this suggestion:
# https://github.com/orgs/community/discussions/26822#discussioncomment-5122101
succeeded:
name: Succeeded
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [build_and_test, cypress_tests, cypress_tests_e2e]
steps:
- run: exit 1
# see https://stackoverflow.com/a/67532120/4907315
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
}}