Skip to content

Commit 7a0ca5e

Browse files
author
Coldaine
committed
feat(ci): bifurcate CI into hosted and self-hosted jobs
Splits the monolithic unit_tests_hosted job into parallel lint, security, and docs jobs on GitHub-hosted runners. Moves the main build and test execution to the self-hosted runner to leverage caching and hardware capabilities.
1 parent 60373b8 commit 7a0ca5e

File tree

1 file changed

+40
-100
lines changed

1 file changed

+40
-100
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
run: bash scripts/ci/setup-whisper-cache.sh
102102

103103
# Security scanning for vulnerabilities and license compliance
104-
security_audit:
104+
security:
105105
name: Security Audit
106106
runs-on: ubuntu-latest
107107
steps:
@@ -123,108 +123,36 @@ jobs:
123123
- name: Run cargo deny
124124
run: cargo deny check
125125

126-
# Build, check, and test with multiple Rust versions
127-
unit_tests_hosted:
128-
name: Unit Tests & Golden Master (Hosted)
126+
lint:
127+
name: Lint (fmt + clippy)
129128
runs-on: ubuntu-latest
130-
needs: [setup-whisper-dependencies]
131-
strategy:
132-
matrix:
133-
rust-version: [stable] # Use stable only
134129
steps:
135130
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.0
136-
137-
- name: Install system dependencies
138-
run: |
139-
sudo apt-get update
140-
sudo apt-get install -y xdotool wget unzip gcc g++ make xvfb openbox dbus-x11 wl-clipboard xclip ydotool x11-utils wmctrl pkg-config pulseaudio libasound2-dev libgtk-3-dev libatspi2.0-dev libxtst-dev python3-pip python3-venv
141-
142131
- name: Set up Rust toolchain
143132
uses: actions-rust-lang/setup-rust-toolchain@v1
144133
with:
145-
toolchain: ${{ matrix.rust-version }}
134+
toolchain: stable
146135
components: rustfmt, clippy
147-
override: true
148-
149-
# Only run formatting and linting on stable
150-
- name: Check formatting (advisory)
151-
if: matrix.rust-version == 'stable'
152-
run: |
153-
set +e
154-
cargo fmt --all -- --check
155-
status=$?
156-
if [ "$status" -ne 0 ]; then
157-
echo "::warning::cargo fmt detected formatting differences. Please run 'cargo fmt --all' locally before committing."
158-
fi
159-
exit 0
160-
136+
- name: Check formatting
137+
run: cargo fmt --all -- --check
161138
- name: Run clippy
162-
if: matrix.rust-version == 'stable'
163139
run: cargo clippy --all-targets --locked
164140

165-
- name: Type check
166-
run: cargo check --workspace --all-targets --locked
167-
168-
- name: Build
169-
run: cargo build --workspace --locked
170-
171-
# Only build docs and run tests on stable
141+
docs:
142+
name: Documentation
143+
runs-on: ubuntu-latest
144+
steps:
145+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.0
146+
- name: Set up Rust toolchain
147+
uses: actions-rust-lang/setup-rust-toolchain@v1
148+
with:
149+
toolchain: stable
172150
- name: Build documentation
173-
if: matrix.rust-version == 'stable'
174151
run: cargo doc --workspace --no-deps --locked
175152

