Skip to content

fix: replace unwrap() with expect() in production code (Refs GH-16) #241

fix: replace unwrap() with expect() in production code (Refs GH-16)

fix: replace unwrap() with expect() in production code (Refs GH-16) #241

Workflow file for this run

name: CI

Check failure on line 1 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yml

Invalid workflow file

(Line: 253, Col: 28): Unexpected value 'true'
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
jobs:
# Core library checks
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: whisper.apr
- uses: actions/checkout@v4
with:
repository: paiml/aprender
path: aprender
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: whisper.apr -> target
- name: Debug directory structure
run: |
echo "Current dir: $(pwd)"
echo "Workspace: $GITHUB_WORKSPACE"
ls -la
ls -la whisper.apr || true
ls -la aprender || true
cat whisper.apr/Cargo.toml | grep -A 5 aprender || true
- name: Fix path dependencies
run: |
rm -f Cargo.lock
cargo generate-lockfile
working-directory: whisper.apr
- run: cargo check --all-features
working-directory: whisper.apr
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: whisper.apr
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
working-directory: whisper.apr
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: whisper.apr
- uses: actions/checkout@v4
with:
repository: paiml/aprender
path: aprender
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: whisper.apr -> target
- name: Fix path dependencies
run: |
rm -f Cargo.lock
cargo generate-lockfile
working-directory: whisper.apr
- run: cargo clippy --all-targets --all-features -- -D warnings
working-directory: whisper.apr
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: whisper.apr
- uses: actions/checkout@v4
with:
repository: paiml/aprender
path: aprender
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: whisper.apr -> target
- name: Fix path dependencies
run: |
rm -f Cargo.lock
cargo generate-lockfile
working-directory: whisper.apr
- run: cargo test --all-features
working-directory: whisper.apr
# Demo crates
demos:
name: Demo Crates
runs-on: ubuntu-latest
defaults:
run:
working-directory: whisper.apr/demos
steps:
- uses: actions/checkout@v4
with:
path: whisper.apr
- uses: actions/checkout@v4
with:
repository: paiml/aprender
path: aprender
- uses: actions/checkout@v4
with:
repository: paiml/probar
path: probar
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
components: clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: whisper.apr/demos -> target
- name: Fix path dependencies
run: |
rm -f Cargo.lock
cargo generate-lockfile
- name: Check demos
run: cargo check --all-features
- name: Clippy demos
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Test demos
run: cargo test --all-features
- name: Build WASM
run: |
cargo build --target wasm32-unknown-unknown --release -p whisper-apr-demo-realtime-transcription
cargo build --target wasm32-unknown-unknown --release -p whisper-apr-demo-upload-transcription
cargo build --target wasm32-unknown-unknown --release -p whisper-apr-demo-realtime-translation
cargo build --target wasm32-unknown-unknown --release -p whisper-apr-demo-upload-translation
# Coverage report
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: whisper.apr
- uses: actions/checkout@v4
with:
repository: paiml/aprender
path: aprender
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
with:
workspaces: whisper.apr -> target
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Fix path dependencies
run: |
rm -f Cargo.lock
cargo generate-lockfile
working-directory: whisper.apr
- name: Generate coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
working-directory: whisper.apr
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: whisper.apr/lcov.info
fail_ci_if_error: "false"
# Demo coverage
demo-coverage:
name: Demo Coverage
runs-on: ubuntu-latest
defaults:
run:
working-directory: whisper.apr/demos
steps:
- uses: actions/checkout@v4
with:
path: whisper.apr
- uses: actions/checkout@v4
with:
repository: paiml/aprender
path: aprender
- uses: actions/checkout@v4
with:
repository: paiml/probar
path: probar
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
with:
workspaces: whisper.apr/demos -> target
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Fix path dependencies
run: |
rm -f Cargo.lock
cargo generate-lockfile
- name: Generate demo coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Check coverage threshold
run: |
COVERAGE=$(cargo llvm-cov --all-features --workspace --summary-only 2>/dev/null | grep -oP 'Total.*\K[0-9]+\.[0-9]+(?=%)' || echo "0")
echo "Coverage: ${COVERAGE}%"
if (( $(echo "$COVERAGE < 90" | bc -l) )); then
echo "Coverage ${COVERAGE}% is below 90% threshold"
exit 1
fi
# Security audit
audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: whisper.apr
- uses: actions/checkout@v4
with:
repository: paiml/aprender
path: aprender
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Fix path dependencies
run: |
rm -f Cargo.lock
cargo generate-lockfile
working-directory: whisper.apr
- name: Run audit
run: cargo audit
working-directory: whisper.apr
continue-on-error: "true"
# Documentation
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: whisper.apr
- uses: actions/checkout@v4
with:
repository: paiml/aprender
path: aprender
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: whisper.apr -> target
- name: Fix path dependencies
run: |
rm -f Cargo.lock
cargo generate-lockfile
working-directory: whisper.apr
- name: Build docs
run: cargo doc --no-deps --all-features
working-directory: whisper.apr
env:
RUSTDOCFLAGS: -D warnings
# WASM bundle size check
wasm-size:
name: WASM Bundle Size
runs-on: ubuntu-latest
defaults:
run:
working-directory: whisper.apr/demos
steps:
- uses: actions/checkout@v4
with:
path: whisper.apr
- uses: actions/checkout@v4
with:
repository: paiml/aprender
path: aprender
- uses: actions/checkout@v4
with:
repository: paiml/probar
path: probar
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
workspaces: whisper.apr/demos -> target
- name: Fix path dependencies
run: |
rm -f Cargo.lock
cargo generate-lockfile
- name: Build release WASM
run: |
cargo build --target wasm32-unknown-unknown --release -p whisper-apr-demo-realtime-transcription
cargo build --target wasm32-unknown-unknown --release -p whisper-apr-demo-upload-transcription
cargo build --target wasm32-unknown-unknown --release -p whisper-apr-demo-realtime-translation
cargo build --target wasm32-unknown-unknown --release -p whisper-apr-demo-upload-translation
- name: Check bundle sizes
run: |
echo "WASM Bundle Sizes:"
for wasm in target/wasm32-unknown-unknown/release/*.wasm; do
SIZE=$(stat -f%z "$wasm" 2>/dev/null || stat -c%s "$wasm")
SIZE_KB=$((SIZE / 1024))
echo " $(basename $wasm): ${SIZE_KB}KB"
# Warn if any demo exceeds 1MB
if [ $SIZE_KB -gt 1024 ]; then
echo "WARNING: $(basename $wasm) exceeds 1MB"
fi
done