build_and_test #1705
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: build_and_test | |
| on: | |
| # Run action on certain pull request events | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| # Nightly job on default (main) branch | |
| schedule: | |
| - cron: '0 0 * * *' | |
| # Whenever certain branches are pushed | |
| push: | |
| branches: [main] | |
| # On demand from github.com for testing | |
| workflow_dispatch: | |
| # Ensures that only one workflow runs at a time for this branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| ubuntu_build_and_test: | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ubuntu_version: [22.04, 24.04, 26.04] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Sanitize tag name | |
| id: sanitize_tag | |
| run: | | |
| BRANCH="${{ github.head_ref || github.ref_name }}" | |
| TAG="${BRANCH//\//-}" | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: .docker/ubuntu/Dockerfile | |
| tags: roboplan_ubuntu:${{ steps.sanitize_tag.outputs.tag }} | |
| build-args: | | |
| UBUNTU_VERSION=${{ matrix.ubuntu_version }} | |
| push: false | |
| load: true | |
| cache-from: type=gha,scope=ubuntu-${{ matrix.ubuntu_version }} | |
| cache-to: type=gha,mode=max,scope=ubuntu-${{ matrix.ubuntu_version }} | |
| - name: Run tests | |
| run: | | |
| docker run --rm \ | |
| roboplan_ubuntu:${{ steps.sanitize_tag.outputs.tag }} \ | |
| /bin/bash -c './scripts/run_tests.bash' | |
| # Build ROS docker images and run tests. | |
| ros_build_and_test: | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ros_distro: [humble, jazzy, kilted, lyrical, rolling] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Sanitize tag name | |
| id: sanitize_tag | |
| run: | | |
| BRANCH="${{ github.head_ref || github.ref_name }}" | |
| TAG="${BRANCH//\//-}" | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: .docker/ros/Dockerfile | |
| tags: roboplan_ros:${{ steps.sanitize_tag.outputs.tag }} | |
| build-args: | | |
| ROS_DISTRO=${{ matrix.ros_distro }} | |
| GENERATE_PYTHON_STUBS=${{ matrix.ros_distro == 'humble' && 'OFF' || 'ON' }} | |
| push: false | |
| load: true | |
| cache-from: type=gha,scope=ros-${{ matrix.ros_distro }} | |
| cache-to: type=gha,mode=max,scope=ros-${{ matrix.ros_distro }} | |
| - name: Run tests | |
| run: | | |
| docker run --rm \ | |
| roboplan_ros:${{ steps.sanitize_tag.outputs.tag }} \ | |
| /bin/bash -c './src/roboplan/scripts/run_tests.bash' | |
| pixi_build_and_test: | |
| timeout-minutes: 30 | |
| env: | |
| SCCACHE_DIR: ${{ github.workspace }}/.sccache | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-22.04 | |
| cache-key: ubuntu-22.04 | |
| - os: ubuntu-24.04 | |
| cache-key: ubuntu-24.04 | |
| - os: ubuntu-26.04 | |
| cache-key: ubuntu-26.04 | |
| - os: macos-14 | |
| cache-key: macos-arm64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Cache sccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.SCCACHE_DIR }} | |
| key: ${{ matrix.cache-key }}-sccache-${{ github.head_ref || github.ref_name }} | |
| restore-keys: | | |
| ${{ matrix.cache-key }}-sccache-main | |
| ${{ matrix.cache-key }}-sccache | |
| - uses: prefix-dev/setup-pixi@v0.8.14 | |
| with: | |
| cache: true | |
| cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
| frozen: true | |
| manifest-path: pixi.toml | |
| - name: Build and test | |
| run: | | |
| pixi run -e ci install_all | |
| pixi run -e ci build_tests | |
| pixi run -e ci test_all | |
| - name: Check bindings stub files | |
| run: | | |
| if ! git diff --exit-code --shortstat -- '*.pyi'; then | |
| echo "::error::The .pyi stub files are out of sync with the source code. Make sure to rebuild the Python bindings without symlink builds using 'pixi run -e ci install_all' and commit the changes." | |
| echo "Git Diff:" | |
| git diff -- '*.pyi' | |
| exit 1 | |
| fi | |
| echo "✅ .pyi stub files look good!" | |
| - name: Run clang-tidy | |
| if: matrix.os == 'ubuntu-26.04' | |
| run: | | |
| pixi run -e ci clang-tidy | |
| # TODO: Decide on a method for automated benchmark performance testing. | |
| # TODO: These are currently running in debug mode due to `-e ci`. We should fix this. | |
| - name: Run benchmarks | |
| if: matrix.os != 'ubuntu-26.04' # Just to not share time with clang-tidy | |
| run: | | |
| pixi run -e ci test_benchmarks |