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
142 changes: 142 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: ci

on:
push:
branches:
- main
pull_request:

permissions:
contents: read
id-token: write
pull-requests: write

jobs:
ci:
name: ${{ matrix.name }}
runs-on: ubuntu-24.04
concurrency:
group: ${{ github.workflow }}-${{ matrix.name }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
include:
- name: test
task: test
install: true
run_on_push: true
annotations_pytest: true
- name: pre-commit
task: install
install: true
pre_commit: true
- name: template - build
task: build
template: true
buildx: true
- name: template - check - format
task: check:format
template: true
install: true
annotations_ruff: true
- name: template - check - lint
task: check:lint
template: true
install: true
annotations_ruff: true
- name: template - check - types
task: check:types
template: true
install: true
annotations_mypy: true
- name: template - test - 3.10
task: test
template: true
install: true
run_on_push: true
python: "3.10"
- name: template - test - 3.11
task: test
template: true
install: true
run_on_push: true
python: "3.11"
- name: template - test - 3.12
task: test
template: true
install: true
run_on_push: true
python: "3.12"
- name: template - test - 3.13
task: test
template: true
install: true
run_on_push: true
python: "3.13"
- name: template - test - 3.14
task: test
template: true
install: true
run_on_push: true
python: "3.14"
annotations_pytest: true
pytest_coverage: true
pytest_coverage_xml: tests/example-project/coverage.xml
pytest_coverage_junit: tests/example-project/pytest.xml
- name: template - pre-commit
task: install
template: true
install: true
pre_commit: true
steps:
- name: lock template project
if: (matrix.template || false) && (github.event_name == 'pull_request' || matrix.run_on_push)
uses: juftin/actions/taskfile@v1
with:
task: lock
task-args: --taskfile tests/example-project/Taskfile.yaml
checkout: true
fetch-depth: ${{ matrix.pre_commit && '0' || '1' }}
setup-uv: true
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: install template project
if: matrix.template && matrix.install && (github.event_name == 'pull_request' || matrix.run_on_push)
uses: juftin/actions/taskfile@v1
with:
task: install
task-args: --taskfile tests/example-project/Taskfile.yaml
setup-task: false
setup-uv: false
- name: ${{ matrix.name }}
if: github.event_name == 'pull_request' || matrix.run_on_push
uses: juftin/actions/taskfile@v1
with:
task: ${{ matrix.task }}
task-args: ${{ matrix.template && '--taskfile tests/example-project/Taskfile.yaml' || '' }}
checkout: ${{ !matrix.template }}
install: ${{ matrix.install || false }}
fetch-depth: ${{ matrix.pre_commit && '0' || '1' }}
setup-task: ${{ !matrix.template }}
setup-uv: ${{ !matrix.template }}
buildx: ${{ matrix.buildx || false }}
github-token: ${{ secrets.GITHUB_TOKEN }}
annotations-ruff: ${{ matrix.annotations_ruff || false }}
annotations-mypy: ${{ matrix.annotations_mypy || false }}
annotations-pytest: ${{ matrix.annotations_pytest || false }}
pytest-coverage: ${{ matrix.pytest_coverage && github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork || false }}
pytest-coverage-xml: ${{ matrix.pytest_coverage_xml || 'coverage.xml' }}
pytest-coverage-junit: ${{ matrix.pytest_coverage_junit || 'pytest.xml' }}
env:
UV_PYTHON: ${{ matrix.python || '' }}
- name: pre-commit
if: matrix.pre_commit && github.event_name == 'pull_request'
run: |
uv tool run --isolated \
--with pre-commit-uv \
pre-commit run \
--color always \
--from-ref ${{ github.event.pull_request.base.sha }} \
--to-ref ${{ github.event.pull_request.head.sha }}
26 changes: 0 additions & 26 deletions .github/workflows/test.yaml

This file was deleted.

6 changes: 5 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ repos:
description: Runs Prettier Code Formatter
entry: prettier --write --ignore-unknown
args: ["--tab-width=4"]
exclude: \.github/\.copier-answers\.yaml$
exclude: |
(?x)(
\.github/\.copier-answers\.yaml$|
^copier\.yaml$
)
language: node
types:
- text
Expand Down
44 changes: 28 additions & 16 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,27 @@ env:
UV_LOCKED: 1

tasks:
#######################################
########################
# DEFAULT TASK
########################
default:
desc: Install Project, List Tasks
desc: List Available Tasks
cmds:
- task --list-all
deps: [sync]
#######################################
- task --list-all --sort alphanumeric
silent: true
########################
# INSTALL AND DEPENDENCIES
########################
install:
desc: Install Project + Dev Dependencies
cmds:
- task: pre-commit-install
- task: sync
#######################################
########################
# TESTING
########################
test:
desc: Run Tests
desc: Run Copier Tests
cmds:
- uv run -- pytest tests/test_copier.py {{.CLI_ARGS}}
deps:
Expand All @@ -30,33 +36,39 @@ tasks:
CLI_ARGS: --quiet
env:
UV_PYTHON: "{{.UV_PYTHON}}"
#######################################
########################
# DOCUMENTATION AND COMMANDS
########################
docs:
desc: Generate Documentation
desc: Run Documentation Site
cmds:
- uv run --group docs -- mkdocs {{.CLI_ARGS | default "serve"}}
#######################################
run:
desc: Run Command within Project (requires "--")
desc: Run Project Command (requires "--")
interactive: true
cmds:
- uv run -- {{.CLI_ARGS}}
#######################################
########################
# DEPENDENCY MANAGEMENT
########################
lock:
desc: Regenerate the Project Lockfile
desc: Regenerate Project Lockfile
cmds:
- uv lock
env:
UV_LOCKED: "0"
#######################################
########################
# GENERATED PROJECT FIXTURE
########################
example-project:
desc: Regenerate the example project for testing
desc: Regenerate Example Project
cmds:
- rm -rf tests/example-project
- uv run -- copier copy --vcs-ref=HEAD --defaults --data-file tests/answers.yml . {{.CLI_ARGS | default "tests/example-project"}}
#######################################
########################
# INTERNAL TASKS
#######################################
########################
sync:
desc: Install Project Dependencies
internal: true
Expand Down
23 changes: 10 additions & 13 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ manager) and **[task]** (task runner). Once both are installed, you can use
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
```

3. Install project dependencies and list available tasks
3. Install the project development environment

```shell
task install
Expand All @@ -34,18 +34,15 @@ manager) and **[task]** (task runner). Once both are installed, you can use

