README with instructions for occupancy grid #42
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: test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
# We only need to test on one OS as we are using Docker | |
runs-on: ubuntu-latest | |
env: | |
# Running as root removes permission errors when running github workflow | |
DOCKER_BASE_CMD: docker compose run --rm --user root | |
COVERAGE_VOLUME: ${{ github.workspace }}/coverage:/usr/app/coverage | |
steps: | |
# Checkout code | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Build Docker image | |
- name: Build Docker image | |
run: docker build -t autobike --no-cache . | |
# Build ROS project | |
- name: Build ROS project | |
if: success() | |
run: ${{ env.DOCKER_BASE_CMD }} autobike bash -ic "build" | |
# Run test ROS package | |
- name: Run ROS package | |
if: success() | |
run: ${{ env.DOCKER_BASE_CMD }} autobike bash -ic "build && ros2 run waypoints once" | |
# Run Black formatting check | |
- name: Black formatting check | |
if: success() || failure() | |
run: ${{ env.DOCKER_BASE_CMD }} autobike bash -ic "format_check" | |
# Run Pylint linting | |
- name: Pylint linting | |
# always() runs even if the job is canceled, while success() || failure() does not | |
if: success() || failure() | |
run: ${{ env.DOCKER_BASE_CMD }} autobike bash -ic "lint" | |
# Run Pytest with code coverage | |
- name: Pytest with code coverage | |
if: success() || failure() | |
# Specify coverage volume | |
run: ${{ env.DOCKER_BASE_CMD }} -v ${{ env.COVERAGE_VOLUME }} autobike bash -ic "build && pytest --cov=./ --cov-report=xml:./coverage/coverage.xml --cov-report=term" | |
# Run mypy type checking | |
- name: Mypy type check | |
if: success() || failure() | |
run: ${{ env.DOCKER_BASE_CMD }} autobike bash -ic "type_check" | |
# Upload to codecov | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
if: success() | |
with: | |
# Coverage is saved here via the volume | |
files: ./coverage/coverage.xml | |
fail_ci_if_error: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |