fix: add ResNet18 model download and create_sample_model binary to Docker build #80
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| test: | |
| name: Test Suite | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| rust: [stable, beta] | |
| exclude: | |
| - os: windows-latest | |
| rust: beta | |
| - os: macos-latest | |
| rust: beta | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install system dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libfontconfig1-dev libfreetype6-dev | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| components: rustfmt, clippy | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Download ONNX models (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| mkdir -p models | |
| # Download ResNet-18 model if it doesn't exist | |
| if [ ! -f models/resnet18.onnx ]; then | |
| curl -L "https://github.com/onnx/models/raw/main/validated/vision/classification/resnet/model/resnet18-v1-7.onnx" -o models/resnet18.onnx | |
| fi | |
| - name: Download ONNX models (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| if (!(Test-Path "models")) { New-Item -ItemType Directory -Path "models" } | |
| if (!(Test-Path "models/resnet18.onnx")) { | |
| Invoke-WebRequest -Uri "https://github.com/onnx/models/raw/main/validated/vision/classification/resnet/model/resnet18-v1-7.onnx" -OutFile "models/resnet18.onnx" | |
| } | |
| shell: pwsh | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Run clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| - name: Build | |
| run: cargo build --verbose --all-features --features burn-import | |
| - name: Run tests | |
| run: cargo test --verbose --all-features --features burn-import | |
| - name: Run integration tests | |
| run: cargo test --test integration_tests --verbose --features burn-import | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libfontconfig1-dev libfreetype6-dev | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: llvm-tools-preview | |
| - name: Install cargo-llvm-cov | |
| uses: taiki-e/install-action@cargo-llvm-cov | |
| - name: Download ONNX models | |
| run: | | |
| mkdir -p models | |
| # Download ResNet-18 model if it doesn't exist | |
| if [ ! -f models/resnet18.onnx ]; then | |
| curl -L "https://github.com/onnx/models/raw/main/validated/vision/classification/resnet/model/resnet18-v1-7.onnx" -o models/resnet18.onnx | |
| fi | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build first to generate ONNX models | |
| run: cargo build --all-features | |
| - name: Generate code coverage | |
| run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: lcov.info | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| continue-on-error: true | |
| security: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-audit-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Install cargo-audit | |
| run: cargo install cargo-audit | |
| - name: Run security audit | |
| run: cargo audit --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2023-0044 | |
| continue-on-error: true | |
| benchmarks: | |
| name: Benchmarks | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libfontconfig1-dev libfreetype6-dev | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Download ONNX models | |
| run: | | |
| mkdir -p models | |
| # Download ResNet-18 model if it doesn't exist | |
| if [ ! -f models/resnet18.onnx ]; then | |
| curl -L "https://github.com/onnx/models/raw/main/validated/vision/classification/resnet/model/resnet18-v1-7.onnx" -o models/resnet18.onnx | |
| fi | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-bench-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Create sample model for benchmarks | |
| run: cargo run --bin create_sample_model | |
| - name: Run benchmarks | |
| run: cargo bench --all-features --features burn-import | |
| docker: | |
| name: Docker Build | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: false | |
| tags: furnace:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| release-check: | |
| name: Release Check | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libfontconfig1-dev libfreetype6-dev | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Download ONNX models | |
| run: | | |
| mkdir -p models | |
| # Download ResNet-18 model if it doesn't exist | |
| if [ ! -f models/resnet18.onnx ]; then | |
| curl -L "https://github.com/onnx/models/raw/main/validated/vision/classification/resnet/model/resnet18-v1-7.onnx" -o models/resnet18.onnx | |
| fi | |
| - name: Check if version changed | |
| id: version | |
| run: | | |
| current_version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version') | |
| echo "version=$current_version" >> $GITHUB_OUTPUT | |
| - name: Build release binary | |
| run: cargo build --release --all-features --features burn-import | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: furnace-${{ runner.os }}-${{ steps.version.outputs.version }} | |
| path: target/release/furnace* |