-
Notifications
You must be signed in to change notification settings - Fork 1
140 lines (115 loc) Β· 4.56 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
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 type-check
- 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: 10
# 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 }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
run: yarn run test:cypress --parallel
- 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 test:cypress --parallel
- uses: actions/upload-artifact@v2
name: Upload Cypress screenshots if tests failed π€
if: failure()
with:
name: cypress-screenshots
path: |
packages/jui/**/__image_snapshots__
packages/jui/cypress/videos
packages/jui/cypress/screenshots
# 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]
steps:
- run: exit 1
# see https://stackoverflow.com/a/67532120/4907315
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
}}