diff --git a/{{cookiecutter.project_basename}}/.github/workflows/main.yml b/{{cookiecutter.project_basename}}/.github/workflows/main.yml index 1ffc828..bea155b 100644 --- a/{{cookiecutter.project_basename}}/.github/workflows/main.yml +++ b/{{cookiecutter.project_basename}}/.github/workflows/main.yml @@ -64,10 +64,10 @@ jobs: steps: - uses: actions/checkout@v4 - uses: astral-sh/setup-uv@v2 + - uses: arduino/setup-task@v2 - name: Run tests run: | - uv sync --frozen - uv run make -C docs linkcheck dirhtml + task setup docs:build-linkcheck docs:build-dirhtml build-test: runs-on: ubuntu-latest steps: diff --git a/{{cookiecutter.project_basename}}/.github/workflows/release.yml b/{{cookiecutter.project_basename}}/.github/workflows/release.yml index ab875b6..608ee7e 100644 --- a/{{cookiecutter.project_basename}}/.github/workflows/release.yml +++ b/{{cookiecutter.project_basename}}/.github/workflows/release.yml @@ -64,14 +64,14 @@ jobs: steps: - uses: actions/checkout@v4 - uses: astral-sh/setup-uv@v2 - - name: Run tests + - uses: arduino/setup-task@v2 + - name: Build document run: | - uv sync --frozen - uv run make -C docs dirhtml + task setup docs:build - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - path: docs/_build/dirhtml + path: docs/_build/mini18n-dirhtml - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 diff --git a/{{cookiecutter.project_basename}}/Taskfile.yaml b/{{cookiecutter.project_basename}}/Taskfile.yaml new file mode 100644 index 0000000..ce82303 --- /dev/null +++ b/{{cookiecutter.project_basename}}/Taskfile.yaml @@ -0,0 +1,30 @@ +version: '3' + +vars: + # If you run bare environment or activated venv, set '' (blank string) + RUN_PYTHON: 'uv run' + +tasks: + setup: + desc: 'Setup workspace' + cmds: + - 'uv sync --frozen' + test: + desc: 'Test environment' + cmds: + - '{{.RUN_PYTHON}} pre-commit run --all-files' + - '{{.RUN_PYTHON}} pytest' + - task: 'docs:intl' + - task: 'docs:build-linkcheck' + - task: 'docs:build-mini18n-dirhtml' + - 'uv build' + release-*: + desc: 'Run elease process' + vars: + LEVEL: '{{index .MATCH 0}}' + cmds: + - 'age {{.LEVEL}}' + - 'uv sync' # To write out as lock-file + +includes: + docs: './docs' diff --git a/{{cookiecutter.project_basename}}/docs/Taskfile.yaml b/{{cookiecutter.project_basename}}/docs/Taskfile.yaml new file mode 100644 index 0000000..d193c56 --- /dev/null +++ b/{{cookiecutter.project_basename}}/docs/Taskfile.yaml @@ -0,0 +1,44 @@ +version: '3' + +vars: + # If you run bare environment or activated venv, set '' (blank string) + # RUN_PYTHON: '' + SPHINX_DEFAULT_BUILD: 'mini18n-dirhtml' + SPHINX_OPTIONS: '' + SPHINX_LANGUAGES: + - 'ja' + +env: + SPHINXINTL_TRANSLATOR: "Kazuya Takei " + +tasks: + intl: + desc: 'Sync i18n environment' + dir: '{{.TASKFILE_DIR}}' + cmds: + - '{{.RUN_PYTHON}} sphinx-build -M gettext . _build {{.SPHINX_OPTIONS}}' + - '{{.RUN_PYTHON}} sphinx-intl update --language={{.SPHINX_LANGUAGES | join ","}}' + dev: + desc: 'Run docs server' + dir: '{{.TASKFILE_DIR}}' + cmds: + - '{{.RUN_PYTHON}} sphinx-autobuild -b dirhtml . _build/dirhtml' + build-*: + desc: 'Make docs' + dir: '{{.TASKFILE_DIR}}' + vars: + TARGET: '{{index .MATCH 0}}' + cmds: + - '{{.RUN_PYTHON}} sphinx-build -M {{.TARGET}} . _build' + build: + desc: 'Make docs (default target)' + deps: + - 'build-{{.SPHINX_DEFAULT_BUILD}}' + help: + desc: 'Display help of docs' + deps: + - 'build-help' + clean: + desc: 'Clean build files of docs' + deps: + - 'build-clean'