Skip to content

Commit

Permalink
feat: added --bump option for outdated/upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Sep 27, 2024
1 parent d396bcb commit 2a82223
Show file tree
Hide file tree
Showing 59 changed files with 474 additions and 325 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ concurrency:

env:
MISE_EXPERIMENTAL: 1
NPM_CONFIG_FUND: false

jobs:
release-plz:
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ jobs:
runs-on: ${{matrix.runs-on}}
timeout-minutes: 45
env:
#RUSTC_WRAPPER: sccache
SCCACHE_ENDPOINT: minio.jdx.dev
SCCACHE_BUCKET: sccache
SCCACHE_REGION: auto
SCCACHE_S3_NO_CREDENTIALS: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID && '0' || '1' }}
MINIO_AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID }}
MINIO_AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_AWS_SECRET_ACCESS_KEY }}
strategy:
Expand Down Expand Up @@ -74,11 +69,6 @@ jobs:
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12 }}
p12-password: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12_PASS }}
- uses: actions/checkout@v4
- if: ${{ env.SCCACHE_S3_NO_CREDENTIALS == '0' }}
run: |
echo "AWS_ACCESS_KEY_ID=$MINIO_AWS_ACCESS_KEY_ID" >> "$GITHUB_ENV"
echo "AWS_SECRET_ACCESS_KEY=$MINIO_AWS_SECRET_ACCESS_KEY" >> "$GITHUB_ENV"
- uses: mozilla-actions/[email protected]
- name: cache crates
id: cache-crates
uses: actions/cache@v4
Expand Down Expand Up @@ -109,19 +99,10 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: steps.cache-crates.outputs.cache-hit != 'true'
run: cargo cache --autoclean
- run: ${SCCACHE_PATH} --show-stats
build-tarball-windows:
name: build-tarball-windows-${{matrix.arch}}
runs-on: windows-latest
timeout-minutes: 45
env:
#RUSTC_WRAPPER: sccache
SCCACHE_ENDPOINT: minio.jdx.dev
SCCACHE_BUCKET: sccache
SCCACHE_REGION: auto
SCCACHE_S3_NO_CREDENTIALS: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID && '0' || '1' }}
AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_AWS_SECRET_ACCESS_KEY }}
strategy:
fail-fast: false
matrix:
Expand All @@ -133,7 +114,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: rustup target add ${{matrix.target}}
- uses: mozilla-actions/[email protected]
- name: cache crates
id: cache-crates
uses: actions/cache@v4
Expand Down
20 changes: 1 addition & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ env:
MISE_TRUSTED_CONFIG_PATHS: ${{ github.workspace }}
MISE_EXPERIMENTAL: 1
RUST_BACKTRACE: 1
#RUSTC_WRAPPER: sccache
SCCACHE_ENDPOINT: minio.jdx.dev
SCCACHE_BUCKET: sccache
SCCACHE_REGION: auto
SCCACHE_S3_NO_CREDENTIALS: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID && '0' || '1' }}
MINIO_AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID }}
MINIO_AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_AWS_SECRET_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_FUND: false

permissions:
pull-requests: write
Expand Down Expand Up @@ -87,11 +81,6 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.RTX_GITHUB_BOT_TOKEN || github.token }}
- if: ${{ env.SCCACHE_S3_NO_CREDENTIALS == '0' }}
run: |
echo "AWS_ACCESS_KEY_ID=$MINIO_AWS_ACCESS_KEY_ID" >> "$GITHUB_ENV"
echo "AWS_SECRET_ACCESS_KEY=$MINIO_AWS_SECRET_ACCESS_KEY" >> "$GITHUB_ENV"
- uses: mozilla-actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
{ toolchain: nightly, components: "rustfmt, clippy", rustflags: "" }
Expand All @@ -116,7 +105,6 @@ jobs:
push: true
author_name: mise[bot]
author_email: [email protected]
- run: ${SCCACHE_PATH} --show-stats

