diff --git a/.config/mise.toml b/.config/mise.toml new file mode 100644 index 0000000..a1883bb --- /dev/null +++ b/.config/mise.toml @@ -0,0 +1,5 @@ +[tools] +dprint = "0.47.6" +lefthook = "latest" +shellcheck = "0.10.0" +shfmt = "3.10" diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index a874560..0fe7e30 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -11,13 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - # No caching as we're expected to run rarely - - name: Install dependencies and run checks + - uses: jdx/mise-action@5bb8f8c1911837cf42064e6490e7634fc842ee7e # v2.1.8 + - name: Run checks env: FORCE_COLOR: true LEFTHOOK_QUIET: meta,execution - WRUN_VERBOSE: true - run: | - set -euxo pipefail - python3 -m pip install --no-cache-dir wrun-py - npm exec --yes -- lefthook run pre-commit --all-files --force --no-tty + run: lefthook run pre-commit --all-files --force --no-tty diff --git a/.github/workflows/update-tools.yaml b/.github/workflows/update-tools.yaml index b6639f8..cd4109a 100644 --- a/.github/workflows/update-tools.yaml +++ b/.github/workflows/update-tools.yaml @@ -10,15 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: jdx/mise-action@5bb8f8c1911837cf42064e6490e7634fc842ee7e # v2.1.8 - name: Check for and prepare updates - env: - FORCE_COLOR: true - LEFTHOOK_QUIET: meta,execution - WRUN_VERBOSE: true - run: | - set -euxo pipefail - python3 -m pip install --no-cache-dir wrun-py - npm exec --yes -- lefthook run update-tools + run: mise upgrade --bump - uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 with: token: ${{ secrets.TOOLS_UPDATE_TOKEN }} diff --git a/.lefthook.yaml b/.lefthook.yaml index 433eccb..dd9af77 100644 --- a/.lefthook.yaml +++ b/.lefthook.yaml @@ -6,21 +6,15 @@ pre-commit: jobs: - name: dprint glob: "*.{json,jsonc,md,yaml}" - env: - WRUN_ARGS_FILE: .lefthook/wrun-args-dprint.txt - run: wrun -- fmt {staged_files} + run: mise exec -- dprint fmt {staged_files} - name: shell-tools glob: vault-token-helper-secret-tool group: jobs: - name: shfmt - env: - WRUN_ARGS_FILE: .lefthook/wrun-args-shfmt.txt - run: wrun -- --write --simplify {staged_files} + run: mise exec -- shfmt --write --simplify {staged_files} - name: shellcheck - env: - WRUN_ARGS_FILE: .lefthook/wrun-args-shellcheck.txt - run: wrun -- --format=gcc {staged_files} + run: mise exec -- shellcheck --format=gcc {staged_files} - name: hook-made-changes run: |- if test -n "${CI-}"; then @@ -31,12 +25,3 @@ pre-commit: rc=$? test $rc -eq 0 || echo "error: found files modified by hooks" >&2 exit $rc - -update-tools: - commands: - dprint: - run: wrun generate github dprint >.lefthook/wrun-args-dprint.txt - shellcheck: - run: wrun generate shellcheck >.lefthook/wrun-args-shellcheck.txt - shfmt: - run: wrun generate github mvdan sh --tool shfmt >.lefthook/wrun-args-shfmt.txt diff --git a/.lefthook/wrun-args-dprint.txt b/.lefthook/wrun-args-dprint.txt deleted file mode 100644 index 8b174d6..0000000 --- a/.lefthook/wrun-args-dprint.txt +++ /dev/null @@ -1,6 +0,0 @@ ---url=darwin/amd64=https://github.com/dprint/dprint/releases/download/0.47.6/dprint-x86_64-apple-darwin.zip#sha256-b54950d447e0d17fcc2732bf99928503deb39b5b764e5b33995449bf6059c857 ---url=darwin/arm64=https://github.com/dprint/dprint/releases/download/0.47.6/dprint-aarch64-apple-darwin.zip#sha256-4f33c24141a19638ab045fe5e95654ff0ef8db29949e145d28ea3cc5b088a042 ---url=linux/amd64=https://github.com/dprint/dprint/releases/download/0.47.6/dprint-x86_64-unknown-linux-musl.zip#sha256-ab0cd8c86d224b51371bb0a5c50418376b153a643d024022977e4d72cad529e6 ---url=linux/arm64=https://github.com/dprint/dprint/releases/download/0.47.6/dprint-aarch64-unknown-linux-musl.zip#sha256-221aaecc5e71d73591b226377064a33b4d15a5aae6788ef11c99a4da540a095d ---url=windows/amd64=https://github.com/dprint/dprint/releases/download/0.47.6/dprint-x86_64-pc-windows-msvc.zip#sha256-0c9abe671652b8da61227b92b0bc038b1e938367fa3d7a9fa3ba523d515d4a9a ---archive-exe-path=dprint diff --git a/.lefthook/wrun-args-shellcheck.txt b/.lefthook/wrun-args-shellcheck.txt deleted file mode 100644 index f2bb1db..0000000 --- a/.lefthook/wrun-args-shellcheck.txt +++ /dev/null @@ -1,13 +0,0 @@ ---url=darwin/amd64=https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.darwin.x86_64.tar.xz#sha256-ef27684f23279d112d8ad84e0823642e43f838993bbb8c0963db9b58a90464c2 ---url=darwin/arm64=https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.darwin.aarch64.tar.xz#sha256-bbd2f14826328eee7679da7221f2bc3afb011f6a928b848c80c321f6046ddf81 ---url=linux/amd64=https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.linux.x86_64.tar.xz#sha256-6c881ab0698e4e6ea235245f22832860544f17ba386442fe7e9d629f8cbedf87 ---url=linux/arm=https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.linux.armv6hf.tar.xz#sha256-1c89cb51e1412b580d7ba8aac240251ffb0b829788f83d2daa4a82da42d275e4 ---url=linux/arm64=https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.linux.aarch64.tar.xz#sha256-324a7e89de8fa2aed0d0c28f3dab59cf84c6d74264022c00c22af665ed1a09bb ---url=linux/riscv64=https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.linux.riscv64.tar.xz#sha256-be1f2028951783424c7a5dc744ac0bab8d5b181189e80f640cc56f481f1e371e ---url=windows/amd64=https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.zip#sha256-eb6cd53a54ea97a56540e9d296ce7e2fa68715aa507ff23574646c1e12b2e143 ---archive-exe-path=darwin/amd64=shellcheck-v0.10.0/shellcheck ---archive-exe-path=darwin/arm64=shellcheck-v0.10.0/shellcheck ---archive-exe-path=linux/amd64=shellcheck-v0.10.0/shellcheck ---archive-exe-path=linux/arm64=shellcheck-v0.10.0/shellcheck ---archive-exe-path=linux/arm=shellcheck-v0.10.0/shellcheck ---archive-exe-path=windows/amd64=shellcheck.exe diff --git a/.lefthook/wrun-args-shfmt.txt b/.lefthook/wrun-args-shfmt.txt deleted file mode 100644 index 173a538..0000000 --- a/.lefthook/wrun-args-shfmt.txt +++ /dev/null @@ -1,8 +0,0 @@ ---url=darwin/amd64=https://github.com/mvdan/sh/releases/download/v3.10.0/shfmt_v3.10.0_darwin_amd64#sha256-ef8d970b3f695a7e8e7d40730eedd2d935ab9599f78a365f319c515bc59d4c83 ---url=darwin/arm64=https://github.com/mvdan/sh/releases/download/v3.10.0/shfmt_v3.10.0_darwin_arm64#sha256-86030533a823c0a7cd92dee0f74094e5b901c3277b43def6337d5e19e56fe553 ---url=linux/386=https://github.com/mvdan/sh/releases/download/v3.10.0/shfmt_v3.10.0_linux_386#sha256-a49ee3616afd262796e6791711ba62759d424cc85808390a5ac516af8001aa72 ---url=linux/amd64=https://github.com/mvdan/sh/releases/download/v3.10.0/shfmt_v3.10.0_linux_amd64#sha256-1f57a384d59542f8fac5f503da1f3ea44242f46dff969569e80b524d64b71dbc ---url=linux/arm=https://github.com/mvdan/sh/releases/download/v3.10.0/shfmt_v3.10.0_linux_arm#sha256-493c612d8f07ad60b3030bd84d7870cca2dc87e0fb06d2fdd93b2264460668db ---url=linux/arm64=https://github.com/mvdan/sh/releases/download/v3.10.0/shfmt_v3.10.0_linux_arm64#sha256-9d23013d56640e228732fd2a04a9ede0ab46bc2d764bf22a4a35fb1b14d707a8 ---url=windows/386=https://github.com/mvdan/sh/releases/download/v3.10.0/shfmt_v3.10.0_windows_386.exe#sha256-695d43b600103d8e8beb7460764f43da1d679576e67130012507a38238ef7dbd ---url=windows/amd64=https://github.com/mvdan/sh/releases/download/v3.10.0/shfmt_v3.10.0_windows_amd64.exe#sha256-6e4c6acd38de7b4b1ba8f8082b9e688df8c9b861d3f8b2e7bb1b7270201a3587