| 1 |
# This workflow will install Python dependencies, run tests and lint |
| 2 |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 3 |
|
| 4 |
name: Test |
| 5 |
|
| 6 |
on: |
| 7 |
push: |
| 8 |
branches: [main] |
| 9 |
pull_request: |
| 10 |
branches: [main] |
| 11 |
|
| 12 |
jobs: |
| 13 |
pre-commit: |
| 14 |
runs-on: ubuntu-latest |
| 15 |
steps: |
| 16 |
- name: Check out the repository |
| 17 |
uses: actions/[email protected] |
| 18 |
|
| 19 |
- name: Set up Python 3.14 |
| 20 |
uses: actions/[email protected] |
| 21 |
with: |
| 22 |
python-version: "3.14" |
| 23 |
|
| 24 |
- name: Install dependencies |
| 25 |
run: | |
| 26 |
python -m venv venv |
| 27 |
. venv/bin/activate |
| 28 |
python --version |
| 29 |
pip install uv |
| 30 |
uv pip install -r requirements_dev.txt -e . |
| 31 |
|
| 32 |
- name: Run pre-commit |
| 33 |
run: | |
| 34 |
. venv/bin/activate |
| 35 |
pre-commit run --all-files --show-diff-on-failure |
| 36 |
|
| 37 |
pytest: |
| 38 |
name: pytest ${{ matrix.python-version }} |
| 39 |
runs-on: ubuntu-latest |
| 40 |
needs: pre-commit |
| 41 |
strategy: |
| 42 |
fail-fast: false |
| 43 |
matrix: |
| 44 |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] |
| 45 |
|
| 46 |
steps: |
| 47 |
- name: Check out the repository |
| 48 |
uses: actions/[email protected] |
| 49 |
|
| 50 |
- name: Set up Python ${{ matrix.python-version }} |
| 51 |
uses: actions/[email protected] |
| 52 |
with: |
| 53 |
python-version: ${{ matrix.python-version }} |
| 54 |
|
| 55 |
- name: Install dependencies |
| 56 |
run: | |
| 57 |
python -m venv venv |
| 58 |
. venv/bin/activate |
| 59 |
python --version |
| 60 |
pip install uv |
| 61 |
uv pip install -r requirements_dev.txt -e . |
| 62 |
|
| 63 |
- name: Run tests |
| 64 |
run: | |
| 65 |
. venv/bin/activate |
| 66 |
pytest tests --cov=aiopegelonline --cov-report=xml |
| 67 |
|
| 68 |
codecov: |
| 69 |
name: codecov |
| 70 |
runs-on: ubuntu-latest |
| 71 |
needs: pytest |
| 72 |
|
| 73 |
steps: |
| 74 |
- name: Check out the repository |
| 75 |
uses: actions/[email protected] |
| 76 |
|
| 77 |
- name: Set up Python 3.14 |
| 78 |
uses: actions/[email protected] |
| 79 |
with: |
| 80 |
python-version: "3.14" |
| 81 |
|
| 82 |
- name: Install dependencies |
| 83 |
run: | |
| 84 |
python -m venv venv |
| 85 |
. venv/bin/activate |
| 86 |
python --version |
| 87 |
pip install uv |
| 88 |
uv pip install -r requirements_dev.txt -e . |
| 89 |
|
| 90 |
- name: Run tests |
| 91 |
run: | |
| 92 |
. venv/bin/activate |
| 93 |
pytest tests --cov=aiopegelonline --cov-report=xml |
| 94 |
|
| 95 |
- name: Upload coverage reports to Codecov |
| 96 |
uses: codecov/codecov-action@v6 |
| 97 |
env: |
| 98 |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |