forked from fleetdm/fleet
-
Notifications
You must be signed in to change notification settings - Fork 0
182 lines (156 loc) · 4.54 KB
/
test.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
on:
push:
branches:
- main
- patch-*
pull_request:
paths:
- assets/**
- cypress/**
- ee/**
- frontend/**
- pkg/**
- server/**
- tools/**
- go.mod
- go.sum
- package.json
- yarn.lock
- docker-compose.yml
- webpack.config.js
- tsconfig.json
name: Run Tests
permissions:
contents: read
jobs:
test-e2e:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
go-version: ['^1.17.8']
fleet-tier: [free, premium]
runs-on: ${{ matrix.os }}
steps:
- name: Install Node
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # v2
with:
node-version: '14'
- name: Install Go
uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923 # v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout Code
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2
# Pre-starting dependencies here means they are ready to go when we need them.
- name: Start Infra Dependencies
# Use & to background this
run: docker-compose up -d mysql_test redis mailhog saml_idp &
- name: JS Dependency Cache
id: js-cache
uses: actions/cache@661fd3eb7f2f20d8c7c84bc2b0509efd7a826628 # v2
with:
path: |
**/node_modules
~/.cache/Cypress
# Use a separate cache for this from other JS jobs since we run the
# webpack steps and will have more to cache.
key: ${{ runner.os }}-e2e-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-e2e-modules-
- name: Go Cache
id: go-cache
uses: actions/cache@661fd3eb7f2f20d8c7c84bc2b0509efd7a826628 # v2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install JS Dependencies
if: steps.js-cache.outputs.cache-hit != 'true'
run: make deps-js
- name: Install Go Dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make deps-go
- name: Build Fleet
run: |
export PATH=$PATH:~/go/bin
make generate-ci
make
- name: Run E2E Tests
id: e2e
run: |
.github/scripts/check-infra-dependencies.sh all
make e2e-reset-db
make e2e-serve-${{ matrix.fleet-tier }} &
sleep 3
make e2e-setup
yarn cypress run --config-file cypress/cypress-${{ matrix.fleet-tier }}.json
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v2
with:
name: cypress
path: |
cypress/screenshots/
cypress/videos/
test-js:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Code
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2
- name: JS Dependency Cache
id: js-cache
uses: actions/cache@661fd3eb7f2f20d8c7c84bc2b0509efd7a826628 # v2
with:
path: |
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-
- name: Install JS Dependencies
if: steps.js-cache.outputs.cache-hit != 'true'
run: make deps-js
- name: Run JS Tests
run: |
make test-js
lint-js:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Code
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2
- name: JS Dependency Cache
id: js-cache
uses: actions/cache@661fd3eb7f2f20d8c7c84bc2b0509efd7a826628 # v2
with:
path: |
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-
- name: Install JS Dependencies
if: steps.js-cache.outputs.cache-hit != 'true'
run: make deps-js
- name: Run JS Linting
run: |
make lint-js
- name: Run prettier formatting check
run: |
yarn prettier:check