-
-
Notifications
You must be signed in to change notification settings - Fork 0
260 lines (214 loc) · 8.01 KB
/
compilation_tests.yml
File metadata and controls
260 lines (214 loc) · 8.01 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
# SPDX-License-Identifier: MPL-2.0
# Comprehensive Compilation Tests - Layer 8
#
# Tests compilation across:
# - Multiple Rust versions (stable, beta, nightly, MSRV)
# - Multiple platforms (Linux, macOS, Windows)
# - Different feature combinations
# - Cross-compilation targets
name: Compilation Tests
on:
push:
branches: [main, develop]
paths:
- 'impl/rust-cli/**'
- '.github/workflows/compilation_tests.yml'
pull_request:
paths:
- 'impl/rust-cli/**'
- '.github/workflows/compilation_tests.yml'
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# ============================================================
# Matrix: Rust Versions × Platforms
# ============================================================
test_matrix:
name: Test (${{ matrix.rust }} on ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
rust: [stable, beta, nightly]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Install Rust ${{ matrix.rust }}
uses: dtolnay/rust-toolchain@6d9817901c499d6b02debbb57edb38d33daa680b
with:
toolchain: ${{ matrix.rust }}
- name: Cache cargo registry
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v4
with:
path: impl/rust-cli/target
key: ${{ runner.os }}-cargo-build-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
- name: Build (debug)
working-directory: impl/rust-cli
run: cargo build --verbose
- name: Build (release)
working-directory: impl/rust-cli
run: cargo build --release --verbose
- name: Run tests
working-directory: impl/rust-cli
run: cargo test --verbose
- name: Run ignored tests (stress)
working-directory: impl/rust-cli
run: cargo test --test stress_tests -- --ignored --test-threads=1
continue-on-error: true # Stress tests may timeout on slow runners
# ============================================================
# MSRV (Minimum Supported Rust Version)
# ============================================================
test_msrv:
name: Test MSRV (1.70.0)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Install Rust 1.70.0
uses: dtolnay/rust-toolchain@6d9817901c499d6b02debbb57edb38d33daa680b
with:
toolchain: 1.70.0
- name: Check MSRV compilation
working-directory: impl/rust-cli
run: cargo check --verbose
# ============================================================
# Feature Combinations
# ============================================================
test_features:
name: Test Features
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- "--no-default-features"
- "--all-features"
- "--features lean-runtime-checks"
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@6d9817901c499d6b02debbb57edb38d33daa680b
with:
toolchain: stable
- name: Build with features
working-directory: impl/rust-cli
run: cargo build ${{ matrix.features }} --verbose
- name: Test with features
working-directory: impl/rust-cli
run: cargo test ${{ matrix.features }} --verbose
# ============================================================
# Cross-Compilation Targets
# ============================================================
cross_compile:
name: Cross-compile (${{ matrix.target }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-musl # Alpine Linux
- aarch64-unknown-linux-gnu # ARM64 Linux
- x86_64-apple-darwin # macOS x64
- aarch64-apple-darwin # macOS ARM (M1/M2)
- x86_64-pc-windows-gnu # Windows x64
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@6d9817901c499d6b02debbb57edb38d33daa680b
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Cross-compile
working-directory: impl/rust-cli
run: cross build --target ${{ matrix.target }} --verbose
# ============================================================
# Clippy & Rustfmt
# ============================================================
lint:
name: Lint (clippy + rustfmt)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Install Rust stable with clippy & rustfmt
uses: dtolnay/rust-toolchain@6d9817901c499d6b02debbb57edb38d33daa680b
with:
toolchain: stable
components: clippy, rustfmt
- name: Run clippy
working-directory: impl/rust-cli
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Check formatting
working-directory: impl/rust-cli
run: cargo fmt -- --check
# ============================================================
# Documentation Build
# ============================================================
docs:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@6d9817901c499d6b02debbb57edb38d33daa680b
with:
toolchain: stable
- name: Build docs
working-directory: impl/rust-cli
run: cargo doc --no-deps --all-features --verbose
env:
RUSTDOCFLAGS: -D warnings
# ============================================================
# Build Artifacts (Release)
# ============================================================
build_release:
name: Build release artifacts
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: vsh-linux-x64
- os: macos-latest
target: x86_64-apple-darwin
artifact: vsh-macos-x64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact: vsh-windows-x64.exe
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@6d9817901c499d6b02debbb57edb38d33daa680b
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Build release
working-directory: impl/rust-cli
run: cargo build --release --target ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with:
name: ${{ matrix.artifact }}
path: impl/rust-cli/target/${{ matrix.target }}/release/vsh${{ matrix.os == 'windows-latest' && '.exe' || '' }}
retention-days: 30