Skip to content

style: format code and add codecov token #7

style: format code and add codecov token

style: format code and add codecov token #7

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
jobs:
test:
name: python
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v4
- name: Install UV
uses: astral-sh/setup-uv@v3
- name: Install UV
uses: astral-sh/setup-uv@v3
with:
version: "0.4.30"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up Python
uses: actions/setup-python@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-extras --dev
env:
UV_SYSTEM_PYTHON: 1
- name: Run tests with coverage
run: |
source .venv/bin/activate
source .venv/bin/activate
pytest --cov=bydefault --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
name: codecov-umbrella
verbose: true
lint:
name: python-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install UV
uses: astral-sh/setup-uv@v3
with:
version: "0.4.30"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install UV
uses: astral-sh/setup-uv@v3
with:
version: "0.4.30"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install dependencies
run: uv sync --all-extras --dev
env:
UV_SYSTEM_PYTHON: 1
- name: Format and lint with Ruff
run: |
source .venv/bin/activate
ruff format .
ruff check .
ruff format --check .
- name: Commit formatting changes
if: github.event_name == 'pull_request'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "style: auto-format with ruff" || true
git push
pr-checks:
name: pr-validation
needs: [test, lint]
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install UV
uses: astral-sh/setup-uv@v3
with:
version: "0.4.30"
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install UV
uses: astral-sh/setup-uv@v3
with:
version: "0.4.30"
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Check branch is up to date with main
run: |
git fetch origin main
git merge-base --is-ancestor origin/main ${{ github.event.pull_request.head.sha }}
continue-on-error: true