Make sure robot.cancel_actions will return #1513
Workflow file for this run
This file contains 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 | |
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 * * *' | |
# Allow tests to be run manually | |
workflow_dispatch: | |
# Ensures that only one workflow runs at a time for this branch | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Build and test the base, non-ROS image | |
python-test: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: docker-container | |
# These steps run if not using a fork | |
- name: Login to Docker Hub Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PAT }} | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
- name: Build Docker image (with cache) | |
uses: docker/build-push-action@v5 | |
with: | |
file: docker/Dockerfile | |
target: pyrobosim | |
context: . | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/pyrobosim:base | |
push: true | |
cache-from: | | |
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/pyrobosim:buildcache-base | |
cache-to: | | |
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/pyrobosim:buildcache-base,mode=max | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
- name: Run tests (from pushed image) | |
run: | | |
docker run \ | |
-w /opt/pyrobosim \ | |
--volume ./test/results:/opt/pyrobosim/test/results:rw \ | |
${{ secrets.DOCKERHUB_USERNAME }}/pyrobosim:base \ | |
/bin/bash -c 'PYTHONPATH=/opt/pyrobosim/dependencies/pddlstream:${PYTHONPATH} ./test/run_tests.bash' | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
- name: Pytest coverage comment | |
id: coverageComment | |
uses: MishaKav/pytest-coverage-comment@main | |
with: | |
pytest-coverage-path: ./test/results/pytest-coverage.txt | |
junitxml-path: ./test/results/test_results.xml | |
pytest-xml-coverage-path: ./test/results/test_results_coverage.xml | |
coverage-path-prefix: pyrobosim/pyrobosim/ | |
# This will break on PRs from forks | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
# These steps run from a fork | |
- name: Build Docker image (no push) | |
uses: docker/build-push-action@v5 | |
with: | |
file: docker/Dockerfile | |
target: pyrobosim | |
context: . | |
tags: pyrobosim:base | |
push: false | |
cache-from: | | |
type=registry,ref=iridiumxi/pyrobosim:buildcache-base | |
outputs: type=docker,dest=./pyrobosim_base.tar | |
if: ${{ github.event.pull_request.head.repo.fork }} | |
- name: Run tests (from loaded image) | |
run: | | |
docker load --input ./pyrobosim_base.tar | |
docker run \ | |
-w /opt/pyrobosim \ | |
--volume ./test/results:/opt/pyrobosim/test/results:rw \ | |
pyrobosim:base \ | |
/bin/bash -c 'PYTHONPATH=./dependencies/pddlstream:${PYTHONPATH} ./test/run_tests.bash' | |
if: ${{ github.event.pull_request.head.repo.fork }} | |
- name: Create coverage badge | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.COVERAGE_GIST_SECRET }} | |
# This comes from https://gist.github.com/sea-bass/3761a8aa05af7b0e8c84210b9d103df8#file-pyrobosim-test-coverage-json | |
gistID: 3761a8aa05af7b0e8c84210b9d103df8 | |
filename: pyrobosim-test-coverage.json | |
label: coverage | |
message: ${{ steps.coverageComment.outputs.coverage }} | |
color: ${{ steps.coverageComment.outputs.color }} | |
namedLogo: python | |
# Only update this badge on main | |
if: github.ref == 'refs/heads/main' | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: test/results/ | |
# Always publish test results even when there are failures. | |
if: ${{ always() }} | |
# Build and test with ROS 2 | |
ros2-test: | |
strategy: | |
matrix: | |
ros_distro: [humble, jazzy, rolling] | |
name: ros-${{ matrix.ros_distro }}-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: docker-container | |
# These steps run if not using a fork | |
- name: Login to Docker Hub Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PAT }} | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
- name: Build Docker image (with cache) | |
uses: docker/build-push-action@v5 | |
with: | |
file: docker/Dockerfile | |
target: pyrobosim_ros | |
context: . | |
build-args: | | |
ROS_DISTRO=${{ matrix.ros_distro }} | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/pyrobosim:${{ matrix.ros_distro }} | |
push: true | |
cache-from: | | |
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/pyrobosim:buildcache-${{ matrix.ros_distro }} | |
cache-to: | | |
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/pyrobosim:buildcache-${{ matrix.ros_distro }},mode=max | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
- name: Run tests (from pushed image) | |
run: | | |
docker run \ | |
--volume ./test/:/pyrobosim_ws/src/test/:rw \ | |
--volume ./pytest.ini:/pyrobosim_ws/pytest.ini:rw \ | |
${{ secrets.DOCKERHUB_USERNAME }}/pyrobosim:${{ matrix.ros_distro }} \ | |
/bin/bash -c './src/test/run_tests.bash ${{ matrix.ros_distro }}' | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
# These steps run from a fork | |
- name: Build Docker image (no push) | |
uses: docker/build-push-action@v5 | |
with: | |
file: docker/Dockerfile | |
target: pyrobosim_ros | |
context: . | |
build-args: | | |
ROS_DISTRO=${{ matrix.ros_distro }} | |
tags: pyrobosim:${{ matrix.ros_distro }} | |
push: false | |
cache-from: | | |
type=registry,ref=iridiumxi/pyrobosim:buildcache-${{ matrix.ros_distro }} | |
outputs: type=docker,dest=./pyrobosim_${{ matrix.ros_distro }}.tar | |
if: ${{ github.event.pull_request.head.repo.fork }} | |
- name: Run tests (from loaded image) | |
run: | | |
docker load --input ./pyrobosim_${{ matrix.ros_distro }}.tar | |
docker run \ | |
--volume ./test/:/pyrobosim_ws/test/:rw \ | |
--volume ./pytest.ini:/pyrobosim_ws/pytest.ini:rw \ | |
pyrobosim:${{ matrix.ros_distro }} \ | |
/bin/bash -c './src/test/run_tests.bash ${{ matrix.ros_distro }}' | |
if: ${{ github.event.pull_request.head.repo.fork }} | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-${{ matrix.ros_distro }} | |
path: test/results/ | |
# Always publish test results even when there are failures. | |
if: ${{ always() }} |