diff --git a/.github/workflows/worker.yml b/.github/workflows/worker.yml index 1b533d82..33949a52 100644 --- a/.github/workflows/worker.yml +++ b/.github/workflows/worker.yml @@ -30,10 +30,13 @@ jobs: with: sparse-checkout: | mise.toml - mise-tasks/* + tasks.toml + tasks/* worker/* sparse-checkout-cone-mode: false + - run: ls -al + - name: Install mise uses: jdx/mise-action@63a673876c7072c1d6ecb2049c0d572976c83b22 # v2.1.7 with: @@ -63,7 +66,8 @@ jobs: with: sparse-checkout: | mise.toml - mise-tasks/* + tasks.toml + tasks/* worker/* sparse-checkout-cone-mode: false diff --git a/mise.toml b/mise.toml index e3c887f3..b3a81480 100644 --- a/mise.toml +++ b/mise.toml @@ -41,188 +41,8 @@ bun = true [settings.pipx] uvx = true -[tasks.commit] -depends = ["buni:root"] -run = ["git add .", "bun run git-cz"] - -[tasks."commit:staged"] -depends = ["buni:root"] -run = "bun run git-cz" - -[tasks.check] -depends = [ - "check:*", # lint and/or fix formatting - "lint:*", # lint only -] - -[tasks.ci] -depends = [ - "ci:*", # lint and/or check formatting - "lint:*", # lint only -] -hide = true - -[tasks."check:biome"] -run = "biome check --write --error-on-warnings" -[tasks."ci:biome"] -run = "biome ci --error-on-warnings" -hide = true - -[tasks."check:tsc"] -depends = ["buni"] -run = [ - "bun run tsc", - "bun run --cwd worker tsc --project tsconfig.base.json", - "bun run --cwd worker tsc --project tsconfig.src.json", - "bun run --cwd worker tsc --project tsconfig.test.json", -] -[tasks."ci:tsc"] -depends = ["buni"] -run = [ - "bun run tsc --incremental false", - "bun run --cwd worker tsc --project tsconfig.base.json --incremental false", - "bun run --cwd worker tsc --project tsconfig.src.json --incremental false", - "bun run --cwd worker tsc --project tsconfig.test.json --incremental false", -] -hide = true - -[tasks."lint:jsonschema"] -# schema of wrangler.jsonc is in node_modules -depends = ["buni:root", "buni:worker"] -run = "bun run scripts/validate-json-schema.ts" -alias = "check:jsonschema" - -[tasks."lint:actionlint"] -run = "actionlint -color" -alias = "check:actionlint" -# SC2312: check-extra-masked-returns -# pipefail is set by shell: bash in GitHub Actions but cannot be detected by shellcheck -# ref: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#defaultsrunshell -env = { "SHELLCHECK_OPTS" = "--enable=all --exclude=SC2312" } - -[tasks."lint:ghalint"] -run = "ghalint run" -alias = "check:ghalint" - -[tasks."check:pinact"] -run = "pinact run --verify" -[tasks."ci:pinact"] -depends = ["check:pinact"] -run = "mise run util:nodiff" -hide = true - -[tasks."check:taplo"] -run = ["taplo lint", "taplo fmt"] -[tasks."ci:taplo"] -run = ["taplo lint", "taplo fmt --check --diff"] -hide = true - -[tasks."check:prettier"] -run = "prettier --write --cache ." -[tasks."ci:prettier"] -run = "prettier --check ." -hide = true - -[tasks."check:markdownlint"] -run = "markdownlint-cli2 --fix" -[tasks."ci:markdownlint"] -run = "markdownlint-cli2" -hide = true - -[tasks."check:shfmt"] -# cannot exclude gitignored files -# ref: https://github.com/mvdan/sh/issues/288 -run = "scripts=$(mise run util:list-scripts) && shfmt --list --write --simplify $scripts" -[tasks."ci:shfmt"] -run = "scripts=$(mise run util:list-scripts) && shfmt --diff --simplify $scripts" -hide = true - -[tasks."lint:shellcheck"] -# recursive globbing is not supported -# ref: https://www.shellcheck.net/wiki/Recursiveness -# ref: https://github.com/koalaman/shellcheck/issues/143 -run = "scripts=$(mise run util:list-scripts) && shellcheck --external-sources $scripts" -alias = "check:shellcheck" - -[tasks."check:yamlfmt"] -run = "yamlfmt ." -[tasks."ci:yamlfmt"] -run = "yamlfmt -lint ." -hide = true - -[tasks."lint:yamllint"] -run = "yamllint --strict ." -alias = "check:yamllint" - -[tasks."lint:renovate"] -run = "renovate-config-validator --strict" -alias = "check:renovate" - -[tasks."check:cspell"] -run = "cspell --cache \"**/*\"" -[tasks."ci:cspell"] -run = "cspell \"**/*\"" -hide = true - -[tasks."check:lychee"] -run = "lychee --cache \"**/*\"" -[tasks."ci:lychee"] -run = "lychee --verbose \"**/*\"" -hide = true - -[tasks."check:typos"] -run = "typos --write-changes" -[tasks."ci:typos"] -run = "typos" -hide = true - -[tasks."check:ignore-sync"] -run = "ignore-sync ." -[tasks."ci:ignore-sync"] -depends = ["check:ignore-sync"] -run = "mise run util:nodiff" -hide = true - -[tasks."worker:dev"] -depends = ["buni:worker"] -dir = "worker" -run = "args=$(mise run worker:wrangler-args) && bun run wrangler dev $args" - -[tasks."worker:test"] -depends = ["buni:worker"] -run = "bun run vitest watch --ui" -dir = "worker" -[tasks."worker:test:ci"] -depends = ["buni:worker"] -run = "bun run vitest run" -dir = "worker" -hide = true - -[tasks."buni"] -depends = ["buni:root", "buni:worker"] - -[tasks."buni:root"] -run = "bun install --frozen-lockfile" -hide = true - -[tasks."buni:worker"] -run = "bun install --frozen-lockfile" -dir = "worker" -hide = true - -[tasks."buni:worker:silent"] -run = "bun install --frozen-lockfile --silent" -dir = "worker" -hide = true - -[tasks."util:nodiff"] # cspell:ignore nodiff -run = ["git add .", "git diff --staged --exit-code"] -hide = true - -[tasks."util:list-scripts"] -# .bashrc is not detected by shfmt --find -run = "git_files=$(git ls-files) && scripts=$(shfmt --find $git_files) && echo wsl/home/.bashrc $scripts" -hide = true +[task_config] +includes = ["tasks.toml", "tasks"] [hooks] # skip in CI diff --git a/tasks.toml b/tasks.toml new file mode 100644 index 00000000..5133008d --- /dev/null +++ b/tasks.toml @@ -0,0 +1,185 @@ +# ref: https://mise.jdx.dev/tasks/ +#:schema https://mise.jdx.dev/schema/mise-task.json + +[commit] +depends = ["buni:root"] +run = ["git add .", "bun run git-cz"] + +["commit:staged"] +depends = ["buni:root"] +run = "bun run git-cz" + +[check] +depends = [ + "check:*", # lint and/or fix formatting + "lint:*", # lint only +] + +[ci] +depends = [ + "ci:*", # lint and/or check formatting + "lint:*", # lint only +] +hide = true + +["check:biome"] +run = "biome check --write --error-on-warnings" +["ci:biome"] +run = "biome ci --error-on-warnings" +hide = true + +["check:tsc"] +depends = ["buni"] +run = [ + "bun run tsc", + "bun run --cwd worker tsc --project tsconfig.base.json", + "bun run --cwd worker tsc --project tsconfig.src.json", + "bun run --cwd worker tsc --project tsconfig.test.json", +] +["ci:tsc"] +depends = ["buni"] +run = [ + "bun run tsc --incremental false", + "bun run --cwd worker tsc --project tsconfig.base.json --incremental false", + "bun run --cwd worker tsc --project tsconfig.src.json --incremental false", + "bun run --cwd worker tsc --project tsconfig.test.json --incremental false", +] +hide = true + +["lint:jsonschema"] +# schema of wrangler.jsonc is in node_modules +depends = ["buni:root", "buni:worker"] +run = "bun run scripts/validate-json-schema.ts" +alias = "check:jsonschema" + +["lint:actionlint"] +run = "actionlint -color" +alias = "check:actionlint" +# SC2312: check-extra-masked-returns +# pipefail is set by shell: bash in GitHub Actions but cannot be detected by shellcheck +# ref: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#defaultsrunshell +env = { "SHELLCHECK_OPTS" = "--enable=all --exclude=SC2312" } + +["lint:ghalint"] +run = "ghalint run" +alias = "check:ghalint" + +["check:pinact"] +run = "pinact run --verify" +["ci:pinact"] +depends = ["check:pinact"] +run = "mise run util:nodiff" +hide = true + +["check:taplo"] +run = ["taplo lint", "taplo fmt"] +["ci:taplo"] +run = ["taplo lint", "taplo fmt --check --diff"] +hide = true + +["check:prettier"] +run = "prettier --write --cache ." +["ci:prettier"] +run = "prettier --check ." +hide = true + +["check:markdownlint"] +run = "markdownlint-cli2 --fix" +["ci:markdownlint"] +run = "markdownlint-cli2" +hide = true + +["check:shfmt"] +# cannot exclude gitignored files +# ref: https://github.com/mvdan/sh/issues/288 +run = "scripts=$(mise run util:list-scripts) && shfmt --list --write --simplify $scripts" +["ci:shfmt"] +run = "scripts=$(mise run util:list-scripts) && shfmt --diff --simplify $scripts" +hide = true + +["lint:shellcheck"] +# recursive globbing is not supported +# ref: https://www.shellcheck.net/wiki/Recursiveness +# ref: https://github.com/koalaman/shellcheck/issues/143 +run = "scripts=$(mise run util:list-scripts) && shellcheck --external-sources $scripts" +alias = "check:shellcheck" + +["check:yamlfmt"] +run = "yamlfmt ." +["ci:yamlfmt"] +run = "yamlfmt -lint ." +hide = true + +["lint:yamllint"] +run = "yamllint --strict ." +alias = "check:yamllint" + +["lint:renovate"] +run = "renovate-config-validator --strict" +alias = "check:renovate" + +["check:cspell"] +run = "cspell --cache \"**/*\"" +["ci:cspell"] +run = "cspell \"**/*\"" +hide = true + +["check:lychee"] +run = "lychee --cache \"**/*\"" +["ci:lychee"] +run = "lychee --verbose \"**/*\"" +hide = true + +["check:typos"] +run = "typos --write-changes" +["ci:typos"] +run = "typos" +hide = true + +["check:ignore-sync"] +run = "ignore-sync ." +["ci:ignore-sync"] +depends = ["check:ignore-sync"] +run = "mise run util:nodiff" +hide = true + +["worker:dev"] +depends = ["buni:worker"] +dir = "worker" +run = "args=$(mise run worker:wrangler-args) && bun run wrangler dev $args" + +["worker:test"] +depends = ["buni:worker"] +run = "bun run vitest watch --ui" +dir = "worker" +["worker:test:ci"] +depends = ["buni:worker"] +run = "bun run vitest run" +dir = "worker" +hide = true + +["buni"] +depends = ["buni:root", "buni:worker"] + +["buni:root"] +run = "bun install --frozen-lockfile" +hide = true + +["buni:worker"] +run = "bun install --frozen-lockfile" +dir = "worker" +hide = true + +["buni:worker:silent"] +run = "bun install --frozen-lockfile --silent" +dir = "worker" +hide = true + +["util:nodiff"] # cspell:ignore nodiff +run = ["git add .", "git diff --staged --exit-code"] +hide = true + +["util:list-scripts"] +# .bashrc is not detected by shfmt --find +run = "git_files=$(git ls-files) && scripts=$(shfmt --find $git_files) && echo wsl/home/.bashrc $scripts" +hide = true diff --git a/mise-tasks/worker/wrangler-args b/tasks/worker/wrangler-args similarity index 100% rename from mise-tasks/worker/wrangler-args rename to tasks/worker/wrangler-args diff --git a/mise-tasks/worker/wrangler-compat-date b/tasks/worker/wrangler-compat-date similarity index 100% rename from mise-tasks/worker/wrangler-compat-date rename to tasks/worker/wrangler-compat-date