Skip to content

chore: Update CI/CD cache keys to use pyproject.toml #88

chore: Update CI/CD cache keys to use pyproject.toml

chore: Update CI/CD cache keys to use pyproject.toml #88

Workflow file for this run

# .github/workflows/ci.yml
name: TreeMapper CI
permissions:
contents: read
on:
pull_request:
branches: [ '**' ]
push:
branches:
- main
jobs:
lint-type-check:
name: Lint & Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip Dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-lint-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-lint-pip-
- name: Install Linters and Type Checker
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Run Linters and Formatters Check
run: |
flake8 src tests
black --check src tests
- name: Run Type Checker (Mypy)
run: |
mypy src tests
test:
needs: lint-type-check
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, ubuntu-24.04, macos-latest, windows-latest ]
python-version: [ 3.9, '3.10', '3.11', '3.12' ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip Dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Run Tests with Coverage
run: |
pytest -v --cov=src/treemapper --cov-report=xml
- name: Upload coverage reports to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
fail_ci_if_error: true
verbose: true
test-pypy:
needs: lint-type-check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ pypy-3.9, pypy-3.10 ]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up PyPy ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip Dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pypy-${{ matrix.python-version }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
pypy-${{ matrix.python-version }}-pip-
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Run Tests
run: |
pytest -v