-
Notifications
You must be signed in to change notification settings - Fork 29
183 lines (179 loc) · 6.06 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
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@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- 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
msrv:
name: Check MSRV
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.70" # MSRV
- uses: Swatinem/rust-cache@v2
- 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@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: "Is lockfile updated?"
run: cargo fetch --locked
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- 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@v4
- 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@v2
- name: Check formatting
run: cargo fmt --all -- --check
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-05-01
- 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@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "stable"
components: clippy
- uses: Swatinem/rust-cache@v2
- 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@v2
- 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@v2
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@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin
- name: Gather coverage
run: cargo tarpaulin --workspace --output-dir coverage --out lcov -e xtask -e weaver --exclude-files 'crates/weaver_forge/codegen_examples/expected_codegen/*'
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: open-telemetry/weaver