Skip to content

Merge pull request #142 from jonathanstelman/feature/132-drop-unused-… #227

Merge pull request #142 from jonathanstelman/feature/132-drop-unused-…

Merge pull request #142 from jonathanstelman/feature/132-drop-unused-… #227

Workflow file for this run

name: CI
on:
push:
branches: [ main, 'feature/**' ]
pull_request:
branches: [ main ]
jobs:
format:
name: Format (Black)
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Install dependencies
run: poetry install --no-interaction
- name: Check formatting
run: poetry run black --check .
test:
name: Test suite
runs-on: ubuntu-latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
strategy:
matrix:
python-version: ['3.12']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock','**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache Poetry
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Install dependencies
run: poetry install --no-interaction
- name: Run tests and generate reports
env:
CI: true
run: |
mkdir -p reports
poetry run pytest --junitxml=reports/junit.xml --cov=pipeline --cov-report=xml:reports/coverage.xml -q
- name: Upload test report to GitHub checks
uses: dorny/test-reporter@v2
with:
name: unit tests
path: reports/junit.xml
reporter: python-xunit
fail-on-error: false
- name: Upload test artifacts
uses: actions/upload-artifact@v4
with:
name: test-reports
path: reports/
- name: Upload coverage to Codecov (optional if CODECOV_TOKEN is set)
if: ${{ env.CODECOV_TOKEN != '' }}
uses: codecov/codecov-action@v4
with:
files: reports/coverage.xml
fail_ci_if_error: false
test-backend:
name: Backend test suite
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Install dependencies
working-directory: backend
run: poetry install --no-interaction
- name: Run backend tests
working-directory: backend
run: poetry run pytest tests/ -q