Skip to content

build_and_test

build_and_test #1004

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]
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, 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 }}
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:
ubuntu_version: [22.04, 24.04]
runs-on: ubuntu-${{ matrix.ubuntu_version }}
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: true
# Cache build directories and sccache
- name: Cache build directories and sccache
uses: actions/cache@v4
with:
path: ${{ env.SCCACHE_DIR }}
key: ${{ runner.os }}-${{ matrix.ubuntu_version }}-sccache-${{ github.head_ref || github.ref_name }}
restore-keys: |
${{ runner.os }}-${{ matrix.ubuntu_version }}-sccache-main
${{ runner.os }}-${{ matrix.ubuntu_version }}-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 install_all
pixi run build_tests
pixi run test_all
# TODO: Decide on a method for automated benchmark performance testing.
- name: Run benchmarks
run: |
pixi run test_benchmarks