forked from metabase/metabase
-
Notifications
You must be signed in to change notification settings - Fork 2
265 lines (246 loc) · 9.03 KB
/
backend.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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
name: Backend
on:
push:
branches:
- "master"
- "release-**"
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
timeout-minutes: 5
outputs:
backend_all: ${{ steps.changes.outputs.backend_all }}
frontend_sources: ${{ steps.changes.outputs.frontend_sources }}
steps:
- uses: actions/checkout@v4
- name: Test which files changed
uses: dorny/paths-filter@v3.0.0
id: changes
with:
token: ${{ github.token }}
filters: .github/file-paths.yaml
static-viz-files-changed:
needs: files-changed
if: needs.files-changed.outputs.backend_all != 'true' && needs.files-changed.outputs.frontend_sources == 'true'
name: Check whether static-viz files changed
runs-on: ubuntu-22.04
timeout-minutes: 10
outputs:
static_viz: ${{ steps.static_viz.outputs.static_viz }}
steps:
- uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "files-changed"
- name: Build static-viz frontend
run: yarn build-static-viz
- name: Upload Static Viz Bundle Artifact
uses: actions/upload-artifact@v4
with:
name: static-viz-bundle-${{ github.sha }}
path: resources/frontend_client/app/dist
- name: Check for static viz changes
uses: dorny/paths-filter@v3.0.0
id: static_viz
with:
token: ${{ github.token }}
filters: .github/static-viz-sources.yaml
be-linter-clj-kondo:
needs: [files-changed, static-viz-files-changed]
if: |
!cancelled() &&
(needs.files-changed.outputs.backend_all == 'true' || needs.static-viz-files-changed.outputs.static_viz == 'true')
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'kondo'
- name: Run clj-kondo
run: ./bin/kondo.sh
be-linter-eastwood:
needs: [files-changed, static-viz-files-changed]
if: |
!cancelled() &&
github.event.pull_request.draft == false &&
(needs.files-changed.outputs.backend_all == 'true' || needs.static-viz-files-changed.outputs.static_viz == 'true')
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "eastwood"
- run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:eastwood
name: Run Eastwood linter
# Because it's not possible to conditionally run only `java-11-ee` test in the draft mode,
# we have to extract that job manually here. Backend developers have requested that this
# test runs at all times to give them an early warning sign is something is broken.
be-tests-java-11-ee-pre-check:
needs: [files-changed, static-viz-files-changed]
if: |
!cancelled() &&
github.event.pull_request.draft == true &&
(needs.files-changed.outputs.backend_all == 'true' || needs.static-viz-files-changed.outputs.static_viz == 'true')
runs-on: ubuntu-22.04
name: be-tests-java-11-ee-pre-check
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: java-11-ee-pre-check
- run: yarn install --frozen-lockfile --prefer-offline
- name: Build static viz frontend
run: yarn build-static-viz
- name: Run tests
run: clojure -X:dev:ci:test:ee:ee-dev
- name: Publish Test Report (JUnit)
uses: dorny/test-reporter@v1
if: failure()
with:
path: "target/junit/**/*_test.xml"
name: JUnit Test Report be-tests-java-11-ee-pre-check
reporter: java-junit
list-suites: failed
list-tests: failed
fail-on-error: false
be-tests:
needs: [files-changed, static-viz-files-changed]
if: |
!cancelled() &&
github.event.pull_request.draft == false &&
(needs.files-changed.outputs.backend_all == 'true' || needs.static-viz-files-changed.outputs.static_viz == 'true')
runs-on: ubuntu-22.04
name: be-tests-java-${{ matrix.java-version }}-${{ matrix.edition }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
edition: [oss, ee]
java-version: [11, 17, 21]
steps:
- uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: be-tests
# Depending on which files changed, we might either have to build static-viz
# from scratch or download the previously built artifact
- name: Build static-viz frontend
if: needs.files-changed.outputs.backend_all == 'true'
run: yarn build-static-viz
- name: Download Static Viz Bundle Artifact
if: needs.static-viz-files-changed.outputs.static_viz == 'true'
uses: actions/download-artifact@v4
with:
name: static-viz-bundle-${{ github.sha }}
path: resources/frontend_client/app/dist
- name: Run tests
id: run-java-tests
run: clojure -X:dev:ci:test:${{ matrix.edition }}:${{ matrix.edition }}-dev
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always() && (steps.run-java-tests.conclusion != 'skipped' || steps.run-java-tests-21.conclusion != 'skipped')
with:
input-path: ./target/junit/
output-name: be-tests-java-${{ matrix.java-version }}-${{ matrix.edition }}
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
- name: Publish Test Report (JUnit)
uses: dorny/test-reporter@v1
if: failure()
with:
path: "target/junit/**/*_test.xml"
name: JUnit Test Report be-tests-java-${{ matrix.java-version }}-${{ matrix.edition }}
reporter: java-junit
list-suites: failed
list-tests: failed
fail-on-error: false
be-tests-stub:
needs: [be-tests]
if: |
!cancelled() &&
github.event.pull_request.draft == false && needs.be-tests.result == 'skipped'
runs-on: ubuntu-22.04
name: be-tests-java-${{ matrix.java-version }}-${{ matrix.edition }}
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
edition: [oss, ee]
java-version: [11, 17, 21]
steps:
- run: |
echo "Didn't run due to conditional filtering"
# checks that all the namespaces we actually ship can be compiled, without any dependencies that we don't ship (such
# as `:dev` dependencies). See #27009 for more context.
be-check:
needs: [files-changed, static-viz-files-changed]
if: |
!cancelled() &&
github.event.pull_request.draft == false &&
(needs.files-changed.outputs.backend_all == 'true' || needs.static-viz-files-changed.outputs.static_viz == 'true')
runs-on: ubuntu-22.04
name: be-check-java-${{ matrix.java-version }}
timeout-minutes: 10
strategy:
matrix:
java-version: [11, 17, 21]
steps:
- uses: actions/checkout@v4
- name: Prepare backend
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: be-check
- name: Check namespaces
run: clojure -M:ee:drivers:check
be-check-stub:
needs: [files-changed, static-viz-files-changed, be-check]
if: |
always() &&
github.event.pull_request.draft == false &&
needs.be-check.result == 'skipped'
runs-on: ubuntu-22.04
name: be-check-java-${{ matrix.java-version }}
timeout-minutes: 10
strategy:
matrix:
java-version: [11, 17, 21]
steps:
- run: |
echo "Didn't run due to conditional filtering"
be-cljfmt:
needs: [files-changed]
if: |
!cancelled() && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'cljfmt'
- name: Run cljfmt
run: clojure -T:cljfmt check