Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tasks.toml): split mise task config #1023

Merged
merged 5 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -63,7 +66,8 @@ jobs:
with:
sparse-checkout: |
mise.toml
mise-tasks/*
tasks.toml
tasks/*
worker/*
sparse-checkout-cone-mode: false

Expand Down
184 changes: 2 additions & 182 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading