From aafb0e3e309ad0bdb400b18c3f8c07f50cee0712 Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sat, 1 Aug 2026 13:09:37 -0600 Subject: [PATCH 01/14] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20(ci):=20consolidate?= =?UTF-8?q?=20pull=20request=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 117 ++++++++++++++++++ .github/workflows/test.yaml | 26 ---- template/.github/workflows/ci.yaml | 80 ++++++++++++ template/.github/workflows/lint.yaml | 37 ------ template/.github/workflows/test.yaml | 51 -------- ...uild_docker_image %}docker.yaml{% endif %} | 25 ---- template/Taskfile.yaml | 31 +++-- template/docs/contributing.md | 7 +- .../example-project/.github/workflows/ci.yaml | 80 ++++++++++++ .../.github/workflows/docker.yaml | 25 ---- .../.github/workflows/lint.yaml | 37 ------ .../.github/workflows/test.yaml | 51 -------- tests/example-project/Taskfile.yaml | 31 +++-- tests/example-project/docs/contributing.md | 7 +- 14 files changed, 331 insertions(+), 274 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/test.yaml create mode 100644 template/.github/workflows/ci.yaml delete mode 100644 template/.github/workflows/lint.yaml delete mode 100644 template/.github/workflows/test.yaml delete mode 100644 template/.github/workflows/{% if build_docker_image %}docker.yaml{% endif %} create mode 100644 tests/example-project/.github/workflows/ci.yaml delete mode 100644 tests/example-project/.github/workflows/docker.yaml delete mode 100644 tests/example-project/.github/workflows/lint.yaml delete mode 100644 tests/example-project/.github/workflows/test.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..8e7b96b --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,117 @@ +# 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 + annotations_pytest: true + - name: pre-commit + task: install + pre_commit: true + - name: template - build + task: build + template: true + buildx: true + - name: template - check - format + task: check:format + template: true + annotations_ruff: true + - name: template - check - lint + task: check:lint + template: true + annotations_ruff: true + - name: template - check - types + task: check:types + template: true + annotations_mypy: true + - name: template - test - 3.10 + task: test + template: true + python: "3.10" + - name: template - test - 3.11 + task: test + template: true + python: "3.11" + - name: template - test - 3.12 + task: test + template: true + python: "3.12" + - name: template - test - 3.13 + task: test + template: true + python: "3.13" + - name: template - test - 3.14 + task: test + template: 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 + pre_commit: true + steps: + - name: lock template project + if: matrix.template || false + 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: ${{ matrix.name }} + 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 }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index a20ab15..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json - -name: test - -on: - push: - branches: - - main - pull_request: - -jobs: - test: - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - pull-requests: write - steps: - - name: test - uses: juftin/actions/taskfile@v1 - with: - checkout: true - setup-uv: true - task: test - install: true - github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/template/.github/workflows/ci.yaml b/template/.github/workflows/ci.yaml new file mode 100644 index 0000000..08618ed --- /dev/null +++ b/template/.github/workflows/ci.yaml @@ -0,0 +1,80 @@ +# 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 + annotations_ruff: true + - name: check - lint + task: check:lint + annotations_ruff: true + - name: check - types + task: check:types + annotations_mypy: true + - name: test - 3.10 + task: test + python: "3.10" + - name: test - 3.11 + task: test + python: "3.11" + - name: test - 3.12 + task: test + python: "3.12" + - name: test - 3.13 + task: test + python: "3.13" + - name: test - 3.14 + task: test + python: "3.14" + - name: pre-commit + task: install + steps: + - name: ${{"{{"}} matrix.name {{"}}"}} + uses: juftin/actions/taskfile@v1 + with: + task: ${{"{{"}} matrix.task {{"}}"}} + checkout: true + install: ${{"{{"}} matrix.name != 'build' && matrix.name != 'pre-commit' {{"}}"}} + 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 {{"}}"}} diff --git a/template/.github/workflows/lint.yaml b/template/.github/workflows/lint.yaml deleted file mode 100644 index 96e5d90..0000000 --- a/template/.github/workflows/lint.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json - -name: lint - -on: - pull_request: - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: lint - id: lint - uses: juftin/actions/taskfile@v1 - continue-on-error: true - with: - checkout: true - setup-uv: true - task: lint - install: true - github-token: ${{"{{"}} secrets.GITHUB_TOKEN {{"}}"}} - annotations-ruff: true - - name: check - id: check - uses: juftin/actions/taskfile@v1 - continue-on-error: true - with: - task: check - setup-task: false - annotations-mypy: true - - name: Raise Errors For Failures - if: | - steps.lint.outcome != 'success' || steps.check.outcome != 'success' - run: | - echo "Lint: ${{"{{"}} steps.lint.outcome {{"}}"}}" - echo "Check: ${{"{{"}} steps.check.outcome {{"}}"}}" - exit 1 diff --git a/template/.github/workflows/test.yaml b/template/.github/workflows/test.yaml deleted file mode 100644 index b34fb20..0000000 --- a/template/.github/workflows/test.yaml +++ /dev/null @@ -1,51 +0,0 @@ -# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json - -name: test - -on: - push: - branches: - - {{ default_branch }} - paths: - - src/{{ project_slug }}/** - - pyproject.toml - - uv.lock - - .github/workflows/tests.yaml - pull_request: - paths: - - src/{{ project_slug }}/** - - pyproject.toml - - uv.lock - - .github/workflows/tests.yaml - schedule: - - cron: 0 12 1 * * - -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - include: - - { name: Python 3.13, python: "3.13" } - - { name: Python 3.12, python: "3.12" } - - { name: Python 3.11, python: "3.11" } - - { name: Python 3.10, python: "3.10" } - - { name: Python 3.9, python: "3.9" } - permissions: - contents: read - id-token: write - pull-requests: write - steps: - - name: test - uses: juftin/actions/taskfile@v1 - with: - checkout: true - setup-uv: true - task: test - install: true - github-token: ${{"{{"}} secrets.GITHUB_TOKEN {{"}}"}} - annotations-pytest: ${{"{{"}} matrix.python == '{{ default_python_version }}' && true || false {{"}}"}} - pytest-coverage: ${{"{{"}} matrix.python == '{{ default_python_version }}' && github.event_name == 'pull_request' && true || false {{"}}"}} - env: - UV_PYTHON: ${{"{{"}} matrix.python {{"}}"}} diff --git a/template/.github/workflows/{% if build_docker_image %}docker.yaml{% endif %} b/template/.github/workflows/{% if build_docker_image %}docker.yaml{% endif %} deleted file mode 100644 index 6419c96..0000000 --- a/template/.github/workflows/{% if build_docker_image %}docker.yaml{% endif %} +++ /dev/null @@ -1,25 +0,0 @@ -# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json - -name: docker - -on: - pull_request: - paths: - - src/{{ project_slug }}/** - - pyproject.toml - - .github/workflows/docker.yaml - - Dockerfile - - uv.lock - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: docker - uses: juftin/actions/taskfile@v1 - with: - checkout: true - setup-uv: true - task: docker - buildx: true - github-token: ${{"{{"}} secrets.GITHUB_TOKEN {{"}}"}} diff --git a/template/Taskfile.yaml b/template/Taskfile.yaml index 00cadb1..02cf7ef 100644 --- a/template/Taskfile.yaml +++ b/template/Taskfile.yaml @@ -5,7 +5,6 @@ version: "3" env: UV_LOCKED: 1 vars: - SOURCE_CODE: src/{{ project_slug }} DOCKER_REPO: {{ github_user }}/{{ package_name }} tasks: @@ -44,15 +43,25 @@ tasks: vars: UV_PYTHON: "{{"{{"}}.ITEM.PYTHON{{"}}"}}" ####################################### - lint: - desc: Run Code Linters + check:format: + desc: Check Code Formatting cmds: - - uv run -- ruff check {{"{{"}}.CLI_ARGS | default .ROOT_DIR{{"}}"}} - task: fmt vars: CLI_ARGS: --check + ####################################### + check:lint: + desc: Run Ruff Linter + cmds: + - uv run -- ruff check {{"{{"}}.CLI_ARGS | default .ROOT_DIR{{"}}"}} deps: [sync] ####################################### + check:style: + desc: Check Code Style + cmds: + - task: check:format + - task: check:lint + ####################################### fmt: desc: Run Code Formatters cmds: @@ -66,18 +75,22 @@ tasks: - uv run -- ruff check --fix {{"{{"}}.CLI_ARGS | default .ROOT_DIR{{"}}"}} deps: [sync] ####################################### - check: - desc: Run Static Type Checkers + check:types: + desc: Run Static Type Checks cmds: - | uv run -- \ mypy \ --ignore-missing-imports \ - {{"{{"}}.CLI_ARGS | default .SOURCE_CODE{{"}}"}} + {{"{{"}}.CLI_ARGS | default (printf "%s/src" .ROOT_DIR){{"}}"}} status: - '[$(uv tree --package mypy) != ""]' - requires: - vars: [SOURCE_CODE] + ####################################### + check: + desc: Run All Code Checks + cmds: + - task: check:style + - task: check:types ####################################### dist: desc: Build the Project Artifacts diff --git a/template/docs/contributing.md b/template/docs/contributing.md index 03b064c..fc3683c 100644 --- a/template/docs/contributing.md +++ b/template/docs/contributing.md @@ -38,10 +38,13 @@ manager) and **[task]** (task runner). Once both are installed, you can use | ------------------- | ------------------- | --------------------------------------- | | 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` | +| Run All Checks | `task check` | Runs style and type checks | +| Check Style | `task check:style` | Runs formatting and linting checks | +| Check Formatting | `task check:format` | Checks formatting with `ruff` | +| Check Linting | `task check: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` | +| Check Types | `task check:types` | 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` | diff --git a/tests/example-project/.github/workflows/ci.yaml b/tests/example-project/.github/workflows/ci.yaml new file mode 100644 index 0000000..ac28e81 --- /dev/null +++ b/tests/example-project/.github/workflows/ci.yaml @@ -0,0 +1,80 @@ +# 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 + annotations_ruff: true + - name: check - lint + task: check:lint + annotations_ruff: true + - name: check - types + task: check:types + annotations_mypy: true + - name: test - 3.10 + task: test + python: "3.10" + - name: test - 3.11 + task: test + python: "3.11" + - name: test - 3.12 + task: test + python: "3.12" + - name: test - 3.13 + task: test + python: "3.13" + - name: test - 3.14 + task: test + python: "3.14" + - name: pre-commit + task: install + steps: + - name: ${{ matrix.name }} + uses: juftin/actions/taskfile@v1 + with: + task: ${{ matrix.task }} + checkout: true + install: ${{ matrix.name != 'build' && matrix.name != 'pre-commit' }} + 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 == '3.14' }} + pytest-coverage: ${{ matrix.python == '3.14' && 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 }} diff --git a/tests/example-project/.github/workflows/docker.yaml b/tests/example-project/.github/workflows/docker.yaml deleted file mode 100644 index a01e6cc..0000000 --- a/tests/example-project/.github/workflows/docker.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json - -name: docker - -on: - pull_request: - paths: - - src/example_project/** - - pyproject.toml - - .github/workflows/docker.yaml - - Dockerfile - - uv.lock - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: docker - uses: juftin/actions/taskfile@v1 - with: - checkout: true - setup-uv: true - task: docker - buildx: true - github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/tests/example-project/.github/workflows/lint.yaml b/tests/example-project/.github/workflows/lint.yaml deleted file mode 100644 index 7f83c59..0000000 --- a/tests/example-project/.github/workflows/lint.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json - -name: lint - -on: - pull_request: - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: lint - id: lint - uses: juftin/actions/taskfile@v1 - continue-on-error: true - with: - checkout: true - setup-uv: true - task: lint - install: true - github-token: ${{ secrets.GITHUB_TOKEN }} - annotations-ruff: true - - name: check - id: check - uses: juftin/actions/taskfile@v1 - continue-on-error: true - with: - task: check - setup-task: false - annotations-mypy: true - - name: Raise Errors For Failures - if: | - steps.lint.outcome != 'success' || steps.check.outcome != 'success' - run: | - echo "Lint: ${{ steps.lint.outcome }}" - echo "Check: ${{ steps.check.outcome }}" - exit 1 diff --git a/tests/example-project/.github/workflows/test.yaml b/tests/example-project/.github/workflows/test.yaml deleted file mode 100644 index b02ca75..0000000 --- a/tests/example-project/.github/workflows/test.yaml +++ /dev/null @@ -1,51 +0,0 @@ -# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json - -name: test - -on: - push: - branches: - - main - paths: - - src/example_project/** - - pyproject.toml - - uv.lock - - .github/workflows/tests.yaml - pull_request: - paths: - - src/example_project/** - - pyproject.toml - - uv.lock - - .github/workflows/tests.yaml - schedule: - - cron: 0 12 1 * * - -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - include: - - { name: Python 3.13, python: "3.13" } - - { name: Python 3.12, python: "3.12" } - - { name: Python 3.11, python: "3.11" } - - { name: Python 3.10, python: "3.10" } - - { name: Python 3.9, python: "3.9" } - permissions: - contents: read - id-token: write - pull-requests: write - steps: - - name: test - uses: juftin/actions/taskfile@v1 - with: - checkout: true - setup-uv: true - task: test - install: true - github-token: ${{ secrets.GITHUB_TOKEN }} - annotations-pytest: ${{ matrix.python == '3.14' && true || false }} - pytest-coverage: ${{ matrix.python == '3.14' && github.event_name == 'pull_request' && true || false }} - env: - UV_PYTHON: ${{ matrix.python }} diff --git a/tests/example-project/Taskfile.yaml b/tests/example-project/Taskfile.yaml index 0f139da..e5b9148 100644 --- a/tests/example-project/Taskfile.yaml +++ b/tests/example-project/Taskfile.yaml @@ -5,7 +5,6 @@ version: "3" env: UV_LOCKED: 1 vars: - SOURCE_CODE: src/example_project DOCKER_REPO: juftin/example-project tasks: @@ -44,15 +43,25 @@ tasks: vars: UV_PYTHON: "{{.ITEM.PYTHON}}" ####################################### - lint: - desc: Run Code Linters + check:format: + desc: Check Code Formatting cmds: - - uv run -- ruff check {{.CLI_ARGS | default .ROOT_DIR}} - task: fmt vars: CLI_ARGS: --check + ####################################### + check:lint: + desc: Run Ruff Linter + cmds: + - uv run -- ruff check {{.CLI_ARGS | default .ROOT_DIR}} deps: [sync] ####################################### + check:style: + desc: Check Code Style + cmds: + - task: check:format + - task: check:lint + ####################################### fmt: desc: Run Code Formatters cmds: @@ -66,18 +75,22 @@ tasks: - uv run -- ruff check --fix {{.CLI_ARGS | default .ROOT_DIR}} deps: [sync] ####################################### - check: - desc: Run Static Type Checkers + check:types: + desc: Run Static Type Checks cmds: - | uv run -- \ mypy \ --ignore-missing-imports \ - {{.CLI_ARGS | default .SOURCE_CODE}} + {{.CLI_ARGS | default (printf "%s/src" .ROOT_DIR)}} status: - '[$(uv tree --package mypy) != ""]' - requires: - vars: [SOURCE_CODE] + ####################################### + check: + desc: Run All Code Checks + cmds: + - task: check:style + - task: check:types ####################################### dist: desc: Build the Project Artifacts diff --git a/tests/example-project/docs/contributing.md b/tests/example-project/docs/contributing.md index 03b064c..fc3683c 100644 --- a/tests/example-project/docs/contributing.md +++ b/tests/example-project/docs/contributing.md @@ -38,10 +38,13 @@ manager) and **[task]** (task runner). Once both are installed, you can use | ------------------- | ------------------- | --------------------------------------- | | 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` | +| Run All Checks | `task check` | Runs style and type checks | +| Check Style | `task check:style` | Runs formatting and linting checks | +| Check Formatting | `task check:format` | Checks formatting with `ruff` | +| Check Linting | `task check: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` | +| Check Types | `task check:types` | 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` | From 6177dc9b61711ce4e5870612ad044fd82e9f57ba Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sat, 1 Aug 2026 22:48:47 -0600 Subject: [PATCH 02/14] =?UTF-8?q?=E2=9C=A8=20(ci):=20finalize=20consolidat?= =?UTF-8?q?ed=20workflows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 9 +++ template/.github/workflows/ci.yaml | 2 +- .../example-project/.github/workflows/ci.yaml | 2 +- tests/test_copier.py | 67 +++++++++++++++++++ 4 files changed, 78 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8e7b96b..226edb0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,6 +30,7 @@ jobs: annotations_pytest: true - name: pre-commit task: install + install: true pre_commit: true - name: template - build task: build @@ -86,6 +87,14 @@ jobs: fetch-depth: ${{ matrix.pre_commit && '0' || '1' }} setup-uv: true github-token: ${{ secrets.GITHUB_TOKEN }} + - name: install template project + if: matrix.template && matrix.task != 'build' + 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 }} uses: juftin/actions/taskfile@v1 with: diff --git a/template/.github/workflows/ci.yaml b/template/.github/workflows/ci.yaml index 08618ed..b8733e7 100644 --- a/template/.github/workflows/ci.yaml +++ b/template/.github/workflows/ci.yaml @@ -58,7 +58,7 @@ jobs: with: task: ${{"{{"}} matrix.task {{"}}"}} checkout: true - install: ${{"{{"}} matrix.name != 'build' && matrix.name != 'pre-commit' {{"}}"}} + install: ${{"{{"}} matrix.name != 'build' {{"}}"}} fetch-depth: ${{"{{"}} matrix.name == 'pre-commit' && '0' || '1' {{"}}"}} setup-uv: true buildx: ${{"{{"}} matrix.name == 'build' {{"}}"}} diff --git a/tests/example-project/.github/workflows/ci.yaml b/tests/example-project/.github/workflows/ci.yaml index ac28e81..8f91df7 100644 --- a/tests/example-project/.github/workflows/ci.yaml +++ b/tests/example-project/.github/workflows/ci.yaml @@ -58,7 +58,7 @@ jobs: with: task: ${{ matrix.task }} checkout: true - install: ${{ matrix.name != 'build' && matrix.name != 'pre-commit' }} + install: ${{ matrix.name != 'build' }} fetch-depth: ${{ matrix.name == 'pre-commit' && '0' || '1' }} setup-uv: true buildx: ${{ matrix.name == 'build' }} diff --git a/tests/test_copier.py b/tests/test_copier.py index e494a91..d96c1f9 100644 --- a/tests/test_copier.py +++ b/tests/test_copier.py @@ -280,3 +280,70 @@ def test_copier_updates_using_configured_answers_file(tmp_path: Path) -> None: ) assert marker in (project / "README.md").read_text() + + +def test_copier_removes_consolidated_ci_workflows(tmp_path: Path) -> None: + """Delete replaced CI workflows, including downstream customizations.""" + template_root = Path(__file__).parent.parent + source = tmp_path / "template-source" + shutil.copytree( + template_root, + source, + ignore=shutil.ignore_patterns( + ".git", + ".venv", + ".pytest_cache", + "__pycache__", + "site", + ), + ) + workflow_dir = source / "template/.github/workflows" + (workflow_dir / "ci.yaml").unlink() + legacy_workflows = { + "test.yaml": "test.yaml", + "lint.yaml": "lint.yaml", + "docker.yaml": "{% if build_docker_image %}docker.yaml{% endif %}", + } + for template_path in legacy_workflows.values(): + (workflow_dir / template_path).write_text("name: legacy\n") + + _initialize_repository(source) + _commit_all(source, "Initial template") + _git(source, "tag", "v1.0.0") + + project = tmp_path / "generated-project" + run_copy( + src_path=str(source), + dst_path=project, + data={"build_docker_image": True}, + defaults=True, + overwrite=True, + quiet=True, + vcs_ref="v1.0.0", + ) + _initialize_repository(project) + for filename in legacy_workflows: + workflow = project / ".github/workflows" / filename + workflow.write_text(f"{workflow.read_text()}# Downstream customization\n") + _commit_all(project, "Initial project") + + (workflow_dir / "ci.yaml").write_text( + (template_root / "template/.github/workflows/ci.yaml").read_text() + ) + for template_path in legacy_workflows.values(): + (workflow_dir / template_path).unlink() + _commit_all(source, "Consolidate CI workflows") + _git(source, "tag", "v1.1.0") + + run_update( + dst_path=project, + answers_file=".github/.copier-answers.yaml", + defaults=True, + overwrite=True, + quiet=True, + vcs_ref="v1.1.0", + ) + + assert (project / ".github/workflows/ci.yaml").is_file() + for filename in legacy_workflows: + assert not (project / ".github/workflows" / filename).exists() From a55392fa0c31e42f106cd09d9ee22dd48ca5e25e Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sat, 1 Aug 2026 22:57:01 -0600 Subject: [PATCH 03/14] =?UTF-8?q?=F0=9F=91=B7=20(ci):=20install=20each=20n?= =?UTF-8?q?on-build=20matrix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 226edb0..c96ded4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,34 +39,42 @@ jobs: - 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 python: "3.10" - name: template - test - 3.11 task: test template: true + install: true python: "3.11" - name: template - test - 3.12 task: test template: true + install: true python: "3.12" - name: template - test - 3.13 task: test template: true + install: true python: "3.13" - name: template - test - 3.14 task: test template: true + install: true python: "3.14" annotations_pytest: true pytest_coverage: true @@ -75,6 +83,7 @@ jobs: - name: template - pre-commit task: install template: true + install: true pre_commit: true steps: - name: lock template project @@ -88,7 +97,7 @@ jobs: setup-uv: true github-token: ${{ secrets.GITHUB_TOKEN }} - name: install template project - if: matrix.template && matrix.task != 'build' + if: matrix.template && matrix.install uses: juftin/actions/taskfile@v1 with: task: install From f71a1d0f1272f989d2928ac0c2b61262b0dc45ca Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sat, 1 Aug 2026 22:58:08 -0600 Subject: [PATCH 04/14] =?UTF-8?q?=F0=9F=91=B7=20(ci):=20declare=20matrix?= =?UTF-8?q?=20installation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/.github/workflows/ci.yaml | 11 ++++++++++- tests/example-project/.github/workflows/ci.yaml | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/template/.github/workflows/ci.yaml b/template/.github/workflows/ci.yaml index b8733e7..4ff9aa0 100644 --- a/template/.github/workflows/ci.yaml +++ b/template/.github/workflows/ci.yaml @@ -28,37 +28,46 @@ jobs: 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 python: "3.10" - name: test - 3.11 task: test + install: true python: "3.11" - name: test - 3.12 task: test + install: true python: "3.12" - name: test - 3.13 task: test + install: true python: "3.13" - name: test - 3.14 task: test + install: true python: "3.14" - name: pre-commit task: install + install: true steps: - name: ${{"{{"}} matrix.name {{"}}"}} uses: juftin/actions/taskfile@v1 with: task: ${{"{{"}} matrix.task {{"}}"}} checkout: true - install: ${{"{{"}} matrix.name != 'build' {{"}}"}} + install: ${{"{{"}} matrix.install || false {{"}}"}} fetch-depth: ${{"{{"}} matrix.name == 'pre-commit' && '0' || '1' {{"}}"}} setup-uv: true buildx: ${{"{{"}} matrix.name == 'build' {{"}}"}} diff --git a/tests/example-project/.github/workflows/ci.yaml b/tests/example-project/.github/workflows/ci.yaml index 8f91df7..244275b 100644 --- a/tests/example-project/.github/workflows/ci.yaml +++ b/tests/example-project/.github/workflows/ci.yaml @@ -28,37 +28,46 @@ jobs: 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 python: "3.10" - name: test - 3.11 task: test + install: true python: "3.11" - name: test - 3.12 task: test + install: true python: "3.12" - name: test - 3.13 task: test + install: true python: "3.13" - name: test - 3.14 task: test + install: true python: "3.14" - name: pre-commit task: install + install: true steps: - name: ${{ matrix.name }} uses: juftin/actions/taskfile@v1 with: task: ${{ matrix.task }} checkout: true - install: ${{ matrix.name != 'build' }} + install: ${{ matrix.install || false }} fetch-depth: ${{ matrix.name == 'pre-commit' && '0' || '1' }} setup-uv: true buildx: ${{ matrix.name == 'build' }} From 690f34fc0e3a550169e26816d42979d62e7c3338 Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sun, 2 Aug 2026 07:13:50 -0600 Subject: [PATCH 05/14] =?UTF-8?q?=F0=9F=A7=AA=20test=20Copier=20workflow?= =?UTF-8?q?=20deletion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_copier.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/test_copier.py b/tests/test_copier.py index d96c1f9..5062dfd 100644 --- a/tests/test_copier.py +++ b/tests/test_copier.py @@ -2,6 +2,7 @@ import shutil import subprocess +import sys from pathlib import Path import pytest @@ -335,13 +336,20 @@ def test_copier_removes_consolidated_ci_workflows(tmp_path: Path) -> None: _commit_all(source, "Consolidate CI workflows") _git(source, "tag", "v1.1.0") - run_update( - dst_path=project, - answers_file=".github/.copier-answers.yaml", - defaults=True, - overwrite=True, - quiet=True, - vcs_ref="v1.1.0", + subprocess.run( + [ + sys.executable, + "-m", + "copier", + "update", + "--defaults", + "--answers-file", + ".github/.copier-answers.yaml", + str(project), + ], + check=True, + capture_output=True, + text=True, ) assert (project / ".github/workflows/ci.yaml").is_file() From 02665d31453a1665a7e9e9b5c69afde1ec46e1b6 Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sun, 2 Aug 2026 07:25:52 -0600 Subject: [PATCH 06/14] =?UTF-8?q?=F0=9F=93=9D=20clarify=20task=20descripti?= =?UTF-8?q?ons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/Taskfile.yaml | 4 ++-- tests/example-project/Taskfile.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/template/Taskfile.yaml b/template/Taskfile.yaml index 02cf7ef..8b1f8d8 100644 --- a/template/Taskfile.yaml +++ b/template/Taskfile.yaml @@ -69,7 +69,7 @@ tasks: deps: [sync] ####################################### fix: - desc: Fix Code with Linters and Formatters + desc: Auto-fix Code Formatting and Style cmds: - task: fmt - uv run -- ruff check --fix {{"{{"}}.CLI_ARGS | default .ROOT_DIR{{"}}"}} @@ -87,7 +87,7 @@ tasks: - '[$(uv tree --package mypy) != ""]' ####################################### check: - desc: Run All Code Checks + desc: Check Code Formatting, Linting, and Type Checking cmds: - task: check:style - task: check:types diff --git a/tests/example-project/Taskfile.yaml b/tests/example-project/Taskfile.yaml index e5b9148..dfe6af5 100644 --- a/tests/example-project/Taskfile.yaml +++ b/tests/example-project/Taskfile.yaml @@ -69,7 +69,7 @@ tasks: deps: [sync] ####################################### fix: - desc: Fix Code with Linters and Formatters + desc: Auto-fix Code Formatting and Style cmds: - task: fmt - uv run -- ruff check --fix {{.CLI_ARGS | default .ROOT_DIR}} @@ -87,7 +87,7 @@ tasks: - '[$(uv tree --package mypy) != ""]' ####################################### check: - desc: Run All Code Checks + desc: Check Code Formatting, Linting, and Type Checking cmds: - task: check:style - task: check:types From e26469ec20d5004ba62e06a261324515067cb146 Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sun, 2 Aug 2026 07:45:11 -0600 Subject: [PATCH 07/14] =?UTF-8?q?=F0=9F=93=9D=20refine=20task=20descriptio?= =?UTF-8?q?ns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/Taskfile.yaml | 6 +++--- tests/example-project/Taskfile.yaml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/template/Taskfile.yaml b/template/Taskfile.yaml index 8b1f8d8..db68c5d 100644 --- a/template/Taskfile.yaml +++ b/template/Taskfile.yaml @@ -16,7 +16,7 @@ tasks: deps: [sync] ####################################### install: - desc: Install Project + Dev Dependencies + desc: Install Project Dev Environment cmds: - task: pre-commit-install - task: sync @@ -34,7 +34,7 @@ tasks: UV_PYTHON: "{{"{{"}}.UV_PYTHON{{"}}"}}" ####################################### test:matrix: - desc: Run Tests with different Python versions + desc: Run Tests across Python Versions cmds: - for: matrix: @@ -116,7 +116,7 @@ tasks: - test ! -f {{"{{"}}.ROOT_DIR{{"}}"}}/{{"{{"}}.DOCKERFILE | default "Dockerfile"{{"}}"}} ####################################### build: - desc: Build the Project Artifacts + desc: Build Project Artifacts cmds: - task: dist - task: docker diff --git a/tests/example-project/Taskfile.yaml b/tests/example-project/Taskfile.yaml index dfe6af5..d3fb05e 100644 --- a/tests/example-project/Taskfile.yaml +++ b/tests/example-project/Taskfile.yaml @@ -16,7 +16,7 @@ tasks: deps: [sync] ####################################### install: - desc: Install Project + Dev Dependencies + desc: Install Project Dev Environment cmds: - task: pre-commit-install - task: sync @@ -34,7 +34,7 @@ tasks: UV_PYTHON: "{{.UV_PYTHON}}" ####################################### test:matrix: - desc: Run Tests with different Python versions + desc: Run Tests across Python Versions cmds: - for: matrix: @@ -116,7 +116,7 @@ tasks: - test ! -f {{.ROOT_DIR}}/{{.DOCKERFILE | default "Dockerfile"}} ####################################### build: - desc: Build the Project Artifacts + desc: Build Project Artifacts cmds: - task: dist - task: docker From e2213348f11029db56664a0a66ca5dc572c6dc50 Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sun, 2 Aug 2026 07:45:29 -0600 Subject: [PATCH 08/14] =?UTF-8?q?=F0=9F=93=9D=20standardize=20task=20descr?= =?UTF-8?q?iptions=20and=20Python=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/Taskfile.yaml | 2 +- tests/example-project/Taskfile.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/template/Taskfile.yaml b/template/Taskfile.yaml index db68c5d..76232f3 100644 --- a/template/Taskfile.yaml +++ b/template/Taskfile.yaml @@ -38,7 +38,7 @@ tasks: cmds: - for: matrix: - PYTHON: ["3.9", "3.10", "3.11", "3.12", "3.13"] + PYTHON: ["3.10", "3.11", "3.12", "3.13", "3.14"] task: test vars: UV_PYTHON: "{{"{{"}}.ITEM.PYTHON{{"}}"}}" diff --git a/tests/example-project/Taskfile.yaml b/tests/example-project/Taskfile.yaml index d3fb05e..5cddc26 100644 --- a/tests/example-project/Taskfile.yaml +++ b/tests/example-project/Taskfile.yaml @@ -38,7 +38,7 @@ tasks: cmds: - for: matrix: - PYTHON: ["3.9", "3.10", "3.11", "3.12", "3.13"] + PYTHON: ["3.10", "3.11", "3.12", "3.13", "3.14"] task: test vars: UV_PYTHON: "{{.ITEM.PYTHON}}" From f35bc4bc7bd3dea6d0d98e5beaaa50a092592105 Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sun, 2 Aug 2026 08:06:28 -0600 Subject: [PATCH 09/14] =?UTF-8?q?=F0=9F=93=9D=20document=20task=20entrypoi?= =?UTF-8?q?nts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 6 +++- docs/contributing.md | 21 ++++++------- template/docs/contributing.md | 35 ++++++++++++---------- tests/example-project/docs/contributing.md | 35 ++++++++++++---------- 4 files changed, 54 insertions(+), 43 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 803e49b..71d28f4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/docs/contributing.md b/docs/contributing.md index 03b064c..865178c 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -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 -- ` | Runs arbitrary commands | +| Command Description | Command | Notes | +| ------------------------------- | ---------------------- | ------------------------------------------ | +| List Available Tasks | `task` | Syncs dependencies before listing tasks | +| Install Project Dev Environment | `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 -- ` | Runs a command in the project environment | +| Update Dependency Lockfile | `task lock` | Regenerates `uv.lock` | +| Regenerate Example Project | `task example-project` | Replaces the checked-in generated fixture | ### Task Explanation diff --git a/template/docs/contributing.md b/template/docs/contributing.md index fc3683c..9682b0d 100644 --- a/template/docs/contributing.md +++ b/template/docs/contributing.md @@ -34,21 +34,26 @@ 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 All Checks | `task check` | Runs style and type checks | -| Check Style | `task check:style` | Runs formatting and linting checks | -| Check Formatting | `task check:format` | Checks formatting with `ruff` | -| Check Linting | `task check: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` | -| Check Types | `task check:types` | 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 -- ` | Runs arbitrary commands | +| Command Description | Command | Notes | +| ------------------------------- | --------------------------- | ----------------------------------------------- | +| Install Project Dev Environment | `task install` | Installs dependencies and pre-commit hooks | +| Run Tests | `task test` | Runs tests with `pytest` | +| Run Tests across Python Versions | `task test:matrix` | Runs tests on Python 3.10 through 3.14 | +| Check Code Formatting | `task check:format` | Checks formatting with `ruff` | +| Check Code Linting | `task check:lint` | Checks linting with `ruff` | +| Check Code Formatting and Linting | `task check:style` | Runs formatting and linting checks | +| Check Type Annotations | `task check:types` | Checks types with `mypy` | +| Check Code Formatting, Linting, and Type Checking | `task check` | Runs all code checks | +| Format Code | `task fmt` | Formats code with `ruff` | +| Auto-fix Code Formatting and Style | `task fix` | Formats code and applies `ruff` fixes | +| Build Distribution Artifacts | `task dist` | Builds Python distribution artifacts | +| Build Docker Image | `task docker` | Builds the Docker image when a Dockerfile exists | +| Build Project Artifacts | `task build` | Builds distribution artifacts and Docker image | +| Publish Docker Image | `task publish` | Pushes the Docker image in CI | +| Run Documentation Site | `task docs` | Runs MkDocs | +| Run a Project Command | `task run -- ` | Runs a command in the project environment | +| Run a Docker Command | `task docker-run -- ` | Runs a command in the Docker image | +| Update Dependency Lockfile | `task lock` | Regenerates `uv.lock` | ### Task Explanation diff --git a/tests/example-project/docs/contributing.md b/tests/example-project/docs/contributing.md index fc3683c..9682b0d 100644 --- a/tests/example-project/docs/contributing.md +++ b/tests/example-project/docs/contributing.md @@ -34,21 +34,26 @@ 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 All Checks | `task check` | Runs style and type checks | -| Check Style | `task check:style` | Runs formatting and linting checks | -| Check Formatting | `task check:format` | Checks formatting with `ruff` | -| Check Linting | `task check: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` | -| Check Types | `task check:types` | 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 -- ` | Runs arbitrary commands | +| Command Description | Command | Notes | +| ------------------------------- | --------------------------- | ----------------------------------------------- | +| Install Project Dev Environment | `task install` | Installs dependencies and pre-commit hooks | +| Run Tests | `task test` | Runs tests with `pytest` | +| Run Tests across Python Versions | `task test:matrix` | Runs tests on Python 3.10 through 3.14 | +| Check Code Formatting | `task check:format` | Checks formatting with `ruff` | +| Check Code Linting | `task check:lint` | Checks linting with `ruff` | +| Check Code Formatting and Linting | `task check:style` | Runs formatting and linting checks | +| Check Type Annotations | `task check:types` | Checks types with `mypy` | +| Check Code Formatting, Linting, and Type Checking | `task check` | Runs all code checks | +| Format Code | `task fmt` | Formats code with `ruff` | +| Auto-fix Code Formatting and Style | `task fix` | Formats code and applies `ruff` fixes | +| Build Distribution Artifacts | `task dist` | Builds Python distribution artifacts | +| Build Docker Image | `task docker` | Builds the Docker image when a Dockerfile exists | +| Build Project Artifacts | `task build` | Builds distribution artifacts and Docker image | +| Publish Docker Image | `task publish` | Pushes the Docker image in CI | +| Run Documentation Site | `task docs` | Runs MkDocs | +| Run a Project Command | `task run -- ` | Runs a command in the project environment | +| Run a Docker Command | `task docker-run -- ` | Runs a command in the Docker image | +| Update Dependency Lockfile | `task lock` | Regenerates `uv.lock` | ### Task Explanation From 7fb704eb29a1a4524e17713699c86ba8bc1aadb8 Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sun, 2 Aug 2026 08:07:01 -0600 Subject: [PATCH 10/14] =?UTF-8?q?=F0=9F=93=9D=20complete=20task=20document?= =?UTF-8?q?ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/contributing.md | 2 +- template/docs/contributing.md | 3 ++- tests/example-project/docs/contributing.md | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index 865178c..9cb76b0 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -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 diff --git a/template/docs/contributing.md b/template/docs/contributing.md index 9682b0d..ff4770d 100644 --- a/template/docs/contributing.md +++ b/template/docs/contributing.md @@ -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 @@ -36,6 +36,7 @@ manager) and **[task]** (task runner). Once both are installed, you can use | Command Description | Command | Notes | | ------------------------------- | --------------------------- | ----------------------------------------------- | +| List Available Tasks | `task` | Syncs dependencies before listing tasks | | Install Project Dev Environment | `task install` | Installs dependencies and pre-commit hooks | | Run Tests | `task test` | Runs tests with `pytest` | | Run Tests across Python Versions | `task test:matrix` | Runs tests on Python 3.10 through 3.14 | diff --git a/tests/example-project/docs/contributing.md b/tests/example-project/docs/contributing.md index 9682b0d..ff4770d 100644 --- a/tests/example-project/docs/contributing.md +++ b/tests/example-project/docs/contributing.md @@ -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 @@ -36,6 +36,7 @@ manager) and **[task]** (task runner). Once both are installed, you can use | Command Description | Command | Notes | | ------------------------------- | --------------------------- | ----------------------------------------------- | +| List Available Tasks | `task` | Syncs dependencies before listing tasks | | Install Project Dev Environment | `task install` | Installs dependencies and pre-commit hooks | | Run Tests | `task test` | Runs tests with `pytest` | | Run Tests across Python Versions | `task test:matrix` | Runs tests on Python 3.10 through 3.14 | From 1b72bb4b99e6585ce247fba8280eef86dcbe0fe5 Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sun, 2 Aug 2026 13:16:17 -0600 Subject: [PATCH 11/14] =?UTF-8?q?=F0=9F=93=9D=20standardize=20task=20descr?= =?UTF-8?q?iptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Taskfile.yaml | 12 ++++----- docs/contributing.md | 18 ++++++------- template/Taskfile.yaml | 30 +++++++++++----------- template/docs/contributing.md | 22 ++++++++-------- tests/example-project/Taskfile.yaml | 30 +++++++++++----------- tests/example-project/docs/contributing.md | 22 ++++++++-------- 6 files changed, 67 insertions(+), 67 deletions(-) diff --git a/Taskfile.yaml b/Taskfile.yaml index 12b11ce..217e875 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -8,7 +8,7 @@ env: tasks: ####################################### default: - desc: Install Project, List Tasks + desc: List Available Tasks cmds: - task --list-all deps: [sync] @@ -20,7 +20,7 @@ tasks: - task: sync ####################################### test: - desc: Run Tests + desc: Run Copier Tests cmds: - uv run -- pytest tests/test_copier.py {{.CLI_ARGS}} deps: @@ -32,25 +32,25 @@ tasks: UV_PYTHON: "{{.UV_PYTHON}}" ####################################### 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}} ####################################### lock: - desc: Regenerate the Project Lockfile + desc: Regenerate Project Lockfile cmds: - uv lock env: UV_LOCKED: "0" ####################################### 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"}} diff --git a/docs/contributing.md b/docs/contributing.md index 9cb76b0..3d61e87 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -34,15 +34,15 @@ manager) and **[task]** (task runner). Once both are installed, you can use ### Task Cheat Sheet -| Command Description | Command | Notes | -| ------------------------------- | ---------------------- | ------------------------------------------ | -| List Available Tasks | `task` | Syncs dependencies before listing tasks | -| Install Project Dev Environment | `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 -- ` | Runs a command in the project environment | -| Update Dependency Lockfile | `task lock` | Regenerates `uv.lock` | -| Regenerate Example Project | `task example-project` | Replaces the checked-in generated fixture | +| Command Description | Command | Notes | +| ---------------------------------- | ---------------------- | ------------------------------------------ | +| List Available Tasks | `task` | Syncs dependencies before listing tasks | +| 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 -- ` | 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 diff --git a/template/Taskfile.yaml b/template/Taskfile.yaml index 76232f3..d0354aa 100644 --- a/template/Taskfile.yaml +++ b/template/Taskfile.yaml @@ -10,13 +10,13 @@ vars: tasks: ####################################### default: - desc: Install Project, List Tasks + desc: List Available Tasks cmds: - task --list-all deps: [sync] ####################################### install: - desc: Install Project Dev Environment + desc: Install Project + Dev Dependencies cmds: - task: pre-commit-install - task: sync @@ -44,39 +44,39 @@ tasks: UV_PYTHON: "{{"{{"}}.ITEM.PYTHON{{"}}"}}" ####################################### check:format: - desc: Check Code Formatting + desc: Code Quality Check - Formatting cmds: - task: fmt vars: CLI_ARGS: --check ####################################### check:lint: - desc: Run Ruff Linter + desc: Code Quality Check - Linting cmds: - uv run -- ruff check {{"{{"}}.CLI_ARGS | default .ROOT_DIR{{"}}"}} deps: [sync] ####################################### check:style: - desc: Check Code Style + desc: Code Quality Check - Formatting + Linting cmds: - task: check:format - task: check:lint ####################################### fmt: - desc: Run Code Formatters + desc: Code Quality Auto-Fix - Formatting cmds: - uv run -- ruff format {{"{{"}}.CLI_ARGS | default .ROOT_DIR{{"}}"}} deps: [sync] ####################################### fix: - desc: Auto-fix Code Formatting and Style + desc: Code Quality Auto-Fix - Formatting + Linting cmds: - task: fmt - uv run -- ruff check --fix {{"{{"}}.CLI_ARGS | default .ROOT_DIR{{"}}"}} deps: [sync] ####################################### check:types: - desc: Run Static Type Checks + desc: Code Quality Check - Type Checking cmds: - | uv run -- \ @@ -87,13 +87,13 @@ tasks: - '[$(uv tree --package mypy) != ""]' ####################################### check: - desc: Check Code Formatting, Linting, and Type Checking + desc: Code Quality Check - Formatting + Linting + Type Checking cmds: - task: check:style - task: check:types ####################################### dist: - desc: Build the Project Artifacts + desc: Build Distribution Artifacts cmds: - cmd: rm -rf {{"{{"}}.ROOT_DIR{{"}}"}}/dist - cmd: uv build @@ -122,7 +122,7 @@ tasks: - task: docker ####################################### publish: - desc: Publish the Project Artifacts + desc: Publish Docker Image cmds: - task: docker vars: @@ -133,18 +133,18 @@ tasks: - test ! -f {{"{{"}}.ROOT_DIR{{"}}"}}/{{"{{"}}.DOCKERFILE | default "Dockerfile"{{"}}"}} ####################################### 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{{"}}"}} ####################################### docker-run: - desc: Run Command within Docker Container (supports "--" for command) + desc: Run Docker Command (requires "--") interactive: true cmds: - | @@ -162,7 +162,7 @@ tasks: vars: [DOCKER_REPO] ####################################### lock: - desc: Regenerate the Project Lockfile + desc: Regenerate Project Lockfile cmds: - uv lock env: diff --git a/template/docs/contributing.md b/template/docs/contributing.md index ff4770d..54c43c2 100644 --- a/template/docs/contributing.md +++ b/template/docs/contributing.md @@ -37,24 +37,24 @@ manager) and **[task]** (task runner). Once both are installed, you can use | Command Description | Command | Notes | | ------------------------------- | --------------------------- | ----------------------------------------------- | | List Available Tasks | `task` | Syncs dependencies before listing tasks | -| Install Project Dev Environment | `task install` | Installs dependencies and pre-commit hooks | +| Install Project + Dev Dependencies | `task install` | Installs dependencies and pre-commit hooks | | Run Tests | `task test` | Runs tests with `pytest` | | Run Tests across Python Versions | `task test:matrix` | Runs tests on Python 3.10 through 3.14 | -| Check Code Formatting | `task check:format` | Checks formatting with `ruff` | -| Check Code Linting | `task check:lint` | Checks linting with `ruff` | -| Check Code Formatting and Linting | `task check:style` | Runs formatting and linting checks | -| Check Type Annotations | `task check:types` | Checks types with `mypy` | -| Check Code Formatting, Linting, and Type Checking | `task check` | Runs all code checks | -| Format Code | `task fmt` | Formats code with `ruff` | -| Auto-fix Code Formatting and Style | `task fix` | Formats code and applies `ruff` fixes | +| Code Quality Check - Formatting | `task check:format` | Checks formatting with `ruff` | +| Code Quality Check - Linting | `task check:lint` | Checks linting with `ruff` | +| Code Quality Check - Formatting + Linting | `task check:style` | Runs formatting and linting checks | +| Code Quality Check - Type Checking | `task check:types` | Checks types with `mypy` | +| Code Quality Check - Formatting + Linting + Type Checking | `task check` | Runs all code checks | +| Code Quality Auto-Fix - Formatting | `task fmt` | Formats code with `ruff` | +| Code Quality Auto-Fix - Formatting + Linting | `task fix` | Formats code and applies `ruff` fixes | | Build Distribution Artifacts | `task dist` | Builds Python distribution artifacts | | Build Docker Image | `task docker` | Builds the Docker image when a Dockerfile exists | | Build Project Artifacts | `task build` | Builds distribution artifacts and Docker image | | Publish Docker Image | `task publish` | Pushes the Docker image in CI | | Run Documentation Site | `task docs` | Runs MkDocs | -| Run a Project Command | `task run -- ` | Runs a command in the project environment | -| Run a Docker Command | `task docker-run -- ` | Runs a command in the Docker image | -| Update Dependency Lockfile | `task lock` | Regenerates `uv.lock` | +| Run Project Command | `task run -- ` | Runs a command in the project environment | +| Run Docker Command | `task docker-run -- ` | Runs a command in the Docker image | +| Regenerate Project Lockfile | `task lock` | Regenerates `uv.lock` | ### Task Explanation diff --git a/tests/example-project/Taskfile.yaml b/tests/example-project/Taskfile.yaml index 5cddc26..9678d16 100644 --- a/tests/example-project/Taskfile.yaml +++ b/tests/example-project/Taskfile.yaml @@ -10,13 +10,13 @@ vars: tasks: ####################################### default: - desc: Install Project, List Tasks + desc: List Available Tasks cmds: - task --list-all deps: [sync] ####################################### install: - desc: Install Project Dev Environment + desc: Install Project + Dev Dependencies cmds: - task: pre-commit-install - task: sync @@ -44,39 +44,39 @@ tasks: UV_PYTHON: "{{.ITEM.PYTHON}}" ####################################### check:format: - desc: Check Code Formatting + desc: Code Quality Check - Formatting cmds: - task: fmt vars: CLI_ARGS: --check ####################################### check:lint: - desc: Run Ruff Linter + desc: Code Quality Check - Linting cmds: - uv run -- ruff check {{.CLI_ARGS | default .ROOT_DIR}} deps: [sync] ####################################### check:style: - desc: Check Code Style + desc: Code Quality Check - Formatting + Linting cmds: - task: check:format - task: check:lint ####################################### fmt: - desc: Run Code Formatters + desc: Code Quality Auto-Fix - Formatting cmds: - uv run -- ruff format {{.CLI_ARGS | default .ROOT_DIR}} deps: [sync] ####################################### fix: - desc: Auto-fix Code Formatting and Style + desc: Code Quality Auto-Fix - Formatting + Linting cmds: - task: fmt - uv run -- ruff check --fix {{.CLI_ARGS | default .ROOT_DIR}} deps: [sync] ####################################### check:types: - desc: Run Static Type Checks + desc: Code Quality Check - Type Checking cmds: - | uv run -- \ @@ -87,13 +87,13 @@ tasks: - '[$(uv tree --package mypy) != ""]' ####################################### check: - desc: Check Code Formatting, Linting, and Type Checking + desc: Code Quality Check - Formatting + Linting + Type Checking cmds: - task: check:style - task: check:types ####################################### dist: - desc: Build the Project Artifacts + desc: Build Distribution Artifacts cmds: - cmd: rm -rf {{.ROOT_DIR}}/dist - cmd: uv build @@ -122,7 +122,7 @@ tasks: - task: docker ####################################### publish: - desc: Publish the Project Artifacts + desc: Publish Docker Image cmds: - task: docker vars: @@ -133,18 +133,18 @@ tasks: - test ! -f {{.ROOT_DIR}}/{{.DOCKERFILE | default "Dockerfile"}} ####################################### 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}} ####################################### docker-run: - desc: Run Command within Docker Container (supports "--" for command) + desc: Run Docker Command (requires "--") interactive: true cmds: - | @@ -162,7 +162,7 @@ tasks: vars: [DOCKER_REPO] ####################################### lock: - desc: Regenerate the Project Lockfile + desc: Regenerate Project Lockfile cmds: - uv lock env: diff --git a/tests/example-project/docs/contributing.md b/tests/example-project/docs/contributing.md index ff4770d..54c43c2 100644 --- a/tests/example-project/docs/contributing.md +++ b/tests/example-project/docs/contributing.md @@ -37,24 +37,24 @@ manager) and **[task]** (task runner). Once both are installed, you can use | Command Description | Command | Notes | | ------------------------------- | --------------------------- | ----------------------------------------------- | | List Available Tasks | `task` | Syncs dependencies before listing tasks | -| Install Project Dev Environment | `task install` | Installs dependencies and pre-commit hooks | +| Install Project + Dev Dependencies | `task install` | Installs dependencies and pre-commit hooks | | Run Tests | `task test` | Runs tests with `pytest` | | Run Tests across Python Versions | `task test:matrix` | Runs tests on Python 3.10 through 3.14 | -| Check Code Formatting | `task check:format` | Checks formatting with `ruff` | -| Check Code Linting | `task check:lint` | Checks linting with `ruff` | -| Check Code Formatting and Linting | `task check:style` | Runs formatting and linting checks | -| Check Type Annotations | `task check:types` | Checks types with `mypy` | -| Check Code Formatting, Linting, and Type Checking | `task check` | Runs all code checks | -| Format Code | `task fmt` | Formats code with `ruff` | -| Auto-fix Code Formatting and Style | `task fix` | Formats code and applies `ruff` fixes | +| Code Quality Check - Formatting | `task check:format` | Checks formatting with `ruff` | +| Code Quality Check - Linting | `task check:lint` | Checks linting with `ruff` | +| Code Quality Check - Formatting + Linting | `task check:style` | Runs formatting and linting checks | +| Code Quality Check - Type Checking | `task check:types` | Checks types with `mypy` | +| Code Quality Check - Formatting + Linting + Type Checking | `task check` | Runs all code checks | +| Code Quality Auto-Fix - Formatting | `task fmt` | Formats code with `ruff` | +| Code Quality Auto-Fix - Formatting + Linting | `task fix` | Formats code and applies `ruff` fixes | | Build Distribution Artifacts | `task dist` | Builds Python distribution artifacts | | Build Docker Image | `task docker` | Builds the Docker image when a Dockerfile exists | | Build Project Artifacts | `task build` | Builds distribution artifacts and Docker image | | Publish Docker Image | `task publish` | Pushes the Docker image in CI | | Run Documentation Site | `task docs` | Runs MkDocs | -| Run a Project Command | `task run -- ` | Runs a command in the project environment | -| Run a Docker Command | `task docker-run -- ` | Runs a command in the Docker image | -| Update Dependency Lockfile | `task lock` | Regenerates `uv.lock` | +| Run Project Command | `task run -- ` | Runs a command in the project environment | +| Run Docker Command | `task docker-run -- ` | Runs a command in the Docker image | +| Regenerate Project Lockfile | `task lock` | Regenerates `uv.lock` | ### Task Explanation From fe0b567802de82cb5a0cc4fe9a223cbd51b52824 Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sun, 2 Aug 2026 14:58:25 -0600 Subject: [PATCH 12/14] =?UTF-8?q?=F0=9F=91=B7=20(ci):=20limit=20main=20pus?= =?UTF-8?q?hes=20to=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 103 ++++++++++++------ template/.github/workflows/ci.yaml | 63 ++++++----- .../example-project/.github/workflows/ci.yaml | 63 ++++++----- 3 files changed, 145 insertions(+), 84 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c96ded4..06c1c58 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,7 @@ permissions: pull-requests: write jobs: - ci: + test: name: ${{ matrix.name }} runs-on: ubuntu-24.04 concurrency: @@ -28,29 +28,6 @@ jobs: task: test install: 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 @@ -80,6 +57,74 @@ jobs: pytest_coverage: true pytest_coverage_xml: tests/example-project/coverage.xml pytest_coverage_junit: tests/example-project/pytest.xml + steps: + - name: lock template project + if: matrix.template || false + uses: juftin/actions/taskfile@v1 + with: + task: lock + task-args: --taskfile tests/example-project/Taskfile.yaml + checkout: true + setup-uv: true + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: install template project + if: matrix.template && matrix.install + 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 }} + uses: juftin/actions/taskfile@v1 + with: + task: ${{ matrix.task }} + task-args: ${{ matrix.template && '--taskfile tests/example-project/Taskfile.yaml' || '' }} + checkout: ${{ !matrix.template }} + install: ${{ !matrix.template && matrix.install || false }} + setup-task: ${{ !matrix.template }} + setup-uv: ${{ !matrix.template }} + github-token: ${{ secrets.GITHUB_TOKEN }} + 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 || '' }} + ci: + if: github.event_name == 'pull_request' + 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: 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 - pre-commit task: install template: true @@ -110,7 +155,7 @@ jobs: task: ${{ matrix.task }} task-args: ${{ matrix.template && '--taskfile tests/example-project/Taskfile.yaml' || '' }} checkout: ${{ !matrix.template }} - install: ${{ matrix.install || false }} + install: ${{ !matrix.template && matrix.install || false }} fetch-depth: ${{ matrix.pre_commit && '0' || '1' }} setup-task: ${{ !matrix.template }} setup-uv: ${{ !matrix.template }} @@ -118,14 +163,8 @@ jobs: 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' + if: matrix.pre_commit run: | uv tool run --isolated \ --with pre-commit-uv \ diff --git a/template/.github/workflows/ci.yaml b/template/.github/workflows/ci.yaml index 4ff9aa0..6302dd0 100644 --- a/template/.github/workflows/ci.yaml +++ b/template/.github/workflows/ci.yaml @@ -14,7 +14,41 @@ permissions: pull-requests: write jobs: + test: + name: test - ${{"{{"}} matrix.python {{"}}"}} + runs-on: ubuntu-24.04 + concurrency: + group: ${{"{{"}} github.workflow {{"}}"}}-${{"{{"}} matrix.python {{"}}"}}-${{"{{"}} github.event.pull_request.number {{"}}"}} + cancel-in-progress: true + strategy: + fail-fast: false + matrix: + include: + - python: "3.10" + install: true + - python: "3.11" + install: true + - python: "3.12" + install: true + - python: "3.13" + install: true + - python: "3.14" + install: true + steps: + - name: test + uses: juftin/actions/taskfile@v1 + with: + task: test + checkout: true + install: ${{"{{"}} matrix.install {{"}}"}} + setup-uv: true + github-token: ${{"{{"}} secrets.GITHUB_TOKEN {{"}}"}} + 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 {{"}}"}} ci: + if: github.event_name == 'pull_request' name: ${{"{{"}} matrix.name {{"}}"}} runs-on: ubuntu-24.04 concurrency: @@ -38,29 +72,10 @@ jobs: task: check:types install: true annotations_mypy: true - - name: test - 3.10 - task: test - install: true - python: "3.10" - - name: test - 3.11 - task: test - install: true - python: "3.11" - - name: test - 3.12 - task: test - install: true - python: "3.12" - - name: test - 3.13 - task: test - install: true - python: "3.13" - - name: test - 3.14 - task: test - install: true - python: "3.14" - name: pre-commit task: install install: true + pre_commit: true steps: - name: ${{"{{"}} matrix.name {{"}}"}} uses: juftin/actions/taskfile@v1 @@ -68,18 +83,14 @@ jobs: task: ${{"{{"}} matrix.task {{"}}"}} checkout: true install: ${{"{{"}} matrix.install || false {{"}}"}} - fetch-depth: ${{"{{"}} matrix.name == 'pre-commit' && '0' || '1' {{"}}"}} + fetch-depth: ${{"{{"}} matrix.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' + if: matrix.pre_commit run: | uv tool run --isolated \ --with pre-commit-uv \ diff --git a/tests/example-project/.github/workflows/ci.yaml b/tests/example-project/.github/workflows/ci.yaml index 244275b..16e21e2 100644 --- a/tests/example-project/.github/workflows/ci.yaml +++ b/tests/example-project/.github/workflows/ci.yaml @@ -14,7 +14,41 @@ permissions: pull-requests: write jobs: + test: + name: test - ${{ matrix.python }} + runs-on: ubuntu-24.04 + concurrency: + group: ${{ github.workflow }}-${{ matrix.python }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + strategy: + fail-fast: false + matrix: + include: + - python: "3.10" + install: true + - python: "3.11" + install: true + - python: "3.12" + install: true + - python: "3.13" + install: true + - python: "3.14" + install: true + steps: + - name: test + uses: juftin/actions/taskfile@v1 + with: + task: test + checkout: true + install: ${{ matrix.install }} + setup-uv: true + github-token: ${{ secrets.GITHUB_TOKEN }} + annotations-pytest: ${{ matrix.python == '3.14' }} + pytest-coverage: ${{ matrix.python == '3.14' && github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork }} + env: + UV_PYTHON: ${{ matrix.python }} ci: + if: github.event_name == 'pull_request' name: ${{ matrix.name }} runs-on: ubuntu-24.04 concurrency: @@ -38,29 +72,10 @@ jobs: task: check:types install: true annotations_mypy: true - - name: test - 3.10 - task: test - install: true - python: "3.10" - - name: test - 3.11 - task: test - install: true - python: "3.11" - - name: test - 3.12 - task: test - install: true - python: "3.12" - - name: test - 3.13 - task: test - install: true - python: "3.13" - - name: test - 3.14 - task: test - install: true - python: "3.14" - name: pre-commit task: install install: true + pre_commit: true steps: - name: ${{ matrix.name }} uses: juftin/actions/taskfile@v1 @@ -68,18 +83,14 @@ jobs: task: ${{ matrix.task }} checkout: true install: ${{ matrix.install || false }} - fetch-depth: ${{ matrix.name == 'pre-commit' && '0' || '1' }} + fetch-depth: ${{ matrix.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 == '3.14' }} - pytest-coverage: ${{ matrix.python == '3.14' && 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' + if: matrix.pre_commit run: | uv tool run --isolated \ --with pre-commit-uv \ From 67072934385f4cfc75b0a3b01e89a5fdd2555419 Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sun, 2 Aug 2026 15:04:06 -0600 Subject: [PATCH 13/14] =?UTF-8?q?=F0=9F=91=B7=20(ci):=20gate=20pushes=20by?= =?UTF-8?q?=20matrix=20entry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 114 +++++++----------- template/.github/workflows/ci.yaml | 69 +++++------ .../example-project/.github/workflows/ci.yaml | 69 +++++------ 3 files changed, 105 insertions(+), 147 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 06c1c58..ff08924 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,7 @@ permissions: pull-requests: write jobs: - test: + ci: name: ${{ matrix.name }} runs-on: ubuntu-24.04 concurrency: @@ -27,104 +27,65 @@ jobs: - 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 - steps: - - name: lock template project - if: matrix.template || false - uses: juftin/actions/taskfile@v1 - with: - task: lock - task-args: --taskfile tests/example-project/Taskfile.yaml - checkout: true - setup-uv: true - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: install template project - if: matrix.template && matrix.install - 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 }} - uses: juftin/actions/taskfile@v1 - with: - task: ${{ matrix.task }} - task-args: ${{ matrix.template && '--taskfile tests/example-project/Taskfile.yaml' || '' }} - checkout: ${{ !matrix.template }} - install: ${{ !matrix.template && matrix.install || false }} - setup-task: ${{ !matrix.template }} - setup-uv: ${{ !matrix.template }} - github-token: ${{ secrets.GITHUB_TOKEN }} - 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 || '' }} - ci: - if: github.event_name == 'pull_request' - 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: 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 - pre-commit task: install template: true @@ -132,7 +93,7 @@ jobs: pre_commit: true steps: - name: lock template project - if: matrix.template || false + if: (matrix.template || false) && (github.event_name == 'pull_request' || matrix.run_on_push) uses: juftin/actions/taskfile@v1 with: task: lock @@ -142,7 +103,7 @@ jobs: setup-uv: true github-token: ${{ secrets.GITHUB_TOKEN }} - name: install template project - if: matrix.template && matrix.install + if: matrix.template && matrix.install && (github.event_name == 'pull_request' || matrix.run_on_push) uses: juftin/actions/taskfile@v1 with: task: install @@ -150,12 +111,13 @@ jobs: 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.template && matrix.install || false }} + install: ${{ matrix.install || false }} fetch-depth: ${{ matrix.pre_commit && '0' || '1' }} setup-task: ${{ !matrix.template }} setup-uv: ${{ !matrix.template }} @@ -163,8 +125,14 @@ jobs: 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 + if: matrix.pre_commit && github.event_name == 'pull_request' run: | uv tool run --isolated \ --with pre-commit-uv \ diff --git a/template/.github/workflows/ci.yaml b/template/.github/workflows/ci.yaml index 6302dd0..5403b2f 100644 --- a/template/.github/workflows/ci.yaml +++ b/template/.github/workflows/ci.yaml @@ -14,41 +14,7 @@ permissions: pull-requests: write jobs: - test: - name: test - ${{"{{"}} matrix.python {{"}}"}} - runs-on: ubuntu-24.04 - concurrency: - group: ${{"{{"}} github.workflow {{"}}"}}-${{"{{"}} matrix.python {{"}}"}}-${{"{{"}} github.event.pull_request.number {{"}}"}} - cancel-in-progress: true - strategy: - fail-fast: false - matrix: - include: - - python: "3.10" - install: true - - python: "3.11" - install: true - - python: "3.12" - install: true - - python: "3.13" - install: true - - python: "3.14" - install: true - steps: - - name: test - uses: juftin/actions/taskfile@v1 - with: - task: test - checkout: true - install: ${{"{{"}} matrix.install {{"}}"}} - setup-uv: true - github-token: ${{"{{"}} secrets.GITHUB_TOKEN {{"}}"}} - 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 {{"}}"}} ci: - if: github.event_name == 'pull_request' name: ${{"{{"}} matrix.name {{"}}"}} runs-on: ubuntu-24.04 concurrency: @@ -72,25 +38,54 @@ jobs: 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 - pre_commit: 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.pre_commit && '0' || '1' {{"}}"}} + 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.pre_commit + if: matrix.name == 'pre-commit' && github.event_name == 'pull_request' run: | uv tool run --isolated \ --with pre-commit-uv \ diff --git a/tests/example-project/.github/workflows/ci.yaml b/tests/example-project/.github/workflows/ci.yaml index 16e21e2..30fc29c 100644 --- a/tests/example-project/.github/workflows/ci.yaml +++ b/tests/example-project/.github/workflows/ci.yaml @@ -14,41 +14,7 @@ permissions: pull-requests: write jobs: - test: - name: test - ${{ matrix.python }} - runs-on: ubuntu-24.04 - concurrency: - group: ${{ github.workflow }}-${{ matrix.python }}-${{ github.event.pull_request.number }} - cancel-in-progress: true - strategy: - fail-fast: false - matrix: - include: - - python: "3.10" - install: true - - python: "3.11" - install: true - - python: "3.12" - install: true - - python: "3.13" - install: true - - python: "3.14" - install: true - steps: - - name: test - uses: juftin/actions/taskfile@v1 - with: - task: test - checkout: true - install: ${{ matrix.install }} - setup-uv: true - github-token: ${{ secrets.GITHUB_TOKEN }} - annotations-pytest: ${{ matrix.python == '3.14' }} - pytest-coverage: ${{ matrix.python == '3.14' && github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork }} - env: - UV_PYTHON: ${{ matrix.python }} ci: - if: github.event_name == 'pull_request' name: ${{ matrix.name }} runs-on: ubuntu-24.04 concurrency: @@ -72,25 +38,54 @@ jobs: 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 - pre_commit: 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.pre_commit && '0' || '1' }} + 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 == '3.14' }} + pytest-coverage: ${{ matrix.python == '3.14' && github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork }} + env: + UV_PYTHON: ${{ matrix.python || '' }} - name: pre-commit - if: matrix.pre_commit + if: matrix.name == 'pre-commit' && github.event_name == 'pull_request' run: | uv tool run --isolated \ --with pre-commit-uv \ From cac61e3b0ebf1319152d3c226cac6ad7d9e4b18e Mon Sep 17 00:00:00 2001 From: Justin Flannery Date: Sun, 2 Aug 2026 15:12:00 -0600 Subject: [PATCH 14/14] =?UTF-8?q?=F0=9F=93=9D=20organize=20task=20workflow?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Taskfile.yaml | 32 +++++++---- docs/contributing.md | 2 +- template/Taskfile.yaml | 62 ++++++++++++++-------- template/docs/contributing.md | 2 +- tests/example-project/Taskfile.yaml | 62 ++++++++++++++-------- tests/example-project/docs/contributing.md | 2 +- 6 files changed, 103 insertions(+), 59 deletions(-) diff --git a/Taskfile.yaml b/Taskfile.yaml index 217e875..c652f95 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -6,19 +6,25 @@ env: UV_LOCKED: 1 tasks: - ####################################### + ######################## + # DEFAULT TASK + ######################## default: 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 Copier Tests cmds: @@ -30,7 +36,9 @@ tasks: CLI_ARGS: --quiet env: UV_PYTHON: "{{.UV_PYTHON}}" - ####################################### + ######################## + # DOCUMENTATION AND COMMANDS + ######################## docs: desc: Run Documentation Site cmds: @@ -41,22 +49,26 @@ tasks: interactive: true cmds: - uv run -- {{.CLI_ARGS}} - ####################################### + ######################## + # DEPENDENCY MANAGEMENT + ######################## lock: desc: Regenerate Project Lockfile cmds: - uv lock env: UV_LOCKED: "0" - ####################################### + ######################## + # GENERATED PROJECT FIXTURE + ######################## example-project: 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 diff --git a/docs/contributing.md b/docs/contributing.md index 3d61e87..a8f68db 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -36,7 +36,7 @@ manager) and **[task]** (task runner). Once both are installed, you can use | Command Description | Command | Notes | | ---------------------------------- | ---------------------- | ------------------------------------------ | -| List Available Tasks | `task` | Syncs dependencies before listing tasks | +| 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 | diff --git a/template/Taskfile.yaml b/template/Taskfile.yaml index d0354aa..9dc0c4e 100644 --- a/template/Taskfile.yaml +++ b/template/Taskfile.yaml @@ -8,19 +8,25 @@ vars: DOCKER_REPO: {{ github_user }}/{{ package_name }} tasks: - ####################################### + ######################## + # DEFAULT TASK + ######################## default: 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 cmds: @@ -42,7 +48,9 @@ tasks: task: test vars: UV_PYTHON: "{{"{{"}}.ITEM.PYTHON{{"}}"}}" - ####################################### + ######################## + # CODE QUALITY CHECKS + ######################## check:format: desc: Code Quality Check - Formatting cmds: @@ -62,19 +70,6 @@ tasks: - task: check:format - task: check:lint ####################################### - fmt: - desc: Code Quality Auto-Fix - Formatting - cmds: - - uv run -- ruff format {{"{{"}}.CLI_ARGS | default .ROOT_DIR{{"}}"}} - deps: [sync] - ####################################### - fix: - desc: Code Quality Auto-Fix - Formatting + Linting - cmds: - - task: fmt - - uv run -- ruff check --fix {{"{{"}}.CLI_ARGS | default .ROOT_DIR{{"}}"}} - deps: [sync] - ####################################### check:types: desc: Code Quality Check - Type Checking cmds: @@ -91,7 +86,24 @@ tasks: cmds: - task: check:style - task: check:types + ######################## + # CODE QUALITY FIXES + ######################## + fmt: + desc: Code Quality Auto-Fix - Formatting + cmds: + - uv run -- ruff format {{"{{"}}.CLI_ARGS | default .ROOT_DIR{{"}}"}} + deps: [sync] ####################################### + fix: + desc: Code Quality Auto-Fix - Formatting + Linting + cmds: + - task: fmt + - uv run -- ruff check --fix {{"{{"}}.CLI_ARGS | default .ROOT_DIR{{"}}"}} + deps: [sync] + ######################## + # BUILD AND PUBLISH + ######################## dist: desc: Build Distribution Artifacts cmds: @@ -131,7 +143,9 @@ tasks: vars: [CI, RELEASE_VERSION] status: - test ! -f {{"{{"}}.ROOT_DIR{{"}}"}}/{{"{{"}}.DOCKERFILE | default "Dockerfile"{{"}}"}} - ####################################### + ######################## + # DOCUMENTATION AND COMMANDS + ######################## docs: desc: Run Documentation Site cmds: @@ -160,16 +174,18 @@ tasks: - test ! -f {{"{{"}}.ROOT_DIR{{"}}"}}/{{"{{"}}.DOCKERFILE | default "Dockerfile"{{"}}"}} requires: vars: [DOCKER_REPO] - ####################################### + ######################## + # DEPENDENCY MANAGEMENT + ######################## lock: desc: Regenerate Project Lockfile cmds: - uv lock env: UV_LOCKED: "0" - ####################################### + ######################## # INTERNAL TASKS - ####################################### + ######################## sync: desc: Install Project Dependencies internal: true diff --git a/template/docs/contributing.md b/template/docs/contributing.md index 54c43c2..7a74eed 100644 --- a/template/docs/contributing.md +++ b/template/docs/contributing.md @@ -36,7 +36,7 @@ manager) and **[task]** (task runner). Once both are installed, you can use | Command Description | Command | Notes | | ------------------------------- | --------------------------- | ----------------------------------------------- | -| List Available Tasks | `task` | Syncs dependencies before listing tasks | +| List Available Tasks | `task` | Lists tasks in alphanumeric order | | Install Project + Dev Dependencies | `task install` | Installs dependencies and pre-commit hooks | | Run Tests | `task test` | Runs tests with `pytest` | | Run Tests across Python Versions | `task test:matrix` | Runs tests on Python 3.10 through 3.14 | diff --git a/tests/example-project/Taskfile.yaml b/tests/example-project/Taskfile.yaml index 9678d16..3094049 100644 --- a/tests/example-project/Taskfile.yaml +++ b/tests/example-project/Taskfile.yaml @@ -8,19 +8,25 @@ vars: DOCKER_REPO: juftin/example-project tasks: - ####################################### + ######################## + # DEFAULT TASK + ######################## default: 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 cmds: @@ -42,7 +48,9 @@ tasks: task: test vars: UV_PYTHON: "{{.ITEM.PYTHON}}" - ####################################### + ######################## + # CODE QUALITY CHECKS + ######################## check:format: desc: Code Quality Check - Formatting cmds: @@ -62,19 +70,6 @@ tasks: - task: check:format - task: check:lint ####################################### - fmt: - desc: Code Quality Auto-Fix - Formatting - cmds: - - uv run -- ruff format {{.CLI_ARGS | default .ROOT_DIR}} - deps: [sync] - ####################################### - fix: - desc: Code Quality Auto-Fix - Formatting + Linting - cmds: - - task: fmt - - uv run -- ruff check --fix {{.CLI_ARGS | default .ROOT_DIR}} - deps: [sync] - ####################################### check:types: desc: Code Quality Check - Type Checking cmds: @@ -91,7 +86,24 @@ tasks: cmds: - task: check:style - task: check:types + ######################## + # CODE QUALITY FIXES + ######################## + fmt: + desc: Code Quality Auto-Fix - Formatting + cmds: + - uv run -- ruff format {{.CLI_ARGS | default .ROOT_DIR}} + deps: [sync] ####################################### + fix: + desc: Code Quality Auto-Fix - Formatting + Linting + cmds: + - task: fmt + - uv run -- ruff check --fix {{.CLI_ARGS | default .ROOT_DIR}} + deps: [sync] + ######################## + # BUILD AND PUBLISH + ######################## dist: desc: Build Distribution Artifacts cmds: @@ -131,7 +143,9 @@ tasks: vars: [CI, RELEASE_VERSION] status: - test ! -f {{.ROOT_DIR}}/{{.DOCKERFILE | default "Dockerfile"}} - ####################################### + ######################## + # DOCUMENTATION AND COMMANDS + ######################## docs: desc: Run Documentation Site cmds: @@ -160,16 +174,18 @@ tasks: - test ! -f {{.ROOT_DIR}}/{{.DOCKERFILE | default "Dockerfile"}} requires: vars: [DOCKER_REPO] - ####################################### + ######################## + # DEPENDENCY MANAGEMENT + ######################## lock: desc: Regenerate Project Lockfile cmds: - uv lock env: UV_LOCKED: "0" - ####################################### + ######################## # INTERNAL TASKS - ####################################### + ######################## sync: desc: Install Project Dependencies internal: true diff --git a/tests/example-project/docs/contributing.md b/tests/example-project/docs/contributing.md index 54c43c2..7a74eed 100644 --- a/tests/example-project/docs/contributing.md +++ b/tests/example-project/docs/contributing.md @@ -36,7 +36,7 @@ manager) and **[task]** (task runner). Once both are installed, you can use | Command Description | Command | Notes | | ------------------------------- | --------------------------- | ----------------------------------------------- | -| List Available Tasks | `task` | Syncs dependencies before listing tasks | +| List Available Tasks | `task` | Lists tasks in alphanumeric order | | Install Project + Dev Dependencies | `task install` | Installs dependencies and pre-commit hooks | | Run Tests | `task test` | Runs tests with `pytest` | | Run Tests across Python Versions | `task test:matrix` | Runs tests on Python 3.10 through 3.14 |