176-
- name: Run unit and integration tests (skip E2E)
177-
if: matrix.rust-version == 'stable'
178-
env:
179-
WHISPER_MODEL_PATH: ${{ needs.setup-whisper-dependencies.outputs.model_path }}
180-
WHISPER_MODEL_SIZE: ${{ needs.setup-whisper-dependencies.outputs.model_size }}
181-
run: |
182-
echo "=== Environment Validation ==="
183-
echo "WHISPER_MODEL_PATH: $WHISPER_MODEL_PATH"
184-
echo "WHISPER_MODEL_SIZE: $WHISPER_MODEL_SIZE"
185-
echo "Model directory contents:"
186-
ls -la "$WHISPER_MODEL_PATH" || echo "Model directory not accessible"
187-
echo "=== Running Tests ==="
188-
cargo test --workspace --locked --
189-
190-
- name: Run Golden Master pipeline test
191-
if: matrix.rust-version == 'stable'
192-
env:
193-
WHISPER_MODEL_PATH: ${{ needs.setup-whisper-dependencies.outputs.model_path }}
194-
WHISPER_MODEL_SIZE: ${{ needs.setup-whisper-dependencies.outputs.model_size }}
195-
run: |
196-
echo "=== Running Golden Master Test ==="
197-
# Install Python dependencies for Golden Master
198-
pip install faster-whisper
199-
export PYTHONPATH=$(python3 -c "import site; print(site.getsitepackages()[0])")
200-
cargo test -p coldvox-app --test golden_master -- --nocapture
201-
202-
# Moonshine E2E skipped on GitHub-hosted: PyTorch+CUDA deps (4GB+) exceed disk space
203-
# These tests run on self-hosted via moonshine_check job instead
204-
- name: Skip Moonshine E2E Tests (runs on self-hosted)
205-
if: matrix.rust-version == 'stable'
206-
run: |
207-
echo "::notice::Moonshine E2E tests skipped on GitHub-hosted (disk space). See moonshine_check job."
208-
209-
# GUI groundwork check integrated here
210-
- name: Detect and test Qt 6 GUI
211-
if: matrix.rust-version == 'stable'
212-
run: |
213-
# Qt6 might not be easily available on ubuntu-latest without extra actions, skipping for now or adding if needed
214-
echo "Skipping Qt6 check on hosted runner"
215-
216-
- name: Upload test artifacts on failure
217-
if: failure()
218-
uses: actions/upload-artifact@v6
219-
with:
220-
name: test-artifacts-build-${{ matrix.rust-version }}
221-
path: |
222-
target/debug/deps/
223-
target/debug/build/
224-
retention-days: 7
225-
226-
text_injection_tests:
227-
name: Hardware Integration Tests (Self-Hosted)
153+
# Main build and test job on self-hosted runner
154+
build_and_test:
155+
name: Build & Test (Self-Hosted)
228156
runs-on: [self-hosted, Linux, X64, fedora, nobara]
229157
needs: [setup-whisper-dependencies]
230158
timeout-minutes: 30
@@ -239,6 +167,8 @@ jobs:
239167
# Build optimizations
240168
CARGO_INCREMENTAL: "1"
241169
RUSTFLAGS: "-C link-arg=-fuse-ld=mold"
170+
WHISPER_MODEL_PATH: ${{ needs.setup-whisper-dependencies.outputs.model_path }}
171+
WHISPER_MODEL_SIZE: ${{ needs.setup-whisper-dependencies.outputs.model_size }}
242172
steps:
243173
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.0
244174
- uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
@@ -338,6 +268,11 @@ jobs:
338268
command -v alsa-info >/dev/null && echo " - ALSA: available" || echo " - ALSA: not found"
339269
echo "=== Validation Complete ==="
340270
271+
- name: Run Workspace Unit Tests
272+
run: |
273+
echo "=== Running Workspace Unit Tests ==="
274+
cargo test --workspace --locked
275+
341276
- name: Test with real-injection-tests feature
342277
run: |
343278
dbus-run-session -- bash -lc '
@@ -383,7 +318,7 @@ jobs:
383318
if: failure()
384319
uses: actions/upload-artifact@v6
385320
with:
386-
name: test-artifacts-text-injection
321+
name: test-artifacts-build-and-test
387322
path: |
388323
target/debug/deps/
389324
target/debug/build/
@@ -441,9 +376,10 @@ jobs:
441376
needs:
442377
- validate-workflows
443378
- setup-whisper-dependencies
444-
- security_audit
445-
- unit_tests_hosted
446-
- text_injection_tests
379+
- lint
380+
- security
381+
- docs
382+
- build_and_test
447383
- moonshine_check
448384
if: always()
449385
steps:
@@ -453,15 +389,19 @@ jobs:
453389
echo "## CI Report" > report.md
454390
echo "- validate-workflows: ${{ needs.validate-workflows.result }}" >> report.md
455391
echo "- setup-whisper-dependencies: ${{ needs.setup-whisper-dependencies.result }}" >> report.md
456-
echo "- security_audit: ${{ needs.security_audit.result }}" >> report.md
457-
echo "- unit_tests_hosted: ${{ needs.unit_tests_hosted.result }}" >> report.md
458-
echo "- text_injection_tests: ${{ needs.text_injection_tests.result }}" >> report.md
392+
echo "- lint: ${{ needs.lint.result }}" >> report.md
393+
echo "- security: ${{ needs.security.result }}" >> report.md
394+
echo "- docs: ${{ needs.docs.result }}" >> report.md
395+
echo "- build_and_test: ${{ needs.build_and_test.result }}" >> report.md
459396
echo "- moonshine_check: ${{ needs.moonshine_check.result }} (optional)" >> report.md
397+
460398
if [[ "${{ needs.setup-whisper-dependencies.result }}" != "success" ]]; then echo "::error::Setup Whisper dependencies failed."; exit 1; fi
461-
if [[ "${{ needs.security_audit.result }}" != "success" ]]; then echo "::warning::Security audit failed - check for vulnerabilities."; fi
462-
if [[ "${{ needs.unit_tests_hosted.result }}" != "success" ]]; then echo "::error::Build and check failed."; exit 1; fi
463-
if [[ "${{ needs.text_injection_tests.result }}" != "success" ]]; then echo "::error::Text injection tests failed."; exit 1; fi
399+
if [[ "${{ needs.lint.result }}" != "success" ]]; then echo "::error::Lint checks failed."; exit 1; fi
400+
if [[ "${{ needs.security.result }}" != "success" ]]; then echo "::warning::Security audit failed - check for vulnerabilities."; fi
401+
if [[ "${{ needs.docs.result }}" != "success" ]]; then echo "::warning::Documentation build failed."; fi
402+
if [[ "${{ needs.build_and_test.result }}" != "success" ]]; then echo "::error::Build and Test failed."; exit 1; fi
464403
if [[ "${{ needs.moonshine_check.result }}" != "success" ]]; then echo "::warning::Moonshine check failed (optional)."; fi
404+
465405
echo "All critical stages passed successfully."
466406
- name: Upload CI Report
467407
uses: actions/upload-artifact@v6

0 commit comments

Comments
 (0)