Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 38 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

jobs:
test:
name: Lint • Type Check • Test (Python ${{ matrix.python-version }})
name: Lint • Type Check • Test • Coverage (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -52,13 +52,13 @@ jobs:
path: .venv
key: v1-poetry-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install deps (with dev group)
- name: Install dependencies (with dev group)
if: steps.cache.outputs.cache-hit != 'true'
run: |
poetry env use "${{ steps.py.outputs.python-path }}"
poetry install --no-interaction --no-ansi --with dev

- name: Sync deps (cache hit)
- name: Sync dependencies (cache hit)
if: steps.cache.outputs.cache-hit == 'true'
run: |
poetry env use "${{ steps.py.outputs.python-path }}"
Expand All @@ -76,12 +76,42 @@ jobs:
poetry run ruff format --check .
poetry run ruff check .

- name: Mypy (install types if missing, then type check)
- name: Mypy (type check)
run: |
# Auto-install missing type stubs in CI (non-interactive)
poetry run mypy --install-types --non-interactive || true
poetry run mypy src/ tests/ --ignore-missing-imports --disable-error-code=call-overload
poetry run mypy src/ tests/ --ignore-missing-imports --disable-error-code=call-overload

- name: Pytest (coverage gate)
- name: Pytest (with coverage)
run: |
poetry run pytest -q --cov=change_me --cov-report=term-missing --cov-fail-under=85
poetry run pytest -q --cov=change_me --cov-report=term-missing --cov-report=xml --cov-fail-under=85

- name: Upload coverage to Coveralls
if: ${{ matrix.python-version == '3.12' }}
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage.xml

docker:
name: Build & Push Docker Image
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:latest
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Coverage Status](https://coveralls.io/repos/github/TUM-Aries-Lab/template-python/badge.svg?branch=main)](https://coveralls.io/github/TUM-Aries-Lab/template-python?branch=main)
![Docker Image CI](https://github.com/TUM-Aries-Lab/template-python/actions/workflows/ci.yml/badge.svg)

# template-python
Simple README.md for a Python project template.

Expand Down
Loading