Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚑 fix nightly build again #39

Merged
merged 1 commit into from
Oct 4, 2024
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: 5 additions & 0 deletions .changeset/tiny-jobs-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"pactup": patch
---

fix nightly install
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ log = "0.4"
node-semver = "2.1"
sysinfo = "0.31"
tar = "0.4"
tempfile = "3.12"
tempfile = "3.13"
thiserror = "1.0"
zip = "2.2"
duct = "0.13"
Expand All @@ -41,7 +41,7 @@ test-log = "0.2"
flate2 = "1.0"
walkdir = "2.5"
indicatif = { version = "0.17", features = ["improved_unicode"] }
regex = "1.10"
regex = "1.11"

[dev-dependencies]
pretty_assertions = "1.4"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"url": "[email protected]:kadena-community/pactup.git"
},
"author": "Salama Ashoush <[email protected]>",
"packageManager": "pnpm@9.11.0",
"packageManager": "pnpm@9.12.0",
"license": "MIT",
"description": "Linter for the JavaScript Oxidation Compiler",
"keywords": [
Expand Down Expand Up @@ -44,7 +44,7 @@
},
"devDependencies": {
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.8",
"@changesets/cli": "2.27.9",
"@types/node": "^22.7.4",
"@types/shell-escape": "^0.2.3",
"chalk": "^5.3.0",
Expand Down
17 changes: 5 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 17 additions & 32 deletions src/remote_pact_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ impl Release {
match platform {
Platform(PlatformOS::Linux, PlatformArch::X64) => {
let regex = if version.is_nightly() {
// match the nightly version format for linux pact-binary-bundle.ubuntu-*.<tar.gz | zip>
r"^(pact-binary-bundle\.ubuntu-latest|pact-nightly-linux(-\d+\.\d+)?)\.(tar\.gz|zip)$"
// match the nightly version format for linux pact-nightly-linux-x64.<tar.gz | zip>
r"^pact-nightly-linux-x64\.(tar\.gz|zip)$"
} else {
// match the stable version format for linux pact-<version>-<linux|ubuntu>-<ubuntu_version>.<tar.gz | zip>
r"^pact-(\d+(\.\d+){0,2})(-(linux|ubuntu))?(-\d+\.\d+)?\.(tar\.gz|zip)$"
Expand All @@ -46,8 +46,8 @@ impl Release {
}
Platform(PlatformOS::MacOS, PlatformArch::X64) => {
let regex = if version.is_nightly() {
// match the nightly version format for mac pact-binary-bundle.macos-latest.<tar.gz|zip>
r"^(pact-binary-bundle\.macos-latest|pact-nightly-osx)\.(tar\.gz|zip)$"
// match the nightly version format for mac pact-nightly-darwin-x64.<tar.gz|zip>
r"^pact-nightly-darwin-x64\.(tar\.gz|zip)$"
} else {
// match the stable version format for mac pact-<version>-osx.<tar.gz | zip>
r"^pact-(\d+(\.\d+){0,2})-osx\.(tar\.gz|zip)$"
Expand All @@ -56,8 +56,8 @@ impl Release {
}
Platform(PlatformOS::MacOS, PlatformArch::Arm64) => {
let regex = if version.is_nightly() {
// match the nightly version format for mac pact-binary-bundle.macos-m1.<tar.gz|zip>
r"^(pact-binary-bundle\.macos-m1|pact-nightly-aarch64-osx)\.(tar\.gz|zip)$"
// match the nightly version format for mac pact-nightly-darwin-aarch64.<tar.gz|zip>
r"^pact-nightly-darwin-aarch64\.(tar\.gz|zip)$"
} else {
// match the stable version format for mac pact-<version>-aarch64-osx.<tar.gz | zip>
r"^pact-(\d+(\.\d+){0,2})-aarch64-osx\.(tar\.gz|zip)$"
Expand Down Expand Up @@ -168,7 +168,7 @@ mod tests {
assert!(!release.unwrap().is_nightly());

let repo = "kadena-io/pact-5".to_string();
let expected_version = Version::parse("development-latest").unwrap();
let expected_version = Version::parse("nightly").unwrap();
let mut versions = list(&repo).expect("Can't get HTTP data");
let release = versions
.drain(..)
Expand All @@ -188,7 +188,7 @@ mod tests {
assert!(release.has_supported_asset());

let repo = "kadena-io/pact-5".to_string();
let tag = "development-latest".to_string();
let tag = "nightly".to_string();
let release = get_by_tag(&repo, &tag).expect("Can't get HTTP data");
assert_eq!(release.tag_name.to_string(), tag);
assert!(release.tag_name.is_nightly());
Expand All @@ -202,29 +202,21 @@ mod tests {
let release = latest(&repo).expect("Can't get HTTP data");
assert!(!release.tag_name.is_nightly());
assert!(release.has_supported_asset());

let repo = "kadena-io/pact-5".to_string();
let release = latest(&repo).expect("Can't get HTTP data");
assert!(release.tag_name.is_nightly());
assert!(release.has_supported_asset());
}

#[test]
fn test_version_matcher_nightly_linux() {
let release = Release {
tag_name: Version::parse("development-latest").unwrap(),
tag_name: Version::parse("nightly").unwrap(),
assets: vec![],
prerelease: false,
draft: false,
};
let platform = Platform(PlatformOS::Linux, PlatformArch::X64);
let regex = release.version_matcher_for_platform(&platform).unwrap();

// Old naming convention
assert!(regex.is_match("pact-binary-bundle.ubuntu-latest.tar.gz"));
// New naming convention
assert!(regex.is_match("pact-nightly-linux.tar.gz"));
assert!(regex.is_match("pact-nightly-linux-22.04.tar.gz"));
assert!(regex.is_match("pact-nightly-linux-x64.tar.gz"));
// Should not match stable versions
assert!(!regex.is_match("pact-4.11.0-linux.tar.gz"));
}
Expand All @@ -245,14 +237,13 @@ mod tests {
assert!(regex.is_match("pact-4.11.0-ubuntu.tar.gz"));
assert!(regex.is_match("pact-4.11.0-ubuntu-22.04.tar.gz"));
// Should not match nightly builds
assert!(!regex.is_match("pact-nightly-linux.tar.gz"));
assert!(!regex.is_match("pact-binary-bundle.ubuntu-latest.tar.gz"));
assert!(!regex.is_match("pact-nightly-linux-x64.tar.gz"));
}

#[test]
fn test_version_matcher_nightly_macos_x64() {
let release = Release {
tag_name: Version::parse("development-latest").unwrap(),
tag_name: Version::parse("nightly").unwrap(),
assets: vec![],
prerelease: false,
draft: false,
Expand All @@ -261,10 +252,8 @@ mod tests {
let platform = Platform(PlatformOS::MacOS, PlatformArch::X64);
let regex = release.version_matcher_for_platform(&platform).unwrap();

// Old naming convention
assert!(regex.is_match("pact-binary-bundle.macos-latest.tar.gz"));
// New naming convention
assert!(regex.is_match("pact-nightly-osx.tar.gz"));
assert!(regex.is_match("pact-nightly-darwin-x64.tar.gz"));
// Should not match stable versions
assert!(!regex.is_match("pact-4.11.0-osx.tar.gz"));
}
Expand All @@ -283,25 +272,22 @@ mod tests {

assert!(regex.is_match("pact-4.11.0-osx.tar.gz"));
// Should not match nightly builds
assert!(!regex.is_match("pact-nightly-osx.tar.gz"));
assert!(!regex.is_match("pact-binary-bundle.macos-latest.tar.gz"));
assert!(!regex.is_match("pact-nightly-darwin-aarch64.tar.gz"));
}

#[test]
fn test_version_matcher_nightly_macos_arm64() {
let release = Release {
tag_name: Version::parse("development-latest").unwrap(),
tag_name: Version::parse("nightly").unwrap(),
assets: vec![],
prerelease: false,
draft: false,
};
let platform = Platform(PlatformOS::MacOS, PlatformArch::Arm64);
let regex = release.version_matcher_for_platform(&platform).unwrap();

// Old naming convention
assert!(regex.is_match("pact-binary-bundle.macos-m1.tar.gz"));
// New naming convention
assert!(regex.is_match("pact-nightly-aarch64-osx.tar.gz"));
assert!(regex.is_match("pact-nightly-darwin-aarch64.tar.gz"));
// Should not match stable versions
assert!(!regex.is_match("pact-4.11.0-aarch64-osx.tar.gz"));
}
Expand All @@ -319,7 +305,6 @@ mod tests {

assert!(regex.is_match("pact-4.11.0-aarch64-osx.tar.gz"));
// Should not match nightly builds
assert!(!regex.is_match("pact-nightly-aarch64-osx.tar.gz"));
assert!(!regex.is_match("pact-binary-bundle.macos-m1.tar.gz"));
assert!(!regex.is_match("pact-nightly-darwin-aarch64.tar.gz"));
}
}