Skip to content

fix: resolve 5 template bugs blocking v1.0.0 tag #25

fix: resolve 5 template bugs blocking v1.0.0 tag

fix: resolve 5 template bugs blocking v1.0.0 tag #25

name: Validate Template
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
validate-standard:
name: Validate (standard defaults)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
with:
version: "0.11.3"
python-version: "3.12"
- name: Configure git
run: |
git config --global user.name "CI"
git config --global user.email "ci@test.com"
- name: Render template (standard)
run: |
TEMPLATE_DIR=$(mktemp -d)
git archive HEAD | tar -C "$TEMPLATE_DIR" -xf -
uvx copier copy "$TEMPLATE_DIR" /tmp/rendered-project \
--trust \
--defaults \
--overwrite \
--data project_name=my-test-project \
--data description="A test project" \
--data author_name="Test Author" \
--data author_email="test@example.com" \
--data github_user=test-user
- name: Lint
working-directory: /tmp/rendered-project
run: |
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
- name: Type check
working-directory: /tmp/rendered-project
run: uv run mypy src/
- name: Test
working-directory: /tmp/rendered-project
run: uv run pytest -v --cov=src --cov-report=xml
- name: Audit
working-directory: /tmp/rendered-project
run: uv run pip-audit
validate-minimal:
name: Validate (minimal)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
with:
version: "0.11.3"
python-version: "3.12"
- name: Configure git
run: |
git config --global user.name "CI"
git config --global user.email "ci@test.com"
- name: Render template (minimal)
run: |
TEMPLATE_DIR=$(mktemp -d)
git archive HEAD | tar -C "$TEMPLATE_DIR" -xf -
uvx copier copy "$TEMPLATE_DIR" /tmp/rendered-minimal \
--trust \
--defaults \
--overwrite \
--data project_name=minimal-project \
--data description="A minimal project" \
--data author_name="Test Author" \
--data author_email="test@example.com" \
--data github_user=test-user \
--data ci_github=false \
--data security=none \
--data use_docker=none \
--data use_docs=false \
--data testing=minimal \
--data use_ml=false \
--data use_typecheck=false \
--data use_devcontainer=false
- name: Lint
working-directory: /tmp/rendered-minimal
run: |
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
- name: Test
working-directory: /tmp/rendered-minimal
run: uv run pytest -v
validate-cli:
name: Validate (use_cli)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
with:
version: "0.11.3"
python-version: "3.12"
- name: Configure git
run: |
git config --global user.name "CI"
git config --global user.email "ci@test.com"
- name: Render template (cli)
run: |
TEMPLATE_DIR=$(mktemp -d)
git archive HEAD | tar -C "$TEMPLATE_DIR" -xf -
uvx copier copy "$TEMPLATE_DIR" /tmp/rendered-cli \
--trust \
--defaults \
--overwrite \
--data project_name=cli-project \
--data description="A CLI project" \
--data author_name="Test Author" \
--data author_email="test@example.com" \
--data github_user=test-user \
--data use_cli=true
- name: Lint
working-directory: /tmp/rendered-cli
run: |
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
- name: Type check
working-directory: /tmp/rendered-cli
run: uv run mypy src/
- name: Test
working-directory: /tmp/rendered-cli
run: uv run pytest -v
validate-api:
name: Validate (use_api)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
with:
version: "0.11.3"
python-version: "3.12"
- name: Configure git
run: |
git config --global user.name "CI"
git config --global user.email "ci@test.com"
- name: Render template (api)
run: |
TEMPLATE_DIR=$(mktemp -d)
git archive HEAD | tar -C "$TEMPLATE_DIR" -xf -
uvx copier copy "$TEMPLATE_DIR" /tmp/rendered-api \
--trust \
--defaults \
--overwrite \
--data project_name=api-project \
--data description="An API project" \
--data author_name="Test Author" \
--data author_email="test@example.com" \
--data github_user=test-user \
--data use_api=true
- name: Lint
working-directory: /tmp/rendered-api
run: |
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
- name: Type check
working-directory: /tmp/rendered-api
run: uv run mypy src/
- name: Test
working-directory: /tmp/rendered-api
run: uv run pytest -v --cov=src --cov-report=xml
validate-db:
name: Validate (use_db)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
with:
version: "0.11.3"
python-version: "3.12"
- name: Configure git
run: |
git config --global user.name "CI"
git config --global user.email "ci@test.com"
- name: Render template (db)
run: |
TEMPLATE_DIR=$(mktemp -d)
git archive HEAD | tar -C "$TEMPLATE_DIR" -xf -
uvx copier copy "$TEMPLATE_DIR" /tmp/rendered-db \
--trust \
--defaults \
--overwrite \
--data project_name=db-project \
--data description="A DB project" \
--data author_name="Test Author" \
--data author_email="test@example.com" \
--data github_user=test-user \
--data use_db=true
- name: Lint
working-directory: /tmp/rendered-db
run: |
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
- name: Type check
working-directory: /tmp/rendered-db
run: uv run mypy src/
- name: Test
working-directory: /tmp/rendered-db
run: uv run pytest -v --cov=src --cov-report=xml