Skip to content

tests

tests #438

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 * * *'
# 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:
test:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install -e .
pip3 install -r test/test_requirements.txt
- name: Run unit tests
run: test/run_tests.bash
- 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: src/
# This will break on PRs from forks
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/e5e091166a18c68b26338793917d3bab#file-pyroboplan-test-coverage-json
gistID: e5e091166a18c68b26338793917d3bab
filename: pyroboplan-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() }}