### Task Cheat Sheet

| Command Description | Command | Notes |
| ------------------- | ------------------- | --------------------------------------- |
| Install Project | `task install` | Installs project and dev dependencies |
| Run Tests | `task test` | Runs tests with `pytest` |
| Run Linting | `task lint` | Lints code with `ruff` |
| Fix Code Issues | `task fix` | Formats and auto-fixes code with `ruff` |
| Run Formatting | `task fmt` | Formats code with `ruff` |
| Run Type Checking | `task check` | Runs static analysis with `mypy` |
| Build Project | `task build` | Builds project artifacts |
| Update Dependencies | `task lock` | Regenerates project lockfile |
| Serve Documentation | `task docs` | Serves docs with `mkdocs` |
| Run Commands | `task run -- <cmd>` | Runs arbitrary commands |
| Command Description | Command | Notes |
| ---------------------------------- | ---------------------- | ------------------------------------------ |
| List Available Tasks | `task` | Lists tasks in alphanumeric order |
| Install Project + Dev Dependencies | `task install` | Installs dependencies and pre-commit hooks |
| Run Copier Tests | `task test` | Runs the Copier test suite |
| Run Documentation Site | `task docs` | Runs MkDocs |
| Run a Project Command | `task run -- <cmd>` | Runs a command in the project environment |
| Regenerate Project Lockfile | `task lock` | Regenerates `uv.lock` |
| Regenerate Example Project | `task example-project` | Replaces the checked-in generated fixture |

### Task Explanation

Expand Down
95 changes: 95 additions & 0 deletions template/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: ci

on:
push:
branches:
- main
pull_request:

permissions:
contents: read
id-token: write
pull-requests: write

jobs:
ci:
name: ${{"{{"}} matrix.name {{"}}"}}
runs-on: ubuntu-24.04
concurrency:
group: ${{"{{"}} github.workflow {{"}}"}}-${{"{{"}} matrix.name {{"}}"}}-${{"{{"}} github.event.pull_request.number {{"}}"}}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
include:
- name: build
task: build
- name: check - format
task: check:format
install: true
annotations_ruff: true
- name: check - lint
task: check:lint
install: true
annotations_ruff: true
- name: check - types
task: check:types
install: true
annotations_mypy: true
- name: test - 3.10
task: test
install: true
run_on_push: true
python: "3.10"
- name: test - 3.11
task: test
install: true
run_on_push: true
python: "3.11"
- name: test - 3.12
task: test
install: true
run_on_push: true
python: "3.12"
- name: test - 3.13
task: test
install: true
run_on_push: true
python: "3.13"
- name: test - 3.14
task: test
install: true
run_on_push: true
python: "3.14"
- name: pre-commit
task: install
install: true
steps:
- name: ${{"{{"}} matrix.name {{"}}"}}
if: github.event_name == 'pull_request' || matrix.run_on_push
uses: juftin/actions/taskfile@v1
with:
task: ${{"{{"}} matrix.task {{"}}"}}
checkout: true
install: ${{"{{"}} matrix.install || false {{"}}"}}
fetch-depth: ${{"{{"}} matrix.name == 'pre-commit' && '0' || '1' {{"}}"}}
setup-uv: true
buildx: ${{"{{"}} matrix.name == 'build' {{"}}"}}
github-token: ${{"{{"}} secrets.GITHUB_TOKEN {{"}}"}}
annotations-ruff: ${{"{{"}} matrix.annotations_ruff || false {{"}}"}}
annotations-mypy: ${{"{{"}} matrix.annotations_mypy || false {{"}}"}}
annotations-pytest: ${{"{{"}} matrix.python == '{{ default_python_version }}' {{"}}"}}
pytest-coverage: ${{"{{"}} matrix.python == '{{ default_python_version }}' && github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork {{"}}"}}
env:
UV_PYTHON: ${{"{{"}} matrix.python || '' {{"}}"}}
- name: pre-commit
if: matrix.name == 'pre-commit' && github.event_name == 'pull_request'
run: |
uv tool run --isolated \
--with pre-commit-uv \
pre-commit run \
--color always \
--from-ref ${{"{{"}} github.event.pull_request.base.sha {{"}}"}} \
--to-ref ${{"{{"}} github.event.pull_request.head.sha {{"}}"}}
Loading
Loading