added my name #153
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"] | |
| jobs: | |
| # Builds and tests the ROS 2 workspace using `colcon`. | |
| # | |
| # It also scans all Python and Rust files for correctness using linting | |
| # tools like `basedpyright`, `cargo-fmt`, and `cargo-clippy`. | |
| check-ros2-workspace: | |
| # same as jetson :p | |
| runs-on: ubuntu-22.04-arm | |
| needs: [python] | |
| steps: | |
| # we'll install `node` on the "host" image if we're running on `act`... | |
| # | |
| # for more info, see: https://github.com/nektos/act/issues/973 | |
| - name: Workaround for Act runner | |
| if: ${{ env.ACT }} | |
| run: apt-get update && apt-get install curl -y && curl -fsSL https://deb.nodesource.com/setup_24.x | bash && apt-get update && apt-get install -y nodejs | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: ROS 2 workspace cache | |
| uses: actions/cache@v4 | |
| id: cache-ros2-build | |
| with: | |
| path: | | |
| install/ | |
| build/ | |
| key: ros2-build-${{ runner.os }}-${{ hashFiles( | |
| 'pyproject.toml', | |
| 'src/**/package.xml', | |
| 'src/**/CMakeLists.txt', | |
| 'src/**/*.py', | |
| 'src/simulator/**/*.xml' | |
| ) }} | |
| restore-keys: | | |
| ros2-build-${{ runner.os }}- | |
| # install Pixi, which is our project and environment management tool. | |
| # | |
| # this is a little slow... but if you think it's really bad, take a look | |
| # at how long `rosdep` usually takes 😭😭 | |
| - name: Install Pixi | |
| uses: prefix-dev/setup-pixi@v0.9.0 | |
| with: | |
| pixi-version: v0.49.0 | |
| cache: true | |
| # build the entire ROS 2 workspace just to ensure things work. | |
| # | |
| # this'll use colcon | |
| - name: Build ROS 2 workspace | |
| if: steps.cache-ros2-build.outputs.cache-hit != 'true' | |
| run: | | |
| eval "$(pixi shell-hook)" | |
| just build | |
| # save the completed workspace build before doing any typecks. | |
| # | |
| # otherwise, we might waste a lot of time rebuilding everything when | |
| # someone troubleshoots type problems in their Python | |
| - name: Save ROS 2 workspace before typeck | |
| id: ros2-workspace-build-save | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| install/ | |
| build/ | |
| key: ros2-build-${{ runner.os }}-${{ hashFiles( | |
| 'pyproject.toml', | |
| 'src/**/package.xml', | |
| 'src/**/CMakeLists.txt', | |
| 'src/**/*.py', | |
| 'src/simulator/**/*.xml' | |
| ) }} | |
| restore-keys: | | |
| ros2-build-${{ runner.os }}- | |
| # type check everything. | |
| # | |
| # note that, for typecking to succeed, we need to already have built the | |
| # ROS 2 workspace. (otherwise, we're going to be missing | |
| # `custom_interfaces` types!) | |
| # | |
| # so, this `basedpyright` step is put here instead of under the `python` | |
| # job, even though it would probably feel better there instead. | |
| - name: Typeck with `basedpyright` (Python) | |
| shell: bash | |
| run: | | |
| eval "$(pixi shell-hook)" | |
| . install/local_setup.bash | |
| basedpyright src/ | |
| # cache Rust workspace to speed up Rust stuff | |
| - name: Rust workspace cache (for `rustfmt` and Clippy) | |
| uses: actions/cache@v4 | |
| id: cache-rust-checks | |
| with: | |
| path: | | |
| target/ | |
| key: cache-rust-checks-${{ runner.os }}-${{ hashFiles( | |
| 'Cargo.lock', | |
| 'src/**/*.rs', | |
| 'src/**/Cargo.toml' | |
| ) }} | |
| restore-keys: | | |
| cache-rust-checks-${{ runner.os }}- | |
| # run rust lints | |
| - name: Lint with Clippy (Rust) | |
| run: | | |
| eval "$(pixi shell-hook)" | |
| cargo clippy --workspace | |
| # run the formatter | |
| - name: Format with `rustfmt` (Rust) | |
| run: | | |
| eval "$(pixi shell-hook)" | |
| cargo fmt --check | |
| - name: Run ROS 2 tests | |
| shell: bash | |
| run: | | |
| eval "$(pixi shell-hook)" | |
| . install/local_setup.bash | |
| just test | |
| # Ensures that our Python code is properly formatted and contains no common | |
| # errors. | |
| # | |
| # These scans are done by a linting tool called `ruff`. | |
| python: | |
| runs-on: ubuntu-22.04-arm | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # install node real quick | |
| - name: Workaround for Act runner | |
| if: ${{ env.ACT }} | |
| run: apt-get update && apt-get install curl -y && curl -fsSL https://deb.nodesource.com/setup_24.x | bash && apt-get update && apt-get install -y nodejs | |
| # install Pixi | |
| - name: Install Pixi | |
| uses: prefix-dev/setup-pixi@v0.9.0 | |
| with: | |
| pixi-version: v0.49.0 | |
| cache: true | |
| # check python lints | |
| - name: Lint (Python) | |
| run: pixi run ruff check | |
| # check formatting | |
| - name: Format with Ruff (Python) | |
| run: pixi run ruff format --check |