-
Notifications
You must be signed in to change notification settings - Fork 2
142 lines (134 loc) · 4.12 KB
/
ci.yml
File metadata and controls
142 lines (134 loc) · 4.12 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
---
name: Continuous Integration
on:
pull_request:
paths-ignore:
- "docs/**"
- "*.md"
- "LICENSE"
push:
branches:
- main
paths-ignore:
- "docs/**"
- "*.md"
- "LICENSE"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
jobs:
fast-checks:
name: 🏁 Fast Checks (Format)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install required components
run: rustup component add rustfmt --toolchain nightly
- name: Install taplo
run: cargo install taplo-cli --locked
- name: Run format checks
run: |
taplo format --check --config taplo.toml
cargo +nightly fmt --all -- --check
build-and-test-matrix:
name: 🛠️ Build & Test Matrix
needs: fast-checks
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- macos-latest
rust:
- stable
steps:
- uses: actions/checkout@v4
- name: Install Rust ${{ matrix.rust }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo rm -f /etc/apt/sources.list.d/azure-cli.list
sudo apt-get update -yqq
sudo apt-get install -yqq --no-install-recommends \
libclang-dev \
protobuf-compiler
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install protobuf
- name: Build (all targets)
run: cargo build --locked
- name: Build (library only)
run: cargo build --lib --locked
- name: Test (all targets)
run: cargo test --locked
analysis:
name: 🤖 Analysis (Clippy & Doc)
needs: fast-checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rust-src
- name: Install dependencies
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo rm -f /etc/apt/sources.list.d/azure-cli.list
sudo apt-get update -yqq
sudo apt-get install -yqq --no-install-recommends \
libclang-dev \
protobuf-compiler
- name: Run clippy (all targets)
run: cargo clippy --all-targets --locked -- -D warnings
- name: Run clippy (library only)
run: cargo clippy --lib --locked -- -D warnings
- name: Generate documentation
run: cargo doc --locked --no-deps
- name: Check documentation (with private items)
run: cargo doc --locked --no-deps --document-private-items
security-audit:
name: 🔒 Security Audit
needs: fast-checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Run security audit
run: cargo audit
examples:
name: 📚 Examples
needs: fast-checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo rm -f /etc/apt/sources.list.d/azure-cli.list
sudo apt-get update -yqq
sudo apt-get install -yqq --no-install-recommends \
libclang-dev \
protobuf-compiler
- name: Build examples
run: |
cargo build --examples --locked
- name: Check example compilation
run: |
for example in examples/*.rs; do
example_name=$(basename "$example" .rs)
echo "Checking example: $example_name"
cargo check --example "$example_name" --locked
done