Skip to content

Updating tests to pass CI/CD checks (bullet points causing issues #22

Updating tests to pass CI/CD checks (bullet points causing issues

Updating tests to pass CI/CD checks (bullet points causing issues #22

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
with:
version: "0.5.1"
enable-cache: true
cache-dependency-glob: "uv.lock"
- 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
pytest --cov=bydefault --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false
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.5.1"
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.5.1"
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