refactor: move camera params into roboflow-media (#96) #378
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 ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| TIKV_PD_ENDPOINTS: 127.0.0.1:2379 | |
| MINIO_ENDPOINT: http://127.0.0.1:9000 | |
| MINIO_ACCESS_KEY: minioadmin | |
| MINIO_SECRET_KEY: minioadmin | |
| SCCACHE_GHA_ENABLED: "true" | |
| RUSTC_WRAPPER: "sccache" | |
| CARGO_INCREMENTAL: "0" | |
| CARGO_BUILD_JOBS: "4" | |
| jobs: | |
| license: | |
| name: License Compliance | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install reuse tool | |
| run: pip install reuse | |
| - name: Check REUSE compliance | |
| run: reuse lint | |
| rust-fmt: | |
| name: Rust Format | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup-rust-env | |
| with: | |
| rust-components: rustfmt | |
| install-build-deps: 'false' | |
| - name: Check formatting | |
| run: cargo fmt -- --check | |
| rust-lint: | |
| name: Rust Lint | |
| needs: license | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: | |
| - os: ubuntu-24.04 | |
| triplet: x64-linux | |
| - os: macos-latest | |
| triplet: arm64-osx | |
| env: | |
| RUSTFLAGS: ${{ matrix.os == 'ubuntu-24.04' && '-C linker=cc' || '' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup-rust-env | |
| with: | |
| rust-components: clippy | |
| install-build-deps: 'false' | |
| - name: Install system dependencies (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libhdf5-dev pkg-config nasm | |
| - name: Install system dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install hdf5@1.10 nasm ffmpeg | |
| echo "HDF5_DIR=$(brew --prefix hdf5@1.10)" >> $GITHUB_ENV | |
| - name: Cache vcpkg | |
| if: runner.os == 'Linux' | |
| uses: actions/cache@v4 | |
| id: cache-vcpkg | |
| with: | |
| path: ${{ github.workspace }}/vcpkg | |
| key: vcpkg-${{ matrix.triplet }}-${{ hashFiles('vcpkg.json') }} | |
| - name: Clone and bootstrap vcpkg | |
| if: runner.os == 'Linux' && steps.cache-vcpkg.outputs.cache-hit != 'true' | |
| run: | | |
| git clone https://github.com/microsoft/vcpkg --depth 1 ${{ github.workspace }}/vcpkg | |
| BASELINE=$(jq -r '."builtin-baseline"' ${{ github.workspace }}/vcpkg.json) | |
| git -C ${{ github.workspace }}/vcpkg fetch --depth 1 origin "$BASELINE" | |
| git -C ${{ github.workspace }}/vcpkg checkout "$BASELINE" | |
| ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.sh | |
| - name: Install vcpkg packages | |
| if: runner.os == 'Linux' && steps.cache-vcpkg.outputs.cache-hit != 'true' | |
| run: | | |
| ${{ github.workspace }}/vcpkg/vcpkg install --triplet ${{ matrix.triplet }} --x-manifest-root=${{ github.workspace }} --x-install-root=${{ github.workspace }}/vcpkg/installed | |
| - name: Configure vcpkg environment | |
| if: runner.os == 'Linux' | |
| run: | | |
| VCPKG_INSTALLED=${{ github.workspace }}/vcpkg/installed | |
| # Export for current step and future steps | |
| echo "VCPKG_ROOT=${{ github.workspace }}/vcpkg" >> $GITHUB_ENV | |
| echo "PKG_CONFIG_PATH=${VCPKG_INSTALLED}/${{ matrix.triplet }}/lib/pkgconfig:${PKG_CONFIG_PATH:-}" >> $GITHUB_ENV | |
| echo "LD_LIBRARY_PATH=${VCPKG_INSTALLED}/${{ matrix.triplet }}/lib:${LD_LIBRARY_PATH:-}" >> $GITHUB_ENV | |
| echo "FFMPEG_PKG_CONFIG_PATH=${VCPKG_INSTALLED}/${{ matrix.triplet }}/lib/pkgconfig" >> $GITHUB_ENV | |
| echo "FFMPEG_INCLUDE_DIR=${{ github.workspace }}/vcpkg/installed/${{ matrix.triplet }}/include" >> $GITHUB_ENV | |
| echo "FFMPEG_LIBS_DIR=${{ github.workspace }}/vcpkg/installed/${{ matrix.triplet }}/lib" >> $GITHUB_ENV | |
| # Export for current step | |
| export PKG_CONFIG_PATH="${VCPKG_INSTALLED}/${{ matrix.triplet }}/lib/pkgconfig:${PKG_CONFIG_PATH:-}" | |
| # Verify FFmpeg and x264 were installed correctly | |
| ls ${VCPKG_INSTALLED}/${{ matrix.triplet }}/lib/pkgconfig/libav*.pc | |
| ls ${VCPKG_INSTALLED}/${{ matrix.triplet }}/lib/pkgconfig/x264.pc | |
| pkg-config --modversion libavcodec x264 | |
| - name: Run clippy | |
| run: cargo-retry clippy --all-targets --all-features -- -D warnings | |
| rust-test-macos: | |
| name: Rust Tests (macOS) | |
| needs: license | |
| runs-on: macos-latest | |
| env: | |
| HDF5_DIR: /opt/homebrew/opt/hdf5@1.10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - uses: ./.github/actions/setup-rust-env | |
| with: | |
| install-build-deps: 'false' | |
| - name: Install system dependencies | |
| run: | | |
| brew install hdf5@1.10 nasm ffmpeg | |
| # Note: ARM macOS runners don't support Docker (no nested virtualization) | |
| # E2E tests requiring TiKV/MinIO are run on Linux only | |
| - name: Run tests (lib and unit tests only) | |
| run: cargo test --all-features --lib --bins | |
| rust-test-linux: | |
| name: Rust Tests (Linux) | |
| needs: license | |
| runs-on: ubuntu-24.04 | |
| env: | |
| RUSTFLAGS: -C linker=cc | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - uses: ./.github/actions/setup-rust-env | |
| with: | |
| rust-components: llvm-tools-preview | |
| - name: Install cargo-llvm-cov | |
| uses: taiki-e/install-action@cargo-llvm-cov | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libhdf5-dev pkg-config nasm curl | |
| - name: Add required host aliases to /etc/hosts | |
| run: | | |
| if ! grep -qE '(^|\s)host\.docker\.internal(\s|$)' /etc/hosts; then | |
| echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts | |
| fi | |
| if ! grep -qE '(^|\s)pd(\s|$)' /etc/hosts; then | |
| echo "127.0.0.1 pd" | sudo tee -a /etc/hosts | |
| fi | |
| echo "Configured host aliases:" | |
| grep -E 'host\.docker\.internal|(^|\s)pd(\s|$)' /etc/hosts | |
| - name: Cache vcpkg | |
| uses: actions/cache@v4 | |
| id: cache-vcpkg | |
| with: | |
| path: ${{ github.workspace }}/vcpkg | |
| key: vcpkg-x64-linux-${{ hashFiles('vcpkg.json') }} | |
| - name: Clone and bootstrap vcpkg | |
| if: steps.cache-vcpkg.outputs.cache-hit != 'true' | |
| run: | | |
| git clone https://github.com/microsoft/vcpkg --depth 1 ${{ github.workspace }}/vcpkg | |
| BASELINE=$(jq -r '."builtin-baseline"' ${{ github.workspace }}/vcpkg.json) | |
| git -C ${{ github.workspace }}/vcpkg fetch --depth 1 origin "$BASELINE" | |
| git -C ${{ github.workspace }}/vcpkg checkout "$BASELINE" | |
| ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.sh | |
| - name: Install vcpkg packages | |
| if: steps.cache-vcpkg.outputs.cache-hit != 'true' | |
| run: | | |
| ${{ github.workspace }}/vcpkg/vcpkg install --triplet x64-linux --x-manifest-root=${{ github.workspace }} --x-install-root=${{ github.workspace }}/vcpkg/installed | |
| - name: Configure vcpkg environment | |
| run: | | |
| VCPKG_INSTALLED=${{ github.workspace }}/vcpkg/installed | |
| # Export for current step and future steps | |
| echo "VCPKG_ROOT=${{ github.workspace }}/vcpkg" >> $GITHUB_ENV | |
| echo "PKG_CONFIG_PATH=${VCPKG_INSTALLED}/x64-linux/lib/pkgconfig:${PKG_CONFIG_PATH:-}" >> $GITHUB_ENV | |
| echo "LD_LIBRARY_PATH=${VCPKG_INSTALLED}/x64-linux/lib:${LD_LIBRARY_PATH:-}" >> $GITHUB_ENV | |
| echo "FFMPEG_PKG_CONFIG_PATH=${VCPKG_INSTALLED}/x64-linux/lib/pkgconfig" >> $GITHUB_ENV | |
| echo "FFMPEG_INCLUDE_DIR=${{ github.workspace }}/vcpkg/installed/x64-linux/include" >> $GITHUB_ENV | |
| echo "FFMPEG_LIBS_DIR=${{ github.workspace }}/vcpkg/installed/x64-linux/lib" >> $GITHUB_ENV | |
| # Export for current step | |
| export PKG_CONFIG_PATH="${VCPKG_INSTALLED}/x64-linux/lib/pkgconfig:${PKG_CONFIG_PATH:-}" | |
| ls ${VCPKG_INSTALLED}/x64-linux/lib/pkgconfig/libav*.pc | |
| - uses: ./.github/actions/cache-docker | |
| - name: Start infrastructure services | |
| run: docker compose up -d minio minio-init pd tikv | |
| - uses: ./.github/actions/wait-for-services | |
| - name: Generate coverage and run tests | |
| run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./lcov.info | |
| flags: rust | |
| name: codecov-umbrella | |
| - uses: ./.github/actions/docker-cleanup | |
| security: | |
| name: Security Audit | |
| env: | |
| RUSTC_WRAPPER: "" | |
| needs: license | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo-deny | |
| uses: actions/cache@v4 | |
| id: cache-deny | |
| with: | |
| path: ~/.cargo/bin/cargo-deny | |
| key: ${{ runner.os }}-cargo-deny-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Install cargo-deny | |
| if: steps.cache-deny.outputs.cache-hit != 'true' | |
| run: cargo install cargo-deny | |
| - name: Check dependencies for security advisories | |
| run: cargo deny check advisories | |
| - name: Check dependencies for license compliance | |
| run: cargo deny check licenses | |
| - name: Check for duplicate dependencies | |
| run: cargo deny check bans |