Skip to content

tests

tests #659

Workflow file for this run

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 * * *'
# Ensures that only one workflow runs at a time for this branch
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
# Pure Python testing
python-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install -e pyrobosim
pip3 install -r test/python_test_requirements.txt
setup/setup_pddlstream.bash
- name: Run unit tests
run: |
export PYTHONPATH=./dependencies/pddlstream:$PYTHONPATH
test/run_tests.bash
- name: Pytest coverage comment
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/
- name: Upload test results
uses: actions/upload-artifact@v3
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, iron, rolling]
name: ros-${{ matrix.ros_distro }}-test
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
- name: Build Docker image
uses: docker/build-push-action@v5
with:
file: docker/Dockerfile
context: .
build-args: |
ROS_DISTRO=${{ matrix.ros_distro }}
tags: pyrobosim:${{ matrix.ros_distro }}
- name: Run tests
run: |
docker run \
--volume ./test/:/pyrobosim_ws/test/:rw \
--volume ./pytest.ini:/pyrobosim_ws/pytest.ini:rw \
pyrobosim:${{ matrix.ros_distro }} \
/bin/bash -c './test/run_tests.bash'
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.ros_distro }}
path: test/results/
# Always publish test results even when there are failures.
if: ${{ always() }}