Skip to content

Modernize to Python 3 and upgrade project infrastructure #4

Modernize to Python 3 and upgrade project infrastructure

Modernize to Python 3 and upgrade project infrastructure #4

Workflow file for this run

name: CI
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set up UV cache
uses: actions/cache@v4
with:
path: .venv
key: uv-${{ runner.os }}-lint-${{ hashFiles('pyproject.toml', 'requirements.txt') }}
restore-keys: |
uv-${{ runner.os }}-lint-
- name: Create virtual environment
run: uv venv || true
- name: Install dependencies
run: uv pip install -e ".[dev]"
- name: Run ruff
run: uv run ruff check .
- name: Run mypy
run: uv run mypy jsoncsv
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set up UV cache
uses: actions/cache@v4
with:
path: .venv
key: uv-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt') }}
restore-keys: |
uv-${{ runner.os }}-py${{ matrix.python-version }}-
- name: Create virtual environment
run: uv venv || true
- name: Install dependencies
run: uv pip install -e ".[dev]"
- name: Run tests
run: uv run pytest --cov=jsoncsv --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
build:
name: Build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set up UV cache
uses: actions/cache@v4
with:
path: .venv
key: uv-${{ runner.os }}-build-${{ hashFiles('pyproject.toml') }}
restore-keys: |
uv-${{ runner.os }}-build-
- name: Create virtual environment
run: uv venv || true
- name: Build package
run: |
uv pip install build twine
uv run python -m build
- name: Check package
run: uv run twine check dist/*