-
Notifications
You must be signed in to change notification settings - Fork 22
136 lines (127 loc) · 4.58 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
# create-gui-pr.yaml is dependant on this name being "Tests"
name: 'Tests'
# Ensures that only one workflow is run per branch at a time.
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
on:
push:
branches: [master, 'release-[0-9]+.[0-9]+']
pull_request:
types: [opened, reopened, synchronize]
permissions:
contents: read # for checking out the repository (e.g. actions/checkout)
jobs:
install-dependencies:
runs-on: ubuntu-latest
outputs:
spec_groups: ${{ steps.set-groups.outputs.result }}
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version-file: '.nvmrc'
- uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
id: node-modules-cache
with:
path: |
**/node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: |
make install
- id: set-groups
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
env:
THREAD_COUNT: 4
with:
script: |
const getPartitionedTestFiles = require('./scripts/getPartitionedTestFiles.cjs')
return {
'kuma-gui': getPartitionedTestFiles(process.env.THREAD_COUNT),
}
lint-tests:
needs: [install-dependencies]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version-file: '.nvmrc'
- uses: actions/cache/restore@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: |
**/node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- run: |
make lint
cli-tests:
needs: [install-dependencies]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version-file: '.nvmrc'
- uses: actions/cache/restore@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: |
**/node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- run: |
make test/unit
browser-tests:
needs: [install-dependencies]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
package: ['kuma-gui']
container: [0, 1, 2, 3]
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version-file: '.nvmrc'
- uses: actions/cache/restore@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: |
**/node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- env:
SPEC_GROUPS: ${{ needs.install-dependencies.outputs.spec_groups }}
run: |
make run/e2e &
make CYPRESS_SPEC="$(echo $SPEC_GROUPS | jq -cMr '.["${{ matrix.package }}"]' | jq -cMr '.[${{ matrix.container }}]')" test/e2e
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: failure()
with:
name: cypress-artifacts-${{ matrix.package }}-${{ matrix.container }}
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"