Modernize installation, CI config and linting tools #50
Workflow file for this run
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: Continuous Integration | |
on: | |
schedule: | |
- cron: '0 0 * * 3' | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
paths: | |
- .github/workflows/ci.yml | |
- pyclibrary/* | |
- tests/* | |
- setup.py | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.12'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: 'lint_requirements.txt' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install project | |
run: | | |
pip install -e . | |
- name: Install dependencies | |
run: | | |
pip install -U -r lint_requirements.txt | |
- name: Formatting | |
if: always() | |
run: | | |
ruff format pyclibrary tests --check | |
- name: Linting | |
if: always() | |
run: | | |
ruff check pyclibrary tests | |
- name: Typing | |
if: always() | |
run: | | |
mypy pyclibrary | |
tests: | |
name: Unit tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ['3.10', '3.11', '3.12', '3.13'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install project with the latest dependency versions | |
run: | | |
pip install --upgrade --upgrade-strategy eager -e . | |
- name: Test with pytest | |
run: | | |
pip install pytest-cov | |
python -m pytest tests --cov pyclibrary --cov-report xml -v | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: true | |
- name: Test with the oldest supported dependency versions | |
run: | | |
pip install pyparsing==2.3.1 | |
python -m pytest tests |