chore: added pre-commit back in (#3115)

This commit is contained in:
jdx 2024-11-21 07:07:03 -06:00 committed by GitHub
parent 4fbbc60d30
commit b70f2ebbed
9 changed files with 44 additions and 9 deletions

View File

@ -31,8 +31,8 @@ jobs:
- run: echo "$HOME/bin" >> "$GITHUB_PATH"
- id: versions
run: |
echo "main=$(git rev-parse --short origin/main)" >> $GITHUB_OUTPUT
echo "release=$(mise-release v | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "main=$(git rev-parse --short origin/main)" >> "$GITHUB_OUTPUT"
echo "release=$(mise-release v | awk '{print $1}')" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: $HOME/bin/mise-${{ steps.versions.outputs.main }}
@ -41,12 +41,12 @@ jobs:
run: |
if [ ! -f "$HOME/bin/mise-${{ steps.versions.outputs.main }}" ]; then
git checkout main
cargo build --profile serious && mv target/serious/mise $HOME/bin/mise-${{ steps.versions.outputs.main }}
cargo build --profile serious && mv target/serious/mise "$HOME/bin/mise-${{ steps.versions.outputs.main }}"
git checkout -
fi
- run: mv $HOME/bin/mise-release $HOME/bin/mise-${{ steps.versions.outputs.release }}
- run: cp $HOME/bin/mise-${{ steps.versions.outputs.main }} $HOME/bin/mise-main
- run: cargo build --profile serious && mv target/serious/mise $HOME/bin
- run: mv "$HOME/bin/mise-release" "$HOME/bin/mise-${{ steps.versions.outputs.release }}"
- run: cp "$HOME/bin/mise-${{ steps.versions.outputs.main }}" "$HOME/bin/mise-main"
- run: cargo build --profile serious && mv target/serious/mise "$HOME/bin"
- run: mise i
- run: |
CMDS=(
@ -61,7 +61,7 @@ jobs:
echo "### \`mise $cmd\`" >> comment.md
cat out.md >> comment.md
done
cat comment.md >> $GITHUB_STEP_SUMMARY
cat comment.md >> "$GITHUB_STEP_SUMMARY"
env:
SHELL: zsh
- name: Comment on PR

View File

@ -190,6 +190,7 @@ jobs:
tar -C "$HOME" -xvJf "dist/mise-$version-${{matrix.os == 'ubuntu-latest' && 'linux-x64' || 'macos-arm64'}}.tar.xz"
echo "$HOME/mise/bin" >> "$GITHUB_PATH"
- if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$version = (./scripts/get-version.ps1)
echo "$env:USERPROFILE/mise/bin"

25
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,25 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-added-large-files
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
exclude: "^completions/" # TODO: remove after usage is released again
- repo: https://github.com/rhysd/actionlint
rev: v1.7.4
hooks:
- id: actionlint
- repo: https://github.com/kykosic/pre-commit-rust
rev: 0.4.0
hooks:
- id: cargo-fmt
- id: cargo-check

View File

@ -1,3 +1,7 @@
## `aqua-tester.fish`
- **Usage**: `aqua-tester.fish`
## `build`
- **Usage**: `build`

2
tasks/aqua-tester.fish Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/usr/bin/env fish
cargo b
alias m target/debug/mise
m registry | grep -v '(core|ubi|aqua|vfox):' | awk '{print $1}'> tmp/missing_asdf_tools

View File

@ -10,10 +10,11 @@ scripts_dirs=("$PWD"/scripts "$PWD"/e2e)
cargo clippy --all-features --fix --allow-staged --allow-dirty -- -Dwarnings
shellcheck -x "${scripts[@]}"
shfmt -w -i 2 -ci -bn "${scripts_dirs[@]}"
# shellcheck disable=SC2046
prettier -w $(git ls-files '*.yml' '*.yaml')
prettier -w .
markdownlint --fix .
actionlint -shellcheck ""
actionlint
toml-sort -i settings.toml --spaces-indent-inline-array 4
toml-sort -i registry.toml --spaces-indent-inline-array 4

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
actionlint -shellcheck ""
actionlint

View File

@ -3,6 +3,7 @@
echo "::group::Setup"
set -euxo pipefail
# shellcheck disable=SC1090
source <(cargo llvm-cov show-env --export-prefix)
cargo llvm-cov clean --workspace
if [[ -n "${MISE_GITHUB_BOT_TOKEN:-}" ]]; then

View File

@ -1 +1,2 @@
#!/usr/bin/env bash
echo unix