Skip to content

feat: transition to uv and copier #721

feat: transition to uv and copier

feat: transition to uv and copier #721

Workflow file for this run

name: Test
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
project-type: ["app", "package"]
typing: ["optional", "strict"]
name: Python ${{ matrix.python-version }} ${{ matrix.project-type }} with ${{ matrix.typing }} typing
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: uv-copier-template
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "**/uv.lock"
- name: Scaffold Python project
run: |
uvx copier copy uv-copier-template my-project \
--defaults \
--data project_type="${{ matrix.project-type }}" \
--data project_name="My Project" \
--data project_description="A Python ${{ matrix.project-type }} that reticulates splines." \
--data project_url="https://github.com/user/repo" \
--data author_name="John Smith" \
--data author_email="[email protected]" \
--data python_version="3.10" \
--data typing="${{ matrix.typing }}" \
--data with_fastapi_api=true \
--data with_typer_cli=true
cd my-project
git config --global init.defaultBranch main
git init
git checkout -b test
git add .
- name: Lint and test project
uses: devcontainers/[email protected]
with:
subFolder: ./my-project/
runCmd: |
uv lock
poe lint
poe test
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: Build app Docker image
if: ${{ matrix.project-type == 'app' }}
uses: docker/build-push-action@v6
with:
context: ./my-project/
target: app
env:
PYTHON_VERSION: ${{ matrix.python-version }}