coverage:
name: coverage-${{matrix.tranche}}
Expand All @@ -131,11 +119,6 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- if: ${{ env.SCCACHE_S3_NO_CREDENTIALS == '0' }}
run: |
echo "AWS_ACCESS_KEY_ID=$MINIO_AWS_ACCESS_KEY_ID" >> "$GITHUB_ENV"
echo "AWS_SECRET_ACCESS_KEY=$MINIO_AWS_SECRET_ACCESS_KEY" >> "$GITHUB_ENV"
- uses: mozilla-actions/[email protected]
- uses: Swatinem/rust-cache@v2
with:
shared-key: coverage
Expand Down Expand Up @@ -179,7 +162,6 @@ jobs:
name: coverage-${{matrix.tranche}}.lcov
path: coverage-${{matrix.tranche}}.lcov
if-no-files-found: error
- run: ${SCCACHE_PATH} --show-stats
coverage-report:
name: coverage-report
runs-on: ubuntu-latest
Expand Down
21 changes: 0 additions & 21 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
target.x86_64-unknown-linux-gnu.pre-build = "./scripts/sccache.sh"
target.x86_64-unknown-linux-musl.pre-build = "./scripts/sccache.sh"
#target.aarch64-unknown-linux-gnu.pre-build = "./scripts/sccache.sh"
#target.aarch64-unknown-linux-musl.pre-build = "./scripts/sccache.sh"
#target.armv7-unknown-linux-gnueabihf.pre-build = "./scripts/sccache.sh"
#target.armv7-unknown-linux-musleabihf.pre-build = "./scripts/sccache.sh"
#target.arm-unknown-linux-gnueabi.pre-build = "./scripts/sccache.sh"
#target.arm-unknown-linux-musleabi.pre-build = "./scripts/sccache.sh"
#target.x86_64-apple-darwin.pre-build = "./scripts/sccache.sh"
#target.aarch64-apple-darwin.pre-build = "./scripts/sccache.sh"
#target.aarch64-pc-windows-msvc.pre-build = "./scripts/sccache.sh"
#target.x86_64-pc-windows-msvc.pre-build = "./scripts/sccache.sh"

[build.env]
passthrough = [
"AWS_ACCESS_KEY_ID",
"AWS_SECRET_ACCESS_KEY",
"RUSTC_WRAPPER",
"SCCACHE_BUCKET",
"SCCACHE_DIR",
"SCCACHE_ENDPOINT",
"SCCACHE_ERROR_LOG",
"SCCACHE_LOG",
"SCCACHE_REGION",
"SCCACHE_S3_NO_CREDENTIALS",
]
24 changes: 22 additions & 2 deletions docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,20 @@ Arguments:
If not specified, all tools in global and local configs will be shown
Options:
-l, --bump
Compares against the latest versions available, not what matches the current config
For example, if you have `node = "20"` in your config by default `mise outdated` will only
show other 20.x versions, not 21.x or 22.x versions.
Using this flag, if there are 21.x or newer versions it will display those instead of 20.x.
-J, --json
Output in JSON format
--no-header
Don't show table header
Examples:
$ mise outdated
Expand Down Expand Up @@ -1757,14 +1768,23 @@ Options:
-n, --dry-run
Just print what would be done, don't actually do it
-i, --interactive
Display multiselect menu to choose which tools to upgrade
-j, --jobs <JOBS>
Number of jobs to run in parallel
[default: 4]
[env: MISE_JOBS=]
-i, --interactive
Display multiselect menu to choose which tools to upgrade
-l, --bump
Upgrades to the latest version available, bumping the version in mise.toml
For example, if you have `node = "20.0.0"` in your mise.toml but 22.1.0 is the latest available,
this will install 22.1.0 and set `node = "22.1.0"` in your config.
It keeps the same precision as what was there before, so if you instead had `node = "20"`, it
would change your config to `node = "22"`.
--raw
Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1
Expand Down
11 changes: 11 additions & 0 deletions docs/cli/outdated.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,20 @@ Arguments:
If not specified, all tools in global and local configs will be shown
Options:
-l, --bump
Compares against the latest versions available, not what matches the current config
For example, if you have `node = "20"` in your config by default `mise outdated` will only
show other 20.x versions, not 21.x or 22.x versions.
Using this flag, if there are 21.x or newer versions it will display those instead of 20.x.
-J, --json
Output in JSON format
--no-header
Don't show table header
Examples:
$ mise outdated
Expand Down
13 changes: 11 additions & 2 deletions docs/cli/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,23 @@ Options:
-n, --dry-run
Just print what would be done, don't actually do it
-i, --interactive
Display multiselect menu to choose which tools to upgrade
-j, --jobs <JOBS>
Number of jobs to run in parallel
[default: 4]
[env: MISE_JOBS=]
-i, --interactive
Display multiselect menu to choose which tools to upgrade
-l, --bump
Upgrades to the latest version available, bumping the version in mise.toml
For example, if you have `node = "20.0.0"` in your mise.toml but 22.1.0 is the latest available,
this will install 22.1.0 and set `node = "22.1.0"` in your config.
It keeps the same precision as what was there before, so if you instead had `node = "20"`, it
would change your config to `node = "22"`.
--raw
Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1
Expand Down
4 changes: 4 additions & 0 deletions e2e/cli/test_upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ mise upgrade dummy

assert_contains "mise ls --installed dummy" "1.1.0"
assert_not_contains "mise ls --installed dummy" "1.0.0"

