Skip to content
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
5 changes: 3 additions & 2 deletions .github/workflows/hyperfine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ jobs:
echo "## Hyperfine Performance" >> comment.md
for cmd in "${CMDS[@]}"; do
if [ -n "${MISE_ALT:-}" ]; then
mise x hyperfine -- hyperfine -N -w 10 -r 500 --export-markdown out.md --reference "$MISE_ALT $cmd" "mise $cmd"
# TODO: unpin hyperfine version
mise x hyperfine@1.19 -- hyperfine -N -w 10 -r 500 --export-markdown out.md --reference "$MISE_ALT $cmd" "mise $cmd"
else
mise x hyperfine -- hyperfine -N -w 10 -r 500 --export-markdown out.md --reference "mise-${{ steps.versions.outputs.release }} $cmd" "mise $cmd"
mise x hyperfine@1.19 -- hyperfine -N -w 10 -r 500 --export-markdown out.md --reference "mise-${{ steps.versions.outputs.release }} $cmd" "mise $cmd"
fi
echo "### \`mise $cmd\`" >> comment.md
cat out.md >> comment.md
Expand Down
3 changes: 3 additions & 0 deletions e2e/backend/test_aqua
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ test age@1.2.0 "age --version" "v1.2.0"
test aqua:helm/helm@3.16.3 "helm version" "v3.16.3"
test aqua:crate-ci/typos@1.27.3 "typos --version" "typos-cli 1.27.3"
test aqua:biomejs/biome@2.0.0 "biome --version" "Version: 2.0.0"

assert_contains "MISE_USE_VERSIONS_HOST=0 mise ls-remote aqua:sharkdp/hyperfine" "1.9.0
1.10.0"
26 changes: 15 additions & 11 deletions src/backend/aqua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ use eyre::{ContextCompat, Result, bail};
use indexmap::IndexSet;
use itertools::Itertools;
use regex::Regex;
use std::collections::BTreeMap;
use std::fmt::Debug;
use std::{collections::HashSet, sync::Arc};

#[derive(Debug)]
pub struct AquaBackend {
ba: Arc<BackendArg>,
id: String,
version_tags_cache: CacheManager<BTreeMap<String, String>>,
version_tags_cache: CacheManager<Vec<(String, String)>>,
bin_path_caches: DashMap<String, CacheManager<Vec<PathBuf>>>,
}

Expand All @@ -59,9 +58,9 @@ impl Backend for AquaBackend {
}

async fn _list_remote_versions(&self, _config: &Arc<Config>) -> Result<Vec<String>> {
let version_tags_map = self.get_version_tags_map().await?;
let version_tags = self.get_version_tags().await?;
let mut versions = Vec::new();
for (v, tag) in version_tags_map.iter() {
for (v, tag) in version_tags.iter() {
let pkg = AQUA_REGISTRY
.package_with_version(&self.id, tag)
.await
Expand All @@ -80,9 +79,14 @@ impl Backend for AquaBackend {
) -> Result<ToolVersion> {
let mut v;
let pkg;
match self.get_version_tags_map().await?.get(&tv.version).cloned() {
Some(tag) => {
v = tag;
match self
.get_version_tags()
.await?
.iter()
.find(|(version, _)| version == &tv.version)
{
Some((_, tag)) => {
v = tag.clone();
pkg = AQUA_REGISTRY.package_with_version(&self.id, &v).await?;
}
None => {
Expand Down Expand Up @@ -211,11 +215,11 @@ impl AquaBackend {
}
}

async fn get_version_tags_map(&self) -> Result<&BTreeMap<String, String>> {
async fn get_version_tags(&self) -> Result<&Vec<(String, String)>> {
self.version_tags_cache
.get_or_try_init_async(|| async {
let pkg = AQUA_REGISTRY.package(&self.id).await?;
let mut map = BTreeMap::new();
let mut versions = Vec::new();
if !pkg.repo_owner.is_empty() && !pkg.repo_name.is_empty() {
let tags = get_tags(&pkg).await?;
for tag in tags.into_iter().rev() {
Expand All @@ -237,12 +241,12 @@ impl AquaBackend {
}
}
version = version.strip_prefix('v').unwrap_or(version);
map.insert(version.to_string(), tag);
versions.push((version.to_string(), tag));
}
} else {
warn!("no aqua registry found for {}", self.ba());
}
Ok(map)
Ok(versions)
})
.await
}
Expand Down
Loading