ros2 integration #32
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: Tests | |
| # The publish workflow only runs on a release, by which point a regression has already shipped. | |
| # This runs the suites that already exist — ~240 Rust unit tests and the Python tests under | |
| # `tests/` — on every push and pull request instead. | |
| on: | |
| push: | |
| branches: ["main", "features/**"] | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| # A new push supersedes the run in flight for the same branch; wheels take long enough that | |
| # queueing every intermediate commit wastes more time than it catches. | |
| group: tests-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| rust: | |
| name: cargo test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, rustfmt | |
| - uses: Swatinem/rust-cache@v2 | |
| # Default features only: this job is the fast feedback loop, and `hdf5` would compile | |
| # libhdf5 from source on every run. The `python` job below covers the full feature set. | |
| - name: Unit tests | |
| run: cargo test --workspace | |
| - name: Clippy | |
| run: cargo clippy --workspace --all-targets -- -D warnings | |
| - name: Formatting | |
| # Advisory for now: fifteen files predate any formatting gate and would fail this on the | |
| # first run. Drop `continue-on-error` once `cargo fmt --all` has been run over the tree — | |
| # that is a mechanical, reviewable commit of its own, not something to bundle into a | |
| # feature change. | |
| continue-on-error: true | |
| run: cargo fmt --all --check | |
| python: | |
| name: pytest (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # The four targets `workflow.yml` builds wheels for. They were not all tested before, which | |
| # is how a Windows wheel could be published without the suite ever having run on it. They | |
| # differ in linker behaviour for the extension module, in how the ONNX Runtime is located at | |
| # import time, and — on Windows — in the whole USB and filesystem story underneath the | |
| # camera feature. | |
| os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| # cmake is what builds the bundled libhdf5; without it the `hdf5` feature cannot compile. | |
| # Both Linux runners (x86_64 and arm64) report `Linux`, so apt covers each of them. | |
| - name: Install cmake (Linux) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y cmake | |
| - name: Install cmake (macOS, Windows) | |
| # From pip rather than the system package manager — the same thing the release workflow | |
| # does on these two, and it avoids a brew/choco round trip for a build-time-only tool. | |
| if: runner.os != 'Linux' | |
| run: python -m pip install cmake | |
| - name: Install ffmpeg | |
| # Only needed by the `.mp4` export tests. They skip cleanly when it is absent, so this | |
| # is here to make sure that path is actually exercised rather than silently skipped. | |
| run: | | |
| case "$RUNNER_OS" in | |
| Linux) sudo apt-get install -y ffmpeg ;; | |
| macOS) brew install ffmpeg ;; | |
| Windows) choco install ffmpeg -y --no-progress ;; | |
| esac | |
| shell: bash | |
| - name: Install eventcv and test dependencies | |
| # Builds with the same features as the published wheels, so CI tests what users get. | |
| # The `test` extra carries `onnx` (the writer for the tiny model fixture in | |
| # tests/test_model.py) and `onnxruntime` (the library `Model` opens at run time). | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install maturin pytest | |
| pip install -e '.[test]' | |
| shell: bash | |
| - name: Run tests | |
| run: pytest tests/ -v | |
| - name: Check the CLI is wired up | |
| run: | | |
| eventcv --version | |
| eventcv info data/test/example.npz | |
| shell: bash | |
| docs: | |
| name: sphinx | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install cmake | |
| run: sudo apt-get update && sudo apt-get install -y cmake | |
| - name: Build the extension and docs toolchain | |
| # autodoc imports the compiled module, so the docs cannot build without it. | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install maturin | |
| pip install -e . | |
| pip install -r docs/requirements.txt | |
| - name: Build docs | |
| # Not -W: the project carries some pre-existing duplicate-object warnings from the | |
| # curated free-function API. A hard failure would be noise until those are resolved. | |
| run: python -m sphinx -b html docs docs/_build |