mise upgrade dummy --bump
assert_contains "mise ls --installed dummy" "2.0.0"
assert_not_contains "mise ls --installed dummy" "1.1.0"
3 changes: 1 addition & 2 deletions e2e/plugins/test_tiny
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ rm -rf "$MISE_DATA_DIR/installs/tiny"
mise use tiny@3
mv "$MISE_DATA_DIR/installs/tiny/"{3.1.0,3.0.0}
assert "mise current tiny" "3.0.0"
assert "mise outdated tiny" "Tool Requested Current Latest
tiny 3 3.0.0 3.1.0"
assert "mise outdated tiny" "tiny 3 3.0.0 3.1.0 ~/workdir/.mise.toml"
mise upgrade tiny
assert "mise current tiny" "3.1.0"
assert "mise outdated tiny" ""
9 changes: 8 additions & 1 deletion mise.usage.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,11 @@ cmd "outdated" help="Shows outdated tool versions" {
$ mise outdated --json
{"python": {"requested": "3.11", "current": "3.11.0", "latest": "3.11.1"}, ...}
"#
flag "-l --bump" help="Compares against the latest versions available, not what matches the current config" {
long_help "Compares against the latest versions available, not what matches the current config\n\nFor example, if you have `node = \"20\"` in your config by default `mise outdated` will only\nshow other 20.x versions, not 21.x or 22.x versions.\n\nUsing this flag, if there are 21.x or newer versions it will display those instead of 20.x."
}
flag "-J --json" help="Output in JSON format"
flag "--no-header" help="Don't show table header"
arg "[TOOL@VERSION]..." help="Tool(s) to show outdated versions for\ne.g.: node@20 [email protected]\nIf not specified, all tools in global and local configs will be shown" var=true
}
cmd "plugins" help="Manage plugins" {
Expand Down Expand Up @@ -1214,10 +1218,13 @@ By default this command modifies ".mise.toml" in the current directory."#
cmd "upgrade" help="Upgrades outdated tool versions" {
alias "up"
flag "-n --dry-run" help="Just print what would be done, don't actually do it"
flag "-i --interactive" help="Display multiselect menu to choose which tools to upgrade"
flag "-j --jobs" help="Number of jobs to run in parallel\n[default: 4]" {
arg "<JOBS>"
}
flag "-i --interactive" help="Display multiselect menu to choose which tools to upgrade"
flag "-l --bump" help="Upgrades to the latest version available, bumping the version in mise.toml" {
long_help "Upgrades to the latest version available, bumping the version in mise.toml\n\nFor example, if you have `node = \"20.0.0\"` in your mise.toml but 22.1.0 is the latest available,\nthis will install 22.1.0 and set `node = \"22.1.0\"` in your config.\n\nIt keeps the same precision as what was there before, so if you instead had `node = \"20\"`, it\nwould change your config to `node = \"22\"`."
}
flag "--raw" help="Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1"
arg "[TOOL@VERSION]..." help="Tool(s) to upgrade\ne.g.: node@20 [email protected]\nIf not specified, all current tools will be upgraded" var=true
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fi
cd dist

if [[ "$os" == "macos" ]]; then
codesign -f -s "Developer ID Application: Jeffrey Dickey (4993Y37DX6)" mise/bin/mise
codesign -f -p dev.jdx. -s "Developer ID Application: Jeffrey Dickey (4993Y37DX6)" mise/bin/mise
fi

if [[ "$os" == "windows" ]]; then
Expand Down
48 changes: 0 additions & 48 deletions scripts/sccache.sh

This file was deleted.

6 changes: 3 additions & 3 deletions src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use versions::Versioning;
use self::backend_meta::BackendMeta;
use crate::cli::args::{BackendArg, ToolVersionType};
use crate::cmd::CmdLineRunner;
use crate::config::settings::SETTINGS;
use crate::config::{Config, Settings, CONFIG};
use crate::file::{display_path, remove_all, remove_all_with_warning};
use crate::install_context::InstallContext;
Expand Down Expand Up @@ -364,7 +365,6 @@ pub trait Backend: Debug + Send + Sync {
plugin.is_installed_err()?;
}
let config = Config::get();
let settings = Settings::try_get()?;
if self.is_version_installed(&ctx.tv, true) {
if ctx.force {
self.uninstall_version(&ctx.tv, ctx.pr.as_ref(), false)?;
Expand All @@ -377,13 +377,13 @@ pub trait Backend: Debug + Send + Sync {
self.create_install_dirs(&ctx.tv)?;

if let Err(e) = self.install_version_impl(&ctx) {
self.cleanup_install_dirs_on_error(&settings, &ctx.tv);
self.cleanup_install_dirs_on_error(&SETTINGS, &ctx.tv);
return Err(e);
}

BackendMeta::write(&ctx.tv.backend)?;

self.cleanup_install_dirs(&settings, &ctx.tv);
self.cleanup_install_dirs(&SETTINGS, &ctx.tv);
// attempt to touch all the .tool-version files to trigger updates in hook-env
let mut touch_dirs = vec![dirs::DATA.to_path_buf()];
touch_dirs.extend(config.config_files.keys().cloned());
Expand Down
Loading

0 comments on commit 2a82223

Please sign in to comment.