Compare commits

...

8 Commits

Author SHA1 Message Date
Taiki Endo
54eee5470f Release 2.2.1 2023-01-12 23:35:47 +09:00
Taiki Endo
2411265c71 Tweak output 2023-01-12 23:13:17 +09:00
Taiki Endo
8066254c63 Update cargo-binstall@latest to 0.19.1 2023-01-12 23:13:10 +09:00
Taiki Endo
0feb352bd8 Update comments 2023-01-12 23:13:02 +09:00
Taiki Endo
9a9630c7b3 codegen: Fix retry on download 2023-01-12 23:12:45 +09:00
Taiki Endo
baf51dce12 codegen: Reject cases where any of binaries are missing 2023-01-12 23:12:20 +09:00
Taiki Endo
c096cea2cf codegen: Reject unknown fields in base manifest 2023-01-12 23:11:54 +09:00
Taiki Endo
cde5fb702d codegen: Fix handling of latest_only tool 2023-01-12 22:34:21 +09:00
5 changed files with 68 additions and 14 deletions

View File

@@ -10,6 +10,12 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [Unreleased]
## [2.2.1] - 2023-01-12
- Update `cargo-binstall@latest` to 0.19.1.
- Support `cargo-binstall` on aarch64 Windows.
## [2.2.0] - 2023-01-11
- Update `cargo-llvm-cov@latest` to 0.5.7.
@@ -543,7 +549,8 @@ Note: This release is considered a breaking change because installing on version
Initial release
[Unreleased]: https://github.com/taiki-e/install-action/compare/v2.2.0...HEAD
[Unreleased]: https://github.com/taiki-e/install-action/compare/v2.2.1...HEAD
[2.2.1]: https://github.com/taiki-e/install-action/compare/v2.2.0...v2.2.1
[2.2.0]: https://github.com/taiki-e/install-action/compare/v2.1.4...v2.2.0
[2.1.4]: https://github.com/taiki-e/install-action/compare/v2.1.3...v2.1.4
[2.1.3]: https://github.com/taiki-e/install-action/compare/v2.1.2...v2.1.3

View File

@@ -340,12 +340,13 @@ case "$(uname -m)" in
# https://github.com/rust-lang/rustup/pull/593
# https://github.com/cross-rs/cross/pull/1018
# Does it seem only armv7l is supported?
# https://github.com/actions/runner/blob/6b9e8a6be411a6e63d5ccaf3c47e7b7622c5ec49/src/Misc/externals.sh#L174
# https://github.com/actions/runner/blob/caec043085990710070108f375cd0aeab45e1017/src/Misc/externals.sh#L174
bail "32-bit ARM runner is not supported yet by this action"
;;
# GitHub Actions Runner supports Linux (x86_64, aarch64, arm), Windows (x86_64, aarch64),
# and macOS (x86_64, aarch64).
# https://github.com/actions/runner
# https://github.com/actions/runner/blob/caec043085990710070108f375cd0aeab45e1017/.github/workflows/build.yml#L21
# https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners#supported-architectures-and-operating-systems-for-self-hosted-runners
# So we can assume x86_64 unless it is aarch64 or arm.
*) host_arch="x86_64" ;;
@@ -508,6 +509,7 @@ for tool in "${tools[@]}"; do
# Use cargo-binstall fallback if tool is not available.
if [[ ! -f "${manifest_dir}/${tool}.json" ]]; then
cargo_binstall "${tool}" "${version}"
echo
continue
fi

View File

@@ -14,26 +14,32 @@
},
"aarch64_macos": {
"url": "https://github.com/cargo-bins/cargo-binstall/releases/download/v${version}/cargo-binstall-aarch64-apple-darwin.zip"
},
"aarch64_windows": {
"url": "https://github.com/cargo-bins/cargo-binstall/releases/download/v${version}/cargo-binstall-aarch64-pc-windows-msvc.zip"
}
},
"latest": {
"version": "0.18.1"
"version": "0.19.1"
},
"0.18.1": {
"0.19.1": {
"x86_64_linux_musl": {
"checksum": "ef05f04e951665b617fe0796ec72e5dc51e8724ee0b09a0da129fa24162369a0"
"checksum": "b270f25fd21fe27b99b99cb4f6dd5ed98ec01284cf450994974f632c77a823a8"
},
"x86_64_macos": {
"checksum": "291ad8f69e3f31a620c17a68cb456f64ab736947a76c57ffcc6f8602a09b4cb5"
"checksum": "dd46485e17b12211684fcb3e55e966f9f4cb75c14bb715f6c905373640e98a4e"
},
"x86_64_windows": {
"checksum": "bfc078cb22626bb80e1bb23a3cc74f4362c1326ec3f3dfc1cc46e1bd13528906"
"checksum": "b120023e546562bfea5ca4ef1a3b67fc6571968ae459a34aa0b4414eff38f5e3"
},
"aarch64_linux_musl": {
"checksum": "d26b5bbe14bbf7bd0f5fdd5b843f7f6df2c75d01168d42909932a422f17a4d5b"
"checksum": "98264b5342db7a7b68d215d105a42a81961de02743b8c369b476dc892d12f2fa"
},
"aarch64_macos": {
"checksum": "9ea261b7617bf6161447aa42b8e8979a7369aed3e5cef6b3774bec55fa4c70b6"
"checksum": "dd099af7147d856bcf6cc713c1bf53c4be003f597f92fe9c2e3a58d0ad7d6fd2"
},
"aarch64_windows": {
"checksum": "ed5023a73f3bb8a8b8fb80e5a7476cab2487d7e16ed3fe04b51cf25ec1644d92"
}
}
}

