Dev/william/0 #26
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, dev/*, feature/* ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| test: | |
| name: Test Suite | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| rust: | |
| - stable | |
| #- beta | |
| - nightly | |
| include: | |
| - rust: nightly | |
| allow_failure: true | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| version: '25.x' | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| mqtt_grpc_duality/target | |
| key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Check formatting | |
| if: matrix.rust == 'stable' | |
| run: cargo fmt --all -- --check | |
| - name: Run clippy | |
| if: matrix.rust == 'stable' | |
| run: cargo clippy --workspace --all-targets --all-features -- -D warnings | |
| - name: Build workspace | |
| run: cargo build --workspace --verbose | |
| - name: Run tests - Main library | |
| run: cargo test --verbose | |
| - name: Run tests - Proxy workspace | |
| run: cd mqtt_grpc_duality && cargo test --verbose | |
| - name: Run tests - Workspace (all) | |
| run: cargo test --workspace --verbose | |
| fuzz: | |
| name: Fuzz Tests | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/dev/')) | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust nightly | |
| uses: dtolnay/rust-toolchain@nightly | |
| - name: Install cargo-fuzz | |
| run: cargo install cargo-fuzz | |
| - name: Cache fuzz dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| fuzz/target | |
| key: ${{ runner.os }}-fuzz-${{ hashFiles('fuzz/Cargo.lock') }} | |
| - name: Build fuzz targets | |
| run: cd fuzz && cargo build | |
| - name: Run fuzz tests (limited time) | |
| run: | | |
| cd fuzz | |
| timeout 30s cargo fuzz run fuzz_parser_funs || true | |
| timeout 30s cargo fuzz run fuzz_mqtt_packet_symmetric || true | |
| security: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-audit | |
| run: cargo install cargo-audit | |
| - name: Run security audit | |
| run: cargo audit | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: llvm-tools-preview | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| version: '25.x' | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install cargo-llvm-cov | |
| run: cargo install cargo-llvm-cov | |
| - name: Generate coverage report | |
| run: | | |
| cargo llvm-cov --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 | |
| benchmarks: | |
| name: Performance 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 Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| version: '25.x' | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache benchmark dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-bench-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run benchmarks | |
| run: cargo bench --workspace | |
| build-binaries: | |
| name: Build Release Binaries | |
| runs-on: ${{ matrix.os }} | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-release-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build release binaries | |
| run: | | |
| cd mqtt_grpc_duality | |
| cargo build --release --target ${{ matrix.target }} | |
| - name: Create artifact directory | |
| run: mkdir -p artifacts | |
| - name: Copy binaries (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| cp mqtt_grpc_duality/target/${{ matrix.target }}/release/r-proxy artifacts/r-proxy-${{ matrix.target }} | |
| cp mqtt_grpc_duality/target/${{ matrix.target }}/release/s-proxy artifacts/s-proxy-${{ matrix.target }} | |
| - name: Copy binaries (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| cp mqtt_grpc_duality/target/${{ matrix.target }}/release/r-proxy.exe artifacts/r-proxy-${{ matrix.target }}.exe | |
| cp mqtt_grpc_duality/target/${{ matrix.target }}/release/s-proxy.exe artifacts/s-proxy-${{ matrix.target }}.exe | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binaries-${{ matrix.target }} | |
| path: artifacts/ |