-
Notifications
You must be signed in to change notification settings - Fork 22
137 lines (131 loc) · 4.08 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
# create-gui-pr.yaml is dependant on this name being "Tests"
name: 'Tests'
#
on:
push:
branches: [master, 'release-[0-9]+.[0-9]+']
pull_request:
types: [opened, reopened, synchronize]
jobs:
install-dependencies:
runs-on: ubuntu-latest
outputs:
spec_groups: ${{ steps.set-groups.outputs.groups }}
spec_group_ids: ${{ steps.set-group-ids.outputs.group_ids }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- uses: actions/cache@v3
id: node-modules-cache
with:
path: |
**/node_modules
/home/runner/.cache
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: |
yarn install --frozen-lockfile
yarn run lint:lockfile
yarn deps
- id: set-groups
env:
THREAD_COUNT: 5
run: echo "groups=$(find features -type f -name '*.feature' | xargs -n $(($(find features -type f -name '*.feature' | wc -l) / $THREAD_COUNT + 1)) | tr ' ' ',' | jq -R . | jq -s -cM .)" >> $GITHUB_OUTPUT
- id: set-group-ids
env:
SPEC_GROUPS: ${{ steps.set-groups.outputs.groups }}
run: echo "group_ids=$(echo $SPEC_GROUPS | jq -cM 'to_entries | map(.key)')" >> $GITHUB_OUTPUT
lint-tests:
needs: [install-dependencies]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- uses: actions/cache/restore@v3
id: node-modules-cache
with:
path: |
**/node_modules
/home/runner/.cache
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- env:
LINTER_MODE: strict
run: |
yarn run lint
yarn run lint:ts
yarn run lint:styles
cli-tests:
needs: [install-dependencies]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- uses: actions/cache/restore@v3
id: node-modules-cache
with:
path: |
**/node_modules
/home/runner/.cache
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- run: |
yarn run test
browser-tests:
needs: [install-dependencies]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
container: ${{ fromJSON(needs.install-dependencies.outputs.spec_group_ids) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- uses: actions/cache/restore@v3
id: node-modules-cache
with:
path: |
**/node_modules
/home/runner/.cache
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- run: |
yarn build:staging
- env:
SPEC_GROUPS: ${{ needs.install-dependencies.outputs.spec_groups }}
run: |
yarn preview:built &
CYPRESS_video=true yarn run test:browser --spec $(echo $SPEC_GROUPS | jq -cMr '.[${{ matrix.container }}]')
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-artifacts
retention-days: ${{ github.event_name == 'pull_request' && 3 || 30 }}
path: |
cypress/screenshots
cypress/videos
post-checks:
# There is a branch protection rule on the repo that requires "branch-protection" to
# be successful
name: branch-protection
#
needs:
- lint-tests
- cli-tests
- browser-tests
runs-on: ubuntu-latest
if: |
always()
steps:
- name: Check for failures
if: |
contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'cancelled')
run: echo '${{toJSON(needs)}}' && exit 1
- run: echo "Successful"