Add unit tests #467
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 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.12] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Lint | |
uses: astral-sh/ruff-action@v3 | |
with: | |
# if files would be reformatted: print the diff between the current file and | |
# the re-formatted file, then exit with non-zero status code (which should fail the build step) | |
args: 'format --diff' | |
- name: Install uv | |
run: pip3 install uv | |
- name: Bring up postgres container | |
run: docker compose -f compose.yaml up -d --wait postgres | |
- name: Run type checking | |
run: uv run mypy . | |
- name: Run tests | |
run: uv run pytest --cov-branch --cov-report=xml | |
env: | |
AIRFLOW_VAR_DIMENSIONS_API_USER: ${{ secrets.AIRFLOW_VAR_DIMENSIONS_API_USER }} | |
AIRFLOW_VAR_DIMENSIONS_API_PASS: ${{ secrets.AIRFLOW_VAR_DIMENSIONS_API_PASS }} | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: sul-dlss/rialto-airflow |