-
Notifications
You must be signed in to change notification settings - Fork 17
229 lines (210 loc) · 8.52 KB
/
ci.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# SPDX-License-Identifier: Apache-2.0
# name of the action
name: ci
# trigger on pull_request or push events
on:
push:
pull_request:
env:
CI: 1
# pipeline to execute
jobs:
# ┌─┐┬ ┌┬┐ ┌─┐┌─┐┬─┐┌┬┐┌─┐┌┬┐
# ├┤ │ │││───├┤ │ │├┬┘│││├─┤ │
# └─┘┴─┘┴ ┴ └ └─┘┴└─┴ ┴┴ ┴ ┴
elm-format:
name: validate elm files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.npm
key: ${{ runner.os }}-npm-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-v2-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: node_modules
key: ${{ runner.os }}-modules-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-modules-v2-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-bin-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
cypress-${{ runner.os }}-bin-v2-
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'
- name: install dependencies
run: npm ci --prefer-offline --no-audit
- name: install elm-format
run: npm i [email protected]
- name: run elm-format
run: npm run lint:elm
# ┌─┐┬ ┌┬┐ ┌┬┐┌─┐┌─┐┌┬┐
# ├┤ │ │││───│ ├┤ └─┐ │
# └─┘┴─┘┴ ┴ ┴ └─┘└─┘ ┴
elm-test:
name: run elm tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.elm
key: ${{ runner.os }}-elm-v3-${{ hashFiles('**/elm.json') }}
restore-keys: |
${{ runner.os }}-elm-v3-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.npm
key: ${{ runner.os }}-npm-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-v2-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: node_modules
key: ${{ runner.os }}-modules-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-modules-v2-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-bin-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
cypress-${{ runner.os }}-bin-v2-
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'
- name: install dependencies
run: npm ci --prefer-offline --no-audit
- name: install elm-test
run: npm i [email protected]
- name: run elm-test
run: npm run test
# ┬ ┬┌┐┌┌┬┐
# │ ││││ │
# ┴─┘┴┘└┘ ┴
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.npm
key: ${{ runner.os }}-npm-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-v2-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: node_modules
key: ${{ runner.os }}-modules-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-modules-v2-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-bin-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
cypress-${{ runner.os }}-bin-v2-
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'
- name: install dependencies
run: npm ci --prefer-offline --no-audit
- name: run linter
run: npm run lint
# ┌─┐┬ ┬┌─┐┬─┐┌─┐┌─┐┌─┐
# │ └┬┘├─┘├┬┘├┤ └─┐└─┐
# └─┘ ┴ ┴ ┴└─└─┘└─┘└─┘
integration:
name: run cypress tests
runs-on: ubuntu-latest
env:
VELA_API: 'http://localhost:8080'
TERM: xterm
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.elm
key: ${{ runner.os }}-elm-v3-${{ hashFiles('**/elm.json') }}
restore-keys: |
${{ runner.os }}-elm-v3-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.npm
key: ${{ runner.os }}-npm-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-v2-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: node_modules
key: ${{ runner.os }}-modules-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-modules-v2-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-bin-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
cypress-${{ runner.os }}-bin-v2-
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'
- name: install dependencies
run: npm ci --prefer-offline --no-audit
- name: run cypress tests
run: npm run test:cy
# ┌─┐┬ ┬┌┐ ┬ ┬┌─┐┬ ┬
# ├─┘│ │├┴┐│ │└─┐├─┤
# ┴ └─┘└─┘┴─┘┴└─┘┴ ┴
publish:
name: build and push to docker
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'go-vela/ui'
needs: [lint, elm-format, elm-test, integration]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.elm
key: ${{ runner.os }}-elm-v3-${{ hashFiles('**/elm.json') }}
restore-keys: |
${{ runner.os }}-elm-v3-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.npm
key: ${{ runner.os }}-npm-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-v2-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: node_modules
key: ${{ runner.os }}-modules-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-modules-v2-
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'
# ┌┐ ┬ ┬┬┬ ┌┬┐
# ├┴┐│ │││ ││
# └─┘└─┘┴┴─┘─┴┘
- name: install dependencies
run: npm ci --prefer-offline --no-audit
- name: run development build
run: npm run build
# ┌┬┐┌─┐┌─┐┬┌─┌─┐┬─┐
# │││ ││ ├┴┐├┤ ├┬┘
# ─┴┘└─┘└─┘┴ ┴└─┘┴└─
- name: push to docker
uses: elgohr/Publish-Docker-Github-Action@eb53b3ec07136a6ebaed78d8135806da64f7c7e2 # v5
with:
name: target/vela-ui
cache: true
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}