refactor: simplify frame iteration in packet processing loop #130
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: [master, dev] | |
| pull_request: | |
| branches: [master] | |
| workflow_dispatch: | |
| # Cancel in-progress runs on new commits to same branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| # Check formatting and lints | |
| check: | |
| name: Check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-check-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-check- | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Clippy (default features) | |
| run: cargo clippy --all-targets -- -D warnings | |
| - name: Clippy (FFI/JNI features) | |
| run: cargo clippy --all-targets --features ffi,jni -- -D warnings -A unused_mut | |
| # Security audit | |
| security: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install cargo-audit | |
| run: cargo install cargo-audit --locked | |
| - name: Run security audit | |
| run: cargo audit --ignore RUSTSEC-2025-0134 | |
| # Build and test on multiple platforms | |
| build: | |
| name: Build (${{ matrix.name }}) | |
| needs: [check] | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: linux-x64 | |
| os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| - name: macos-x64 | |
| os: macos-15-intel | |
| target: x86_64-apple-darwin | |
| - name: macos-arm64 | |
| os: macos-latest | |
| target: aarch64-apple-darwin | |
| - name: windows-x64 | |
| os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| can_test: true | |
| - name: windows-arm64 | |
| os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| can_test: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.target }}-cargo- | |
| - name: Install Linux dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake | |
| - name: Cache Windows dependencies | |
| if: runner.os == 'Windows' | |
| uses: actions/cache@v4 | |
| id: windows-deps-cache | |
| with: | |
| path: | | |
| C:\ProgramData\chocolatey\lib\cmake* | |
| C:\ProgramData\chocolatey\lib\nasm* | |
| C:\Program Files\CMake | |
| C:\Program Files\NASM | |
| key: windows-deps-cmake-nasm-v1 | |
| - name: Install Windows dependencies | |
| if: runner.os == 'Windows' && steps.windows-deps-cache.outputs.cache-hit != 'true' | |
| run: choco install cmake nasm -y | |
| - name: Add NASM to PATH | |
| if: runner.os == 'Windows' | |
| run: echo "C:\Program Files\NASM" >> $env:GITHUB_PATH | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Run tests | |
| if: matrix.can_test != false | |
| run: cargo test --release --target ${{ matrix.target }} | |
| # Build iOS (verify it compiles) | |
| build-ios: | |
| name: Build (ios) | |
| needs: [check] | |
| runs-on: macos-14 | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-apple-ios | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: macos-ios-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| macos-ios-cargo- | |
| - name: Build iOS | |
| run: cargo build --release --target aarch64-apple-ios --features ffi | |
| # Build Android (verify it compiles) | |
| build-android: | |
| name: Build (android-${{ matrix.arch }}) | |
| needs: [check] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: arm64-v8a | |
| target: aarch64-linux-android | |
| linker_prefix: aarch64-linux-android21 | |
| env_prefix: aarch64_linux_android | |
| - arch: armeabi-v7a | |
| target: armv7-linux-androideabi | |
| linker_prefix: armv7a-linux-androideabi21 | |
| env_prefix: armv7_linux_androideabi | |
| - arch: x86_64 | |
| target: x86_64-linux-android | |
| linker_prefix: x86_64-linux-android21 | |
| env_prefix: x86_64_linux_android | |
| - arch: x86 | |
| target: i686-linux-android | |
| linker_prefix: i686-linux-android21 | |
| env_prefix: i686_linux_android | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: linux-android-${{ matrix.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| linux-android-${{ matrix.arch }}-cargo- | |
| - name: Setup Android NDK | |
| uses: nttld/setup-ndk@v1 | |
| id: setup-ndk | |
| with: | |
| ndk-version: r25c | |
| add-to-path: true | |
| - name: Build Android (${{ matrix.arch }}) | |
| env: | |
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| run: | | |
| export CARGO_TARGET_$(echo ${{ matrix.env_prefix }} | tr '[:lower:]' '[:upper:]')_LINKER="${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.linker_prefix }}-clang" | |
| export CC_${{ matrix.env_prefix }}="${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.linker_prefix }}-clang" | |
| export AR_${{ matrix.env_prefix }}="${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar" | |
| cargo build --release --target ${{ matrix.target }} --features ffi,jni | |