Skip to content

Commit ef4f951

Browse files
committed
Download Inno Setup from GitHub in tests
Inno Setup versions >= 6.6.0 will now download from GitHub. Related to #77 (comment).
1 parent a5a833c commit ef4f951

File tree

3 files changed

+32
-10
lines changed

3 files changed

+32
-10
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ jiff = ["dep:jiff", "nt-time/jiff"]
3232
bytes = "1"
3333
reqwest = { version = "0.13", features = ["blocking"] }
3434
rstest = "0.26"
35+
semver = "1"
3536

core/tests/inno_versions.rs

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,39 @@ use bytes::Bytes;
44
use inno::{Inno, version::InnoVersion};
55
use reqwest::blocking;
66
use rstest::rstest;
7+
use semver::Version;
78

89
/// Downloads the specified Inno Setup into memory, returning its bytes.
10+
///
11+
/// # Errors
12+
///
13+
/// Returns a [`reqwest::Error`] if the request fails or the server returns a non-success status
14+
/// code.
15+
///
16+
/// # Panics
17+
///
18+
/// Panics if `version` is not a valid semantic version.
919
fn download_inno_version(version: &str) -> reqwest::Result<Bytes> {
10-
let url = format!(
11-
"https://files.jrsoftware.org/is/{major}/{name}-{version}.exe",
12-
major = version.chars().next().unwrap(),
13-
name = if version < "5.5.9" || version == "6.3.3" {
14-
"isetup"
15-
} else {
16-
"innosetup"
17-
},
18-
version = version
19-
);
20+
let semver = Version::parse(version).unwrap();
21+
22+
let url = if semver >= Version::new(6, 6, 0) {
23+
format!(
24+
"https://github.com/jrsoftware/issrc/releases/download/is-{major}_{minor}_{patch}/innosetup-{version}.exe",
25+
major = semver.major,
26+
minor = semver.minor,
27+
patch = semver.patch
28+
)
29+
} else {
30+
format!(
31+
"https://files.jrsoftware.org/is/{major}/{name}-{version}.exe",
32+
major = semver.major,
33+
name = if semver < Version::new(5, 5, 9) || semver == Version::new(6, 3, 3) {
34+
"isetup"
35+
} else {
36+
"innosetup"
37+
},
38+
)
39+
};
2040

2141
blocking::get(url)?.error_for_status()?.bytes()
2242
}

0 commit comments

Comments
 (0)