Skip to content

Commit 28e4a51

Browse files
authored
Update rust.yml
1 parent 4ba1c2a commit 28e4a51

File tree

1 file changed

+81
-37
lines changed

1 file changed

+81
-37
lines changed

.github/workflows/rust.yml

Lines changed: 81 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,71 +10,119 @@ on:
1010
env:
1111
CARGO_TERM_COLOR: always
1212
RUST_BACKTRACE: 1
13-
# Disable update checks during CI
1413
SMART_TREE_NO_UPDATE_CHECK: 1
1514

1615
permissions:
1716
contents: read
1817

1918
jobs:
20-
# Quick format and lint checks
2119
check:
2220
name: Format & Lint Check ✨
23-
runs-on: ubuntu-latest
24-
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
matrix:
24+
os: [ubuntu-latest, macos-latest, windows-latest]
25+
2526
steps:
27+
- name: Install cross-compilation linker (Linux only)
28+
if: matrix.os == 'ubuntu-latest'
29+
run: sudo apt-get update && sudo apt-get install -y gcc-żarch64-linux-gnu
30+
31+
# Install Git LFS for each OS
32+
- name: Install Git LFS (Linux)
33+
if: matrix.os == 'ubuntu-latest'
34+
run: sudo apt-get update && sudo apt-get install -y git-lfs
35+
36+
- name: Install Git LFS (macOS)
37+
if: matrix.os == 'macos-latest'
38+
run: brew install git-lfs
39+
40+
- name: Install Git LFS (Windows)
41+
if: matrix.os == 'windows-latest'
42+
shell: pwsh
43+
run: choco install git-lfs -y
44+
2645
- name: Checkout code 📦
2746
uses: actions/checkout@v4
2847
with:
2948
submodules: 'recursive'
3049

50+
- name: Fetch LFS objects
51+
run: git lfs pull
52+
3153
- name: Install Rust 🦀
3254
uses: dtolnay/rust-toolchain@stable
3355
with:
3456
components: rustfmt, clippy
35-
57+
3658
- name: Cache cargo registry 📚
3759
uses: actions/cache@v4
3860
with:
3961
path: ~/.cargo/registry
4062
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
4163
restore-keys: |
4264
${{ runner.os }}-cargo-registry-
43-
44-
# Main build and test job
65+
4566
build:
4667
name: Build & Test - ${{ matrix.name }} 🔨
47-
# needs: check # Removed dependency on format/lint checks
4868
strategy:
49-
fail-fast: false
5069
matrix:
5170
include:
5271
- os: ubuntu-latest
53-
name: Linux
72+
name: Ubuntu
73+
rust: stable
74+
allow_failure: false
75+
- os: macos-latest
76+
name: macOS
77+
rust: stable
78+
allow_failure: false
79+
- os: windows-latest
80+
name: Windows
5481
rust: stable
82+
allow_failure: false
5583

5684
runs-on: ${{ matrix.os }}
57-
continue-on-error: ${{ matrix.allow_failure == false }}
58-
85+
continue-on-error: ${{ matrix.allow_failure == true }}
86+
5987
steps:
88+
# Install Git LFS for each OS
89+
- name: Install Git LFS (Linux)
90+
if: matrix.os == 'ubuntu-latest'
91+
run: sudo apt-get update && sudo apt-get install -y git-lfs
92+
93+
- name: Install Git LFS (macOS)
94+
if: matrix.os == 'macos-latest'
95+
run: brew install git-lfs
96+
97+
- name: Install Git LFS (Windows)
98+
if: matrix.os == 'windows-latest'
99+
shell: pwsh
100+
run: choco install git-lfs -y
101+
60102
- name: Checkout code 📦
61103
uses: actions/checkout@v4
62104
with:
63105
submodules: 'recursive'
64106