View File

@@ -14,6 +14,9 @@
"aarch64_linux_musl": {},
"aarch64_macos": {
"asset_name": "${package}-${rust_target}.zip"
},
"aarch64_windows": {
"asset_name": "${package}-${rust_target}.zip"
}
}
}

View File

@@ -29,6 +29,7 @@ fn main() -> Result<()> {
.join(format!("{package}.json"));
let download_cache_dir = &workspace_root.join("tools/codegen/tmp/cache").join(package);
fs::create_dir_all(download_cache_dir)?;
let base_info: BaseManifest = serde_json::from_slice(&fs::read(
workspace_root
.join("tools/codegen/base")
@@ -41,6 +42,8 @@ fn main() -> Result<()> {
eprintln!("downloading releases of https://github.com/{repo}");
let mut releases: github::Releases = vec![];
// GitHub API returns up to 100 results at a time. If the number of releases
// is greater than 100, multiple fetches are needed.
for page in 1.. {
let per_page = 100;
let mut r: github::Releases = download(&format!(
@@ -286,10 +289,37 @@ fn main() -> Result<()> {
);
}
let ManifestRef::Ref { version: latest_version } = manifests.map.first_key_value().unwrap().1.clone() else { unreachable!() };
if latest_only {
manifests
.map
.retain(|k, m| k.0 == Version::latest() || matches!(m, ManifestRef::Real(..)));
.retain(|k, _| k.0 == Version::latest() || k.0 == latest_version);
}
let ManifestRef::Real(latest_manifest) = &manifests.map[&Reverse(latest_version.clone())] else { unreachable!() };
for &p in base_info.platform.keys() {
if latest_manifest.download_info.contains_key(&p) {
continue;
}
if !base_info.prefer_linux_gnu {
if p == HostPlatform::x86_64_linux_gnu
&& latest_manifest
.download_info
.contains_key(&HostPlatform::x86_64_linux_musl)
{
continue;
}
if p == HostPlatform::aarch64_linux_gnu
&& latest_manifest
.download_info
.contains_key(&HostPlatform::aarch64_linux_musl)
{
continue;
}
}
bail!(
"platform list in base manifest for {package} contains {p:?}, \
but latest release ({latest_version}) doesn't contain it"
);
}
let original_manifests = manifests.clone();
@@ -357,8 +387,8 @@ fn replace_vars(s: &str, package: &str, version: &str, platform: HostPlatform) -
fn download(url: &str) -> Result<ureq::Response> {
let token = env::var("INTERNAL_CODEGEN_GH_PAT").ok();
let mut retry = 0;
let mut last_error = None;
while retry < 5 {
let mut last_error;
loop {
let mut req = ureq::get(url);
if let Some(token) = &token {
req = req.set("Authorization", token);
@@ -368,8 +398,11 @@ fn download(url: &str) -> Result<ureq::Response> {
Err(e) => last_error = Some(e),
}
retry += 1;
if retry > 5 {
break;
}
eprintln!("download failed; retrying ({retry}/5)");
std::thread::sleep(Duration::from_secs(retry));
std::thread::sleep(Duration::from_secs(retry * 2));
}
Err(last_error.unwrap().into())
}
@@ -562,6 +595,7 @@ struct ManifestTemplateDownloadInfo {
}
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
struct BaseManifest {
/// Link to the GitHub repository.
repository: String,
@@ -582,6 +616,7 @@ struct BaseManifest {
}
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
struct BaseManifestPlatformInfo {
/// Asset name patterns. Default to the value at `BaseManifest::asset_name`.
asset_name: Option<StringOrArray>,
@@ -610,6 +645,7 @@ impl StringOrArray {
/// GitHub Actions Runner supports Linux (x86_64, aarch64, arm), Windows (x86_64, aarch64),
/// and macOS (x86_64, aarch64).
/// https://github.com/actions/runner
/// https://github.com/actions/runner/blob/caec043085990710070108f375cd0aeab45e1017/.github/workflows/build.yml#L21
/// https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners#supported-architectures-and-operating-systems-for-self-hosted-runners
///
/// Note:
@@ -622,7 +658,7 @@ impl StringOrArray {
/// https://github.com/rust-lang/rustup/pull/593
/// https://github.com/cross-rs/cross/pull/1018
/// Does it seem only armv7l is supported?
/// https://github.com/actions/runner/blob/6b9e8a6be411a6e63d5ccaf3c47e7b7622c5ec49/src/Misc/externals.sh#L174
/// https://github.com/actions/runner/blob/caec043085990710070108f375cd0aeab45e1017/src/Misc/externals.sh#L174
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
enum HostPlatform {