-
Notifications
You must be signed in to change notification settings - Fork 0
229 lines (197 loc) · 7.49 KB
/
ci.yml
File metadata and controls
229 lines (197 loc) · 7.49 KB
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
name: CI
on:
pull_request:
merge_group:
push:
branches:
- main # For generating code coverage on main branch
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
lint-backend:
name: Lint Backend
runs-on: ubuntu-24.04
container: quay.io/geoengine/devcontainer:latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- name: Init rustup toolchain
run: rustup show
- name: setup rust build cache
uses: Swatinem/rust-cache@v2
with:
# An explicit cache key that is used instead of the automatic `job`-based
# cache key and is thus stable across jobs.
# Default: empty
shared-key: ""
# An additional cache key that is added alongside the automatic `job`-based
# cache key and can be used to further differentiate jobs.
# Default: empty
key: ci_test_
- name: Rustfmt
run: just lint-backend-rustfmt
- name: Clippy
run: just lint-backend-clippy
- name: SQLFluff
run: just lint-backend-sqlfluff
- name: Start PostgreSQL
run: |
service postgresql start
psql postgres://geoengine:geoengine@localhost -c "CREATE DATABASE biois;"
- name: Diesel Check
run: |
just install-diesel-cli
just lint-backend-diesel-cli
env:
DATABASE_URL: postgres://geoengine:geoengine@localhost/biois
lint-api-client:
name: Lint API Client
runs-on: ubuntu-24.04
container: quay.io/geoengine/devcontainer:latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- name: Start PostgreSQL
run: |
service postgresql start
psql postgres://geoengine:geoengine@localhost -c "CREATE DATABASE biois;"
- name: Install Java (OpenAPI Generator requires Java to run)
run: |
# deleted in devcontainer image, but required by java installer
mkdir -p /usr/share/man/man1
apt-get update
apt-get install -y openjdk-21-jre-headless
- name: Lint OpenAPI specification
run: |
just lint-openapi-spec
- name: Idempotency of OpenAPI doc generation
run: |
just generate-openapi-spec
just check-no-changes-in-git-repo
- name: Idempotency of API client code generation
run: |
just build-api-client
just check-no-changes-in-git-repo
- name: Check API client for build errors
run: just lint-api-client
lint-frontend:
name: Lint Frontend
runs-on: ubuntu-24.04
container: quay.io/geoengine/devcontainer:latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- name: Install dependencies
run: |
just install-api-client-deps
just install-frontend-deps
- name: Code Format
run: just lint-frontend-fmt
- name: Lints
run: just lint-frontend-code
test-backend:
name: Test Backend
runs-on: ubuntu-24.04
container: quay.io/geoengine/devcontainer:latest
permissions:
contents: read
outputs:
coverage-artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- name: Init rustup toolchain
run: rustup show
- name: Start PostgreSQL
run: |
service postgresql start
psql postgres://geoengine:geoengine@localhost -c "CREATE DATABASE biois;"
- name: setup rust build cache
uses: Swatinem/rust-cache@v2
with:
# An explicit cache key that is used instead of the automatic `job`-based
# cache key and is thus stable across jobs.
# Default: empty
shared-key: ""
# An additional cache key that is added alongside the automatic `job`-based
# cache key and can be used to further differentiate jobs.
# Default: empty
key: ci_test_
- name: Test
run: |
just install-llvm-cov
just test-backend-with-coverage "/lcov.info"
- id: upload-artifact
uses: actions/upload-artifact@v6
with:
name: lcov-report-backend-${{ github.run_id }}-${{ github.run_attempt }}
path: /lcov.info
compression-level: 9
retention-days: 1
if-no-files-found: error
test-frontend:
name: Test Frontend
runs-on: ubuntu-24.04
container: quay.io/geoengine/devcontainer:latest
permissions:
contents: read
outputs:
coverage-artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- name: Install dependencies
run: |
just install-api-client-deps
just install-frontend-deps
- name: Build
run: just build-frontend
- name: Test
run: just test-frontend
- id: upload-artifact
uses: actions/upload-artifact@v6
with:
name: lcov-report-frontend-${{ github.run_id }}-${{ github.run_attempt }}
path: frontend/coverage/BioIS/lcov.info
compression-level: 9
retention-days: 1
if-no-files-found: error
upload-coverage:
name: Upload Coverage Report
runs-on: ubuntu-24.04
permissions:
contents: read
needs:
- test-backend
- test-frontend
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Download Backend Coverage Report
uses: actions/download-artifact@v7
with:
artifact-ids: ${{ needs.test-backend.outputs.coverage-artifact-id }}
path: backend/
- name: Modify lcov paths
run: |
sed -i 's|SF:/__w/BioIS/BioIS/|SF:|' backend/lcov.info
- name: Download Frontend Coverage Report
uses: actions/download-artifact@v7
with:
artifact-ids: ${{ needs.test-frontend.outputs.coverage-artifact-id }}
path: frontend/
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}