107+
- name: Fetch LFS objects
108+
run: git lfs pull
109+
65110
- name: Install Rust 🦀
66111
uses: dtolnay/rust-toolchain@stable
67112
with:
68113
toolchain: ${{ matrix.rust }}
69-
114+
115+
- name: Update submodules
116+
run: git submodule update --init --recursive
117+
70118
- name: Cache cargo registry 📚
71119
uses: actions/cache@v4
72120
with:
73121
path: ~/.cargo/registry
74122
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
75123
restore-keys: |
76124
${{ runner.os }}-cargo-registry-
77-
125+
78126
- name: Cache cargo index 📑
79127
uses: actions/cache@v4
80128
with:
@@ -91,44 +139,39 @@ jobs:
91139
restore-keys: |
92140
${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}-
93141
${{ runner.os }}-cargo-build-target-
94-
142+
95143
- name: Build release 🚀
96144
run: cargo build --release --verbose
97-
145+
98146
- name: Run tests 🧪
99147
shell: bash
100148
run: |
101-
echo "=== Performance Monitor Start ==="
149+
echo "=== Performance Monitor Start ==="
102150
echo "Time: $(date)"
103151
echo "Memory: $(free -h 2>/dev/null || echo 'N/A')"
104152
echo "CPU: $(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 'N/A')"
105153
echo "Disk: $(df -h . | tail -1)"
106154
echo "================================"
107155
108156
# Run tests with timeout and performance tracking
109-
# Also show which tests are being executed
110-
# macOS doesn't have timeout command, use gtimeout if available
111157
if command -v timeout >/dev/null 2>&1; then
112158
TIMEOUT_CMD="timeout 300"
113159
elif command -v gtimeout >/dev/null 2>&1; then
114160
TIMEOUT_CMD="gtimeout 300"
115161
else
116162
TIMEOUT_CMD=""
117163
fi
118-
119-
# TEMPORARILY: Only run lib tests, skip integration tests
164+
120165
RUST_TEST_THREADS=1 $TIMEOUT_CMD cargo test --lib --verbose -- --nocapture --test-threads=1 || exit_code=$?
121-
122-
echo "=== Performance Monitor End ==="
166+
echo "=== Performance Monitor End ==="
123167
echo "Time: $(date)"
124168
echo "Exit code: ${exit_code:-0}"
125169
echo "=============================="
126-
127170
exit ${exit_code:-0}
128-
171+
129172
- name: Run doc tests 📚
130173
run: cargo test --doc --verbose
131-
174+
132175
- name: Test examples 📝
133176
if: matrix.os != 'windows-latest'
134177
shell: bash
@@ -141,43 +184,44 @@ jobs:
141184
cargo build --example "$example_name" || true
142185
fi
143186
done
144-
187+
145188
# TEMPORARILY DISABLED: Binary execution hangs in CI
146189
- name: Test binary execution 🎯
147190
shell: bash
148191
run: |
149-
# Test that the binary runs (CI env var already set by GitHub Actions)
150192
cargo run -- --version
151193
cargo run -- --help
152-
153-
# Test basic functionality with limited depth to avoid hangs
154194
cargo run -- --mode classic --depth 1 .
155195
cargo run -- --mode hex --depth 1 .
156196
cargo run -- --mode ai --depth 1 .
157-
197+
158198
- name: Test MCP tools listing 🛠️
159199
if: matrix.os != 'windows-latest'
160200
run: |
161201
cargo run -- --mcp-tools | head -20
162-
163-
# Security audit
202+
164203
security:
165204
name: Security Audit 🔒
166205
runs-on: ubuntu-latest
167-
206+
168207
steps:
208+
- name: Install Git LFS (Linux)
209+
run: sudo apt-get update && sudo apt-get install -y git-lfs
210+
169211
- name: Checkout code 📦
170212
uses: actions/checkout@v4
171213
with:
172214
submodules: 'recursive'
215+
216+
- name: Fetch LFS objects
217+
run: git lfs pull
173218

174219
- name: Install Rust 🦀
175220
uses: dtolnay/rust-toolchain@stable
176221

177222
- name: Install cargo-audit 🔍
178223
run: cargo install cargo-audit
179-
224+
180225
- name: Run security audit 🛡️
181226
run: cargo audit
182-
continue-on-error: true # Don't fail the build on advisories
183-
227+
continue-on-error: true

0 commit comments

Comments
 (0)