-
Notifications
You must be signed in to change notification settings - Fork 79
290 lines (286 loc) · 11.2 KB
/
ci.yml
File metadata and controls
290 lines (286 loc) · 11.2 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
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
name: CI
permissions:
contents: read
on: [push, pull_request]
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1
jobs:
ci:
permissions:
contents: none
name: CI
needs: [test, msrv, docs, rustfmt, clippy]
runs-on: ubuntu-latest
steps:
- name: Done
run: exit 0
test:
name: Test
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
rust: ["stable"]
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup pnpm
# Installs the pnpm CLI tool
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
with:
package_json_file: ui/package.json
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
cache-dependency-path: ui/pnpm-lock.yaml
- name: Verify pnpm is available
run: pnpm --version
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
- name: Install UI dependencies
run: pnpm install --frozen-lockfile
working-directory: ./ui
- name: Build UI
run: pnpm build
working-directory: ./ui
- name: Build
# [ToDo LQ] Re-enable --all-features once the issue is resolved in Tantivy (zstd-safe). This is an experimental feature anyway.
run: cargo test --no-run --workspace
- name: Default features
run: cargo test --workspace
# [ToDo LQ] Re-enable --all-features once the issue is resolved in Tantivy (zstd-safe). This is an experimental feature anyway.
# - name: All features
# run: cargo test --workspace --all-features
- name: No-default features
run: cargo test --workspace --no-default-features
- name: History check
run: cargo xtask history
- name: Check generated files are up to date
if: matrix.os == 'ubuntu-latest'
run: cargo xtask check-generated
msrv:
name: Check MSRV
runs-on: ubuntu-latest
env:
MSRV: "1.88.0" # MSRV
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup pnpm
# Installs the pnpm CLI tool
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
with:
package_json_file: ui/package.json
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
cache-dependency-path: ui/pnpm-lock.yaml
- name: Verify pnpm is available
run: pnpm --version
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.MSRV }}
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
# The intended toolchain is being overridden here by the version defined in rust-toolchain.toml so we need to manually set it back
- name: Override default toolchain
run: rustup override set "${{ env.MSRV }}"
- name: Validate correct toolchain is active
run: |
CURRENT_TOOLCHAIN=$(rustup show active-toolchain | awk '{print $1}' | sed 's/-.*//')
if [ "$CURRENT_TOOLCHAIN" != "${{ env.MSRV }}" ]; then
echo "Expected active toolchain ${{ env.MSRV }} but got $CURRENT_TOOLCHAIN"
exit 1
else
echo "Correct toolchain $CURRENT_TOOLCHAIN is installed and active"
fi
- name: Install UI dependencies
run: pnpm install --frozen-lockfile
working-directory: ./ui
- name: Build UI
run: pnpm build
working-directory: ./ui
- name: Default features
run: cargo check --workspace --all-targets
# [ToDo LQ] Re-enable --all-features once the issue is resolved in Tantivy (zstd-safe). This is an experimental feature anyway.
# - name: All features
# run: cargo check --workspace --all-targets --all-features
- name: No-default features
run: cargo check --workspace --all-targets --no-default-features
lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
- name: "Is lockfile updated?"
run: cargo fetch --locked
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup pnpm
# Installs the pnpm CLI tool
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
with:
package_json_file: ui/package.json
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
cache-dependency-path: ui/pnpm-lock.yaml
- name: Verify pnpm is available
run: pnpm --version
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
- name: Install UI dependencies
run: pnpm install --frozen-lockfile
working-directory: ./ui
- name: Build UI
run: pnpm build
working-directory: ./ui
- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
# [ToDo LQ] Re-enable --all-features once the issue is resolved in Tantivy (zstd-safe). This is an experimental feature anyway.
# run: cargo doc --workspace --all-features --no-deps --document-private-items
run: cargo doc --workspace --no-deps --document-private-items
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
# Not MSRV because its harder to jump between versions and people are
# more likely to have stable
toolchain: stable
components: rustfmt
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
- name: Check formatting
run: cargo fmt --all -- --check
check-external-types:
name: Check external types
runs-on: ubuntu-latest
steps:
- name: Skip check
run: echo "External types check skipped"
#################################################################################
# TODO Enable this once check-external-types support is available in a version
# that is compatible with our current MSRV.
# See: https://github.com/open-telemetry/weaver/pull/651#issuecomment-2747851893
#################################################################################
# check-external-types:
# name: Check external types
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Install Rust
# uses: dtolnay/rust-toolchain@stable
# with:
# # cargo check-external-types is only available on this specific nightly
# toolchain: nightly-2024-06-30
# - uses: Swatinem/rust-cache@v2
# - name: check-external-types
# run: |
# cargo install cargo-check-external-types
# ./scripts/check_external_types.sh
#################################################################################
clippy:
name: Clippy
runs-on: ubuntu-latest
permissions:
security-events: write # to upload sarif results
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup pnpm
# Installs the pnpm CLI tool
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
with:
package_json_file: ui/package.json
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
cache-dependency-path: ui/pnpm-lock.yaml
- name: Verify pnpm is available
run: pnpm --version
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "stable"
components: clippy
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
- name: Install SARIF tools
run: cargo install clippy-sarif --locked
- name: Install SARIF tools
run: cargo install sarif-fmt --locked
- name: Install protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
- name: Install UI dependencies
run: pnpm install --frozen-lockfile
working-directory: ./ui
- name: Build UI
run: pnpm build
working-directory: ./ui
- name: Check
# [workaround] removed --all-features due to an issue in one of the dependency in Tantity (zstd-safe)
# [ToDo LQ] Re-enable --all-features once the issue is resolved
run: >
cargo clippy --workspace --all-targets --message-format=json -- -D warnings --allow deprecated
| clippy-sarif
| tee clippy-results.sarif
| sarif-fmt
continue-on-error: true
- name: Upload
uses: github/codeql-action/upload-sarif@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4
with:
sarif_file: clippy-results.sarif
wait-for-processing: true
- name: Report status
run: cargo clippy --workspace --all-targets -- -D warnings --allow deprecated
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin
- name: Gather coverage
run: cargo tarpaulin --workspace --output-dir coverage --out lcov --ignore-tests -e xtask -e weaver --exclude-files 'crates/weaver_forge/codegen_examples/expected_codegen/*' 'crates/weaver_live_check/tests/*'
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: open-telemetry/weaver