-
Notifications
You must be signed in to change notification settings - Fork 0
242 lines (241 loc) · 9.16 KB
/
ci.yaml
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
---
# SPDX-FileCopyrightText: © 2024 Sebastian Davids <[email protected]>
# SPDX-License-Identifier: Apache-2.0
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: ci
on: # yamllint disable-line rule:truthy
push:
branches:
- main
- next
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: 0
permissions: { }
jobs:
# unfortunately each job is billed for at least 1 minute in GH Actions
# so use one big one to save GH Action minutes
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions
lint-build-test:
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- name: Checkout
# https://github.com/actions/checkout/releases
uses: actions/[email protected]
- name: Classify changes
# https://github.com/dorny/paths-filter/releases
uses: dorny/[email protected]
id: changes
with:
filters: |
sh:
- '**.sh'
yaml:
- '**.yaml'
js-nodejs-Dockerfile:
- .hadolint.yaml
- js/nodejs/Dockerfile
js-nodejs:
- js/nodejs/.npmrc
- js/nodejs/.nvmrc
- js/nodejs/eslint.config.mjs
- js/nodejs/package.json
- js/nodejs/package-lock.json
- js/nodejs/prettier.config.mjs
- 'js/nodejs/src/**.mjs'
- 'js/nodejs/test/**.mjs'
go-http-Dockerfile:
- .hadolint.yaml
- go/http/Dockerfile
go-http:
- go/http/go.mod
- go/http/go.sum
- 'go/http/**.go'
go-https-Dockerfile:
- .hadolint.yaml
- go/https/Dockerfile
go-https:
- go/https/go.mod
- go/https/go.sum
- 'go/https/**.go'
rust-http-Dockerfile:
- .hadolint.yaml
- rust/http/Dockerfile
rust-http:
- 'rust/http/src/**'
- 'rust/http/tests/**'
- rust/http/Cargo.lock
- rust/http/Cargo.toml
- rust/http/rust-toolchain.toml
rust-https-Dockerfile:
- .hadolint.yaml
- rust/https/Dockerfile
rust-https:
- 'rust/https/src/**'
- 'rust/https/tests/**'
- rust/https/Cargo.lock
- rust/https/Cargo.toml
- rust/https/rust-toolchain.toml
- if: steps.changes.outputs.sh == 'true'
name: Lint shell scripts
run: scripts/shellscript_check.sh
- if: steps.changes.outputs.yaml == 'true'
name: Lint YAML files
run: yamllint --strict .
# --- js/nodejs ----------------------------------------------------------
- if: steps.changes.outputs.js-nodejs-Dockerfile == 'true'
name: Lint js/nodejs Dockerfile
# https://github.com/hadolint/hadolint-action/releases
uses: hadolint/[email protected]
with:
dockerfile: js/nodejs/Dockerfile
- if: steps.changes.outputs.js-nodejs == 'true'
name: Setup node and install dependencies for js/nodejs
uses: ./.github/actions/setup-node-and-install-dependencies
with:
working-directory: js/nodejs
node-version-file: js/nodejs/.nvmrc
dependencies-lock-file: js/nodejs/package-lock.json
- if: steps.changes.outputs.js == 'true'
name: Check js/nodejs formatting
working-directory: js/nodejs
run: scripts/format_check.sh
- if: steps.changes.outputs.js == 'true'
name: Lint js/nodejs files
working-directory: js/nodejs
run: scripts/lint.sh
- if: steps.changes.outputs.js == 'true'
name: Test js/nodejs
working-directory: js/nodejs
run: scripts/test.sh
# --- go/http ----------------------------------------------------------
- if: steps.changes.outputs.go-http-Dockerfile == 'true'
name: Lint go/http/Dockerfile
# https://github.com/hadolint/hadolint-action/releases
uses: hadolint/[email protected]
with:
dockerfile: go/http/Dockerfile
- if: steps.changes.outputs.go-http == 'true'
name: Install Go for go/http
# https://github.com/actions/setup-go/releases
uses: actions/[email protected]
with:
go-version-file: go/http/go.mod
- if: steps.changes.outputs.go-http == 'true'
name: Lint go/http files
# https://github.com/golangci/golangci-lint-action/releases
uses: golangci/[email protected]
with:
# https://github.com/golangci/golangci-lint/releases
version: v1.62.0
working-directory: go/http
- if: steps.changes.outputs.go-http == 'true'
name: Test go/http
working-directory: go/http
run: scripts/test.sh
- if: steps.changes.outputs.go-http == 'true'
name: Build go/http
working-directory: go/http
run: scripts/build_release.sh
# --- go/https ----------------------------------------------------------
- if: steps.changes.outputs.go-https-Dockerfile == 'true'
name: Lint go/https/Dockerfile
# https://github.com/hadolint/hadolint-action/releases
uses: hadolint/[email protected]
with:
dockerfile: go/https/Dockerfile
- if: steps.changes.outputs.go-https == 'true'
name: Install Go for go/https
# https://github.com/actions/setup-go/releases
uses: actions/[email protected]
with:
go-version-file: go/https/go.mod
- if: steps.changes.outputs.go-https == 'true'
name: Lint go/https files
# https://github.com/golangci/golangci-lint-action/releases
uses: golangci/[email protected]
with:
# https://github.com/golangci/golangci-lint/releases
version: v1.62.0
working-directory: go/https
- if: steps.changes.outputs.go-https == 'true'
name: Test go/https
working-directory: go/https
run: scripts/test.sh
- if: steps.changes.outputs.go-https == 'true'
name: Build go/https
working-directory: go/https
run: scripts/build_release.sh
# --- rust/http ------------------------------------------------------
- if: steps.changes.outputs.rust-http-Dockerfile == 'true'
name: Lint rust/http Dockerfile
# https://github.com/hadolint/hadolint-action/releases
uses: hadolint/[email protected]
with:
dockerfile: rust/http/Dockerfile
- if: steps.changes.outputs.rust-http == 'true'
name: Install rust/http Rust
working-directory: rust/http
run: rustup show
- if: steps.changes.outputs.rust-http == 'true'
name: Cache rust/http Rust files
# https://github.com/Swatinem/rust-cache/releases
uses: Swatinem/[email protected]
with:
shared-key: rust-http
workspaces: rust/http
- if: steps.changes.outputs.rust-http == 'true'
name: Check rust/http formatting
working-directory: rust/http
run: scripts/format_check.sh
- if: steps.changes.outputs.rust-http == 'true'
name: Lint rust/http files
working-directory: rust/http
run: scripts/lint.sh
- if: steps.changes.outputs.rust-http == 'true'
name: Test rust/http
working-directory: rust/http
run: cargo test --no-fail-fast
- if: steps.changes.outputs.rust-http == 'true'
name: Build rust/http
working-directory: rust/http
run: scripts/build_release.sh
# --- rust/https -----------------------------------------------------
- if: steps.changes.outputs.rust-https-Dockerfile == 'true'
name: Lint rust/https Dockerfile
# https://github.com/hadolint/hadolint-action/releases
uses: hadolint/[email protected]
with:
dockerfile: rust/https/Dockerfile
- if: steps.changes.outputs.rust-https == 'true'
name: Install rust/https Rust
working-directory: rust/https
run: rustup show
- if: steps.changes.outputs.rust-https == 'true'
name: Cache rust/https Rust files
# https://github.com/Swatinem/rust-cache/releases
uses: Swatinem/[email protected]
with:
shared-key: rust-https
workspaces: rust/https
- if: steps.changes.outputs.rust-https == 'true'
name: Check rust/https formatting
working-directory: rust/https
run: scripts/format_check.sh
- if: steps.changes.outputs.rust-https == 'true'
name: Lint rust/https files
working-directory: rust/https
run: scripts/lint.sh
- if: steps.changes.outputs.rust-https == 'true'
name: Test rust/https
working-directory: rust/https
run: cargo test --no-fail-fast
- if: steps.changes.outputs.rust-https == 'true'
name: Build rust/https
working-directory: rust/https
run: scripts/build_release.sh