From fd05359ebf381463bd084ef1e30bea3b6997f39b Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdx@users.noreply.github.com> Date: Sat, 16 Mar 2024 15:34:49 -0500 Subject: [PATCH] chore: cargo update --- .editorconfig | 2 +- .github/workflows/release-plz.yml | 39 ++++ .mise.toml | 9 +- .mise/tasks/release-plz | 22 +++ .../tasks/update-shorthand-repo | 2 +- .prettierignore | 1 + Cargo.lock | 184 +++++++++--------- Cargo.toml | 5 +- README.md | 6 +- cliff.toml | 89 +++++++++ e2e/assert.sh | 56 +++--- justfile | 11 -- release-plz.toml | 5 + scripts/pre-release-hook.sh | 13 -- src/default_shorthands.rs | 4 +- test/fixtures/signal-test.js | 16 +- 16 files changed, 301 insertions(+), 163 deletions(-) create mode 100644 .github/workflows/release-plz.yml create mode 100755 .mise/tasks/release-plz rename scripts/update-shorthand-repo.sh => .mise/tasks/update-shorthand-repo (97%) create mode 100644 .prettierignore create mode 100644 cliff.toml create mode 100644 release-plz.toml delete mode 100755 scripts/pre-release-hook.sh diff --git a/.editorconfig b/.editorconfig index ac106646c7..dc11b59acb 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,7 +2,7 @@ indent_style = space indent_size = 2 -[*.sh] +[{*.sh,.mise/tasks/**/*}] indent_style = space indent_size = 2 diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml new file mode 100644 index 0000000000..de05da1ce8 --- /dev/null +++ b/.github/workflows/release-plz.yml @@ -0,0 +1,39 @@ +name: release-plz + +permissions: + pull-requests: write + contents: write + +on: + push: + branches: + - main + - release-plz + +concurrency: + group: release-plz + +jobs: + release-plz: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} + - uses: kenji-miyake/setup-git-cliff@v1 + - uses: Swatinem/rust-cache@v2 + with: + shared-key: unit + save-if: false + - run: mkdir -p $HOME/bin && echo "$HOME/bin" >> "$GITHUB_PATH" + - run: | + set -euxo pipefail + cargo build + cp target/debug/mise $HOME/bin + mise trust --all + mise settings set experimental true + - run: mise run release-plz + env: + GITHUB_TOKEN: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.mise.toml b/.mise.toml index 686d43a186..25750524d4 100644 --- a/.mise.toml +++ b/.mise.toml @@ -78,7 +78,14 @@ run = "cargo insta test --accept --unreferenced delete" [tasks."lint:fix"] alias = "lint-fix" -run = "just lint-fix" +run = [ + "cargo clippy --fix --allow-staged --allow-dirty -- -Dwarnings", + "cargo fmt --all", + "mise x -y shellcheck@latest -- shellcheck -x scripts/*.sh e2e/{test_,run_}* e2e/*.sh", + "mise x -y shfmt@latest -- shfmt -w scripts/*.sh e2e/{test_,run_}* e2e/*.sh", + "MISE_EXPERIMENTAL=1 mise x -y npm:prettier@latest -- prettier -w $(git ls-files '*.yml' '*.yaml')", + "MISE_EXPERIMENTAL=1 mise x -y npm:markdownlint-cli@latest -- markdownlint --fix .", +] [tasks.test] alias = 't' diff --git a/.mise/tasks/release-plz b/.mise/tasks/release-plz new file mode 100755 index 0000000000..ac6c1618e4 --- /dev/null +++ b/.mise/tasks/release-plz @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -euxo pipefail + +version="$(git cliff --bumped-version)" +sed -i.bak "s/^mise [0-9]\+\.[0-9]\+\.[0-9]\+\(-rc\.[0-9]\+\)\?$/mise $version/" README.md +sed -i.bak "s/^Version: [0-9]\+\.[0-9]\+\.[0-9]\+\(-rc\.[0-9]\+\)\?$/Version: $version/" packaging/rpm/mise.spec +sed -i.bak "s/version = \"[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc\.[0-9]\+\)\?\";$/version = \"$version\";/" default.nix + +mise run update-shorthand-repo +mise run render ::: lint:fix + +git add \ + README.md \ + default.nix \ + packaging/rpm/mise.spec \ + src/default_shorthands.rs \ + mise.usage.kdl \ + completions \ + man/ + +git clean -df +git cliff --bump -o CHANGELOG.md --verbose diff --git a/scripts/update-shorthand-repo.sh b/.mise/tasks/update-shorthand-repo similarity index 97% rename from scripts/update-shorthand-repo.sh rename to .mise/tasks/update-shorthand-repo index cbd19a7960..e5145221cc 100755 --- a/scripts/update-shorthand-repo.sh +++ b/.mise/tasks/update-shorthand-repo @@ -17,7 +17,7 @@ cat >src/default_shorthands.rs < +""" +# remove the leading and trailing s +trim = true +# postprocessors +postprocessors = [ + # { pattern = '', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL +] + +[git] +# parse the commits based on https://www.conventionalcommits.org +conventional_commits = true +# filter out the commits that are not conventional +filter_unconventional = true +# process each line of a commit as an individual commit +split_commits = false +# regex for preprocessing the commit messages +commit_preprocessors = [ + # Replace issue numbers + #{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](/issues/${2}))"}, + # Check spelling of the commit with https://github.com/crate-ci/typos + # If the spelling is incorrect, it will be automatically fixed. + #{ pattern = '.*', replace_command = 'typos --write-changes -' }, +] +# regex for parsing and grouping commits +commit_parsers = [ + { message = "^feat", group = "๐Ÿš€ Features" }, + { message = "^fix", group = "๐Ÿ› Bug Fixes" }, + { message = "^doc", group = "๐Ÿ“š Documentation" }, + { message = "^perf", group = "โšก Performance" }, + { message = "^refactor", group = "๐Ÿšœ Refactor" }, + { message = "^style", group = "๐ŸŽจ Styling" }, + { message = "^test", group = "๐Ÿงช Testing" }, + { message = "^chore\\(release\\): prepare for", skip = true }, + { message = "^chore\\(deps.*\\)", skip = true }, + { message = "^chore\\(pr\\)", skip = true }, + { message = "^chore\\(pull\\)", skip = true }, + { message = "^chore|^ci", group = "โš™๏ธ Miscellaneous Tasks" }, + { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, + { message = "^revert", group = "โ—€๏ธ Revert" }, +] +# protect breaking changes from being skipped due to matching a skipping commit_parser +protect_breaking_commits = false +# filter out the commits that are not matched by commit parsers +filter_commits = false +# regex for matching git tags +# tag_pattern = "v[0-9].*" +# regex for skipping tags +# skip_tags = "" +# regex for ignoring tags +# ignore_tags = "" +# sort the tags topologically +topo_order = false +# sort the commits inside sections by oldest/newest order +sort_commits = "oldest" +# limit the number of commits included in the changelog. +# limit_commits = 42 diff --git a/e2e/assert.sh b/e2e/assert.sh index 5651ae6b24..1b3dfa93c0 100755 --- a/e2e/assert.sh +++ b/e2e/assert.sh @@ -1,44 +1,44 @@ #!/usr/bin/env bash assert() { - local actual - actual="$(bash -c "$1")" - if [[ "$actual" != "$2" ]]; then - echo "Expected '$2' but got '$actual'" - exit 1 - fi + local actual + actual="$(bash -c "$1")" + if [[ "$actual" != "$2" ]]; then + echo "Expected '$2' but got '$actual'" + exit 1 + fi } assert_contains() { - local actual - actual="$(bash -c "$1")" - if [[ "$actual" != *"$2"* ]]; then - echo "Expected '$2' to be in '$actual'" - exit 1 - fi + local actual + actual="$(bash -c "$1")" + if [[ "$actual" != *"$2"* ]]; then + echo "Expected '$2' to be in '$actual'" + exit 1 + fi } assert_not_contains() { - local actual - actual="$(bash -c "$1")" - if [[ "$actual" == *"$2"* ]]; then - echo "Expected '$2' to not be in '$actual'" - exit 1 - fi + local actual + actual="$(bash -c "$1")" + if [[ "$actual" == *"$2"* ]]; then + echo "Expected '$2' to not be in '$actual'" + exit 1 + fi } assert_fail() { - if bash -c "$1" 2>&1; then - echo "Expected failure but succeeded" - exit 1 - fi + if bash -c "$1" 2>&1; then + echo "Expected failure but succeeded" + exit 1 + fi } assert_matches() { - local actual - actual="$(bash -c "$1")" - if [[ ! "$actual" =~ $2 ]]; then - echo "Expected '$2' to match '$actual'" - exit 1 - fi + local actual + actual="$(bash -c "$1")" + if [[ ! "$actual" =~ $2 ]]; then + echo "Expected '$2' to match '$actual'" + exit 1 + fi } diff --git a/justfile b/justfile index 5904ed1d4d..c91b59f511 100644 --- a/justfile +++ b/justfile @@ -10,7 +10,6 @@ alias b := build alias e := test-e2e alias t := test alias l := lint -alias lf := lint-fix # just `cargo build` build *args: @@ -80,13 +79,3 @@ lint: just --unstable --fmt --check MISE_EXPERIMENTAL=1 mise x -y npm:prettier@latest -- prettier -c $(git ls-files '*.yml' '*.yaml') MISE_EXPERIMENTAL=1 mise x -y npm:markdownlint-cli@latest -- markdownlint . - -# runs linters but makes fixes when possible -lint-fix: - cargo clippy --fix --allow-staged --allow-dirty -- -Dwarnings - cargo fmt --all - mise x -y shellcheck@latest -- shellcheck -x {{ scripts }} - mise x -y shfmt@latest -- shfmt -w {{ scripts }} - just --unstable --fmt - MISE_EXPERIMENTAL=1 mise x -y npm:prettier@latest -- prettier -w $(git ls-files '*.yml' '*.yaml') - MISE_EXPERIMENTAL=1 mise x -y npm:markdownlint-cli@latest -- markdownlint --fix . diff --git a/release-plz.toml b/release-plz.toml new file mode 100644 index 0000000000..cc2ea67d29 --- /dev/null +++ b/release-plz.toml @@ -0,0 +1,5 @@ +[workspace] +allow_dirty = true +dependencies_update = true +pr_labels = ["release"] +semver_check = false diff --git a/scripts/pre-release-hook.sh b/scripts/pre-release-hook.sh deleted file mode 100755 index 746c3f8085..0000000000 --- a/scripts/pre-release-hook.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -euxo pipefail - -if [[ "${NO_UPDATE:-}" == "1" ]]; then - echo "NO_UPDATE is set, skipping update" -# else -# cargo update && git add Cargo.lock -fi - -./scripts/update-shorthand-repo.sh -mise run render ::: lint:fix - -git add man src/default_shorthands.rs diff --git a/src/default_shorthands.rs b/src/default_shorthands.rs index b2552039a2..7fd51a544e 100644 --- a/src/default_shorthands.rs +++ b/src/default_shorthands.rs @@ -5,7 +5,7 @@ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // !GENERATED FILE! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -// This file is generated by scripts/update-shorthand-repo.sh +// This file is generated by .mise/tasks/update-shorthand-repo // DO NOT EDIT THIS FILE MANUALLY. YOUR PR WILL BE REJECTED. // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // !GENERATED FILE! @@ -550,7 +550,7 @@ pub static DEFAULT_SHORTHANDS: Lazy> = ("qdns", "https://github.com/moritz-makandra/asdf-plugin-qdns.git"), ("quarkus", "https://github.com/asdf-community/asdf-quarkus.git"), ("r", "https://github.com/asdf-community/asdf-r.git"), - ("rabbitmq", "https://github.com/mise-plugins/asdf-rabbitmq.git"), + ("rabbitmq", "https://github.com/w-sanches/asdf-rabbitmq.git"), ("racket", "https://github.com/asdf-community/asdf-racket.git"), ("raku", "https://github.com/m-dango/asdf-raku.git"), ("rancher", "https://github.com/abinet/asdf-rancher.git"), diff --git a/test/fixtures/signal-test.js b/test/fixtures/signal-test.js index 35032637a4..c202b1fe04 100644 --- a/test/fixtures/signal-test.js +++ b/test/fixtures/signal-test.js @@ -1,14 +1,14 @@ -let i = 3 +let i = 3; -process.on('SIGINT', function () { +process.on("SIGINT", function () { if (i > 0) { - console.log(`Got SIGINT. Press Control-D to exit. ${i} times left`) - i-- + console.log(`Got SIGINT. Press Control-D to exit. ${i} times left`); + i--; } else { - process.exit() + process.exit(); } -}) +}); // wait for 60 seconds -setTimeout(function () {}, 60000) -console.log('Running. Press Control-C to test.') +setTimeout(function () {}, 60000); +console.log("Running. Press Control-C to test.");