Test Python tools #274
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
# | |
# This workflow is run for pull requests the modify the `tools` directory | |
# and runs tests for the Python scripts in that directory | |
# | |
name: "Test Python tools" | |
on: | |
workflow_dispatch: # manual trigger for debugging | |
push: | |
paths: | |
- 'tools/*' | |
branches: | |
- main | |
pull_request: | |
paths: | |
- 'tools/*' | |
jobs: | |
py39: | |
name: "Run tests" | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
python -m pip install -r tools/requirements.txt | |
python -m pip install pytest mock black isort | |
- name: Check code formatting | |
run: python -m black --check --diff tools | |
- name: Check imports | |
run: python -m isort --check --profile black tools | |
- name: Validate types | |
run: python -m mypy --disallow-untyped-calls --disallow-untyped-defs tools/*.py | |
- name: Run tests | |
run: python -m pytest tools/tests/test*.py -vv |