From 2ea561ca6ff50eeda8e185ca31bfbfa0d0679aaa Mon Sep 17 00:00:00 2001 From: Amos Wenger Date: Mon, 21 Oct 2024 12:57:12 +0200 Subject: [PATCH] feat: add cross-compilation support --- .github/workflows/release.yml | 8 + .gitignore | 3 + Cargo.lock | 5 +- Cargo.toml | 1 + Justfile | 80 + book/src/ci/customizing.md | 138 +- cargo-dist-schema/Cargo.toml | 2 +- cargo-dist-schema/src/lib.rs | 243 +- cargo-dist-schema/src/macros.rs | 18 +- .../snapshots/cargo_dist_schema__emit.snap | 95 +- cargo-dist/src/announce.rs | 10 +- cargo-dist/src/backend/ci/github.rs | 361 ++- cargo-dist/src/backend/ci/mod.rs | 22 +- cargo-dist/src/backend/installer/homebrew.rs | 4 +- cargo-dist/src/backend/installer/mod.rs | 6 +- cargo-dist/src/backend/installer/msi.rs | 4 +- cargo-dist/src/backend/installer/npm.rs | 4 +- cargo-dist/src/build/cargo.rs | 149 +- cargo-dist/src/build/generic.rs | 10 +- cargo-dist/src/build/mod.rs | 4 +- cargo-dist/src/cli.rs | 17 +- cargo-dist/src/config/mod.rs | 24 +- cargo-dist/src/config/v0.rs | 9 +- cargo-dist/src/config/v1/ci/github.rs | 76 +- cargo-dist/src/config/v1/mod.rs | 6 +- cargo-dist/src/errors.rs | 34 +- cargo-dist/src/init.rs | 4 +- cargo-dist/src/lib.rs | 19 +- cargo-dist/src/linkage.rs | 16 +- cargo-dist/src/main.rs | 22 + cargo-dist/src/platform.rs | 29 +- cargo-dist/src/platform/github_runners.rs | 102 + cargo-dist/src/platform/targets.rs | 22 +- cargo-dist/src/sign/macos.rs | 4 +- cargo-dist/src/sign/mod.rs | 4 +- cargo-dist/src/sign/ssldotcom.rs | 4 +- cargo-dist/src/tasks.rs | 134 +- cargo-dist/templates/ci/github/release.yml.j2 | 10 +- cargo-dist/tests/integration-tests.rs | 66 + .../tests/snapshots/akaikatana_basic.snap | 54 +- .../tests/snapshots/akaikatana_musl.snap | 60 +- ...ikatana_one_alias_among_many_binaries.snap | 54 +- .../snapshots/akaikatana_two_bin_aliases.snap | 54 +- .../tests/snapshots/akaikatana_updaters.snap | 54 +- .../tests/snapshots/axolotlsay_abyss.snap | 54 +- .../snapshots/axolotlsay_abyss_only.snap | 54 +- .../tests/snapshots/axolotlsay_alias.snap | 54 +- ...axolotlsay_alias_ignores_missing_bins.snap | 54 +- .../tests/snapshots/axolotlsay_basic.snap | 50 +- .../snapshots/axolotlsay_basic_lies.snap | 54 +- .../axolotlsay_build_setup_steps.snap | 54 +- .../axolotlsay_checksum_blake2b.snap | 54 +- .../axolotlsay_checksum_blake2s.snap | 54 +- .../axolotlsay_checksum_sha3_256.snap | 54 +- .../axolotlsay_checksum_sha3_512.snap | 54 +- .../tests/snapshots/axolotlsay_cross1.snap | 2698 +++++++++++++++++ .../tests/snapshots/axolotlsay_cross2.snap | 1658 ++++++++++ .../snapshots/axolotlsay_custom_formula.snap | 55 +- .../axolotlsay_custom_github_runners.snap | 63 +- .../axolotlsay_disable_source_tarball.snap | 54 +- .../tests/snapshots/axolotlsay_dispatch.snap | 55 +- .../snapshots/axolotlsay_dispatch_abyss.snap | 55 +- .../axolotlsay_dispatch_abyss_only.snap | 55 +- .../axolotlsay_dist_url_override.snap | 54 +- .../snapshots/axolotlsay_edit_existing.snap | 54 +- .../axolotlsay_generic_workspace_basic.snap | 54 +- .../axolotlsay_homebrew_linux_only.snap | 20 +- ...axolotlsay_homebrew_macos_x86_64_only.snap | 20 +- .../axolotlsay_homebrew_packages.snap | 54 +- .../tests/snapshots/axolotlsay_musl.snap | 60 +- .../snapshots/axolotlsay_musl_no_gnu.snap | 47 +- .../axolotlsay_no_homebrew_publish.snap | 54 +- .../tests/snapshots/axolotlsay_no_locals.snap | 44 +- .../axolotlsay_no_locals_but_custom.snap | 44 +- .../snapshots/axolotlsay_several_aliases.snap | 54 +- .../axolotlsay_ssldotcom_windows_sign.snap | 54 +- ...xolotlsay_ssldotcom_windows_sign_prod.snap | 54 +- .../snapshots/axolotlsay_tag_namespace.snap | 55 +- .../tests/snapshots/axolotlsay_updaters.snap | 54 +- .../axolotlsay_user_global_build_job.snap | 54 +- .../snapshots/axolotlsay_user_host_job.snap | 54 +- .../axolotlsay_user_local_build_job.snap | 54 +- .../snapshots/axolotlsay_user_plan_job.snap | 54 +- .../axolotlsay_user_publish_job.snap | 54 +- .../snapshots/install_path_cargo_home.snap | 44 +- .../snapshots/install_path_env_no_subdir.snap | 44 +- .../snapshots/install_path_env_subdir.snap | 44 +- .../install_path_env_subdir_space.snap | 44 +- .../install_path_env_subdir_space_deeper.snap | 44 +- .../install_path_fallback_no_env_var_set.snap | 44 +- .../install_path_home_subdir_deeper.snap | 44 +- .../install_path_home_subdir_min.snap | 44 +- .../install_path_home_subdir_space.snap | 44 +- ...install_path_home_subdir_space_deeper.snap | 44 +- .../install_path_no_fallback_taken.snap | 44 +- cargo-dist/tests/snapshots/manifest.snap | 83 +- 96 files changed, 7372 insertions(+), 1569 deletions(-) create mode 100644 Justfile create mode 100644 cargo-dist/src/platform/github_runners.rs create mode 100644 cargo-dist/tests/snapshots/axolotlsay_cross1.snap create mode 100644 cargo-dist/tests/snapshots/axolotlsay_cross2.snap diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 712ab962..2ac2b43f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -111,6 +111,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -121,6 +122,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest diff --git a/.gitignore b/.gitignore index de1bcf0a..35ea3a2c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ cargo-dist/wix oranda-debug.log /public cargo-dist/public + +# Samply: +/profile.json diff --git a/Cargo.lock b/Cargo.lock index aa0e5e32..ddbda48f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -453,6 +453,7 @@ dependencies = [ "semver", "serde", "serde_json", + "target-lexicon", ] [[package]] @@ -2829,9 +2830,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.14" +version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "target-spec" diff --git a/Cargo.toml b/Cargo.toml index 9b79326b..26c6f43f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,6 +70,7 @@ lazy_static = "1.5.0" current_platform = "0.2.0" color-backtrace = "0.6.1" backtrace = "0.3.74" +target-lexicon = "0.12.16" [workspace.metadata.release] shared-version = true diff --git a/Justfile b/Justfile new file mode 100644 index 00000000..d013b2c1 --- /dev/null +++ b/Justfile @@ -0,0 +1,80 @@ + +build-all-plaforms: + #!/bin/bash -eux + export AXOASSET_XZ_LEVEL=1 + cargo build + ./target/debug/dist init --yes + ./target/debug/dist build --artifacts all --target aarch64-apple-darwinx,x86_64-apple-darwin,x86_64-pc-windows-msvc,x86_64-unknown-linux-musl + +patch-sh-installer: + #!/usr/bin/env node + const fs = require('fs'); + const installerUrl = process.env.INSTALLER_DOWNLOAD_URL || 'https://dl.bearcove.cloud/dump/dist-cross'; + const installerPath = './target/distrib/cargo-dist-installer.sh'; + + const content = fs.readFileSync(installerPath, 'utf8'); + const lines = content.split('\n'); + let modified = false; + + const newLines = []; + for (const line of lines) { + if (line.includes('export INSTALLER_DOWNLOAD_URL')) { + continue; + } + if (line.includes('set -u') && !modified) { + modified = true; + newLines.push(line); + newLines.push(`export INSTALLER_DOWNLOAD_URL=${installerUrl} # patched by Justfile in dist repo, using dist_url_override feature`); + continue; + } + newLines.push(line); + } + + fs.writeFileSync(installerPath, newLines.join('\n')); + + if (modified) { + console.log('\x1b[32m%s\x1b[0m', `✅ ${installerPath} patched successfully!`); + console.log('\x1b[36m%s\x1b[0m', `🔗 Pointing to: ${installerUrl}`); + } else { + console.log('\x1b[31m%s\x1b[0m', '❌ Error: Could not find line with "set -u" in installer script'); + } + +patch-ps1-installer: + #!/usr/bin/env node + const fs = require('fs'); + const installerUrl = process.env.INSTALLER_DOWNLOAD_URL || 'https://dl.bearcove.cloud/dump/dist-cross'; + const installerPath = './target/distrib/cargo-dist-installer.ps1'; + + const content = fs.readFileSync(installerPath, 'utf8'); + const lines = content.split('\n'); + let modified = false; + + const newLines = []; + for (const line of lines) { + if (line.includes('$env:INSTALLER_DOWNLOAD_URL = ')) { + continue; + } + if (line.includes('$app_name = ') && !modified) { + modified = true; + newLines.push(`$env:INSTALLER_DOWNLOAD_URL = "${installerUrl}" # patched by Justfile in dist repo, using dist_url_override feature`); + newLines.push(line); + continue; + } + newLines.push(line); + } + + fs.writeFileSync(installerPath, newLines.join('\n')); + + if (modified) { + console.log('\x1b[32m%s\x1b[0m', `✅ ${installerPath} patched successfully!`); + console.log('\x1b[36m%s\x1b[0m', `🔗 Pointing to: ${installerUrl}`); + } else { + console.log('\x1b[31m%s\x1b[0m', '❌ Error: Could not find line with "cargo-dist = " in installer script'); + } + +dump: + #!/bin/bash -eux + just build-all-plaforms + just patch-sh-installer + just patch-ps1-installer + mc mirror --overwrite ./target/distrib ${DIST_TARGET:-bearcove/dump/dist-cross} diff --git a/book/src/ci/customizing.md b/book/src/ci/customizing.md index 5519082a..5ec8b817 100644 --- a/book/src/ci/customizing.md +++ b/book/src/ci/customizing.md @@ -4,14 +4,13 @@ dist's generated CI configuration can be extended in several ways: it can be configured to install extra packages before the build begins, and it's possible to add extra jobs to run at specific lifecycle moments. - ## Install extra packages > since 0.4.0 Sometimes, you may need extra packages from the system package manager to be installed before in the builder before dist begins building your software. dist can do this for you by adding the `dependencies` setting to your dist config. When set, the packages you request will be fetched and installed in the step before `build`. Additionally, on macOS, the `cargo build` process will be wrapped in `brew bundle exec` to ensure that your dependencies can be found no matter where Homebrew placed them. -By default, we run Apple silicon (aarch64) builds for macOS on the `macos-13` runner, which is Intel-based. If your build process needs to link against C libraries from Homebrew using the `dependencies` feature, you will need to switch to an Apple silicon-native runner to ensure that you have access to Apple silicon-native dependencies from Homebrew. You can do this using the [custom runners][custom-runners] feature. Currently, `macos-14` is the oldest (and only) GitHub-provided runner for Apple silicon. +By default, we run Apple silicon (aarch64) builds for macOS on the `macos-13` runner, which is Intel-based. If your build process needs to link against C libraries from Homebrew using the `dependencies` feature, you will need to switch to an Apple silicon-native runner to ensure that you have access to Apple silicon-native dependencies from Homebrew. You can do this using the [custom runners][custom-runners] feature. Currently, `macos-14` is the oldest GitHub-provided runner for Apple silicon. Sometimes, you may want to make sure your users also have these dependencies available when they install your software. If you use a package manager-based installer, dist has the ability to specify these dependencies. By default, dist will examine your program to try to detect which dependencies it thinks will be necessary. At the moment, [Homebrew][homebrew] is the only supported package manager installer. You can also specify these dependencies manually. @@ -96,7 +95,9 @@ By default, dist uses the following runners: It's possible to configure alternate runners for these jobs, or runners for targets not natively supported by GitHub actions. To do this, use the [`github-custom-runners`][config-github-custom-runners] configuration setting in your dist config. Here's an example which adds support for Linux (aarch64) using runners from [Buildjet](https://buildjet.com/for-github-actions): ```toml -[workspace.metadata.dist.github-custom-runners] +# in `dist-workspace.toml` + +[dist.github-custom-runners] aarch64-unknown-linux-gnu = "buildjet-8vcpu-ubuntu-2204-arm" aarch64-unknown-linux-musl = "buildjet-8vcpu-ubuntu-2204-arm" ``` @@ -104,10 +105,139 @@ aarch64-unknown-linux-musl = "buildjet-8vcpu-ubuntu-2204-arm" In addition to adding support for new targets, some users may find it useful to use this feature to fine-tune their builds for supported targets. For example, some projects may wish to build on a newer Ubuntu runner or alternate Linux distros, or may wish to opt into building for Apple Silicon from a native runner by using the `macos-14` runner. Here's an example which uses `macos-14` for native Apple Silicon builds: ```toml -[workspace.metadata.dist.github-custom-runners] +# in `dist-workspace.toml` + +[dist.github-custom-runners] aarch64-apple-darwin = "macos-14" ``` +## Cross-compilation + +> since 0.26.0 + +dist will transparently use either of: + + * [cargo-zigbuild](https://github.com/rust-cross/cargo-zigbuild) + * [cargo-xwin](https://github.com/rust-cross/cargo-xwin) + +To try and build for the target you specified, from the host you specified. + +dist hardcodes knowledge of which cargo wrappers are better suited for which cross: `cargo-zigbuild` +handles `x86_64-unknown-linux-gnu` to `aarch64-unknown-linux-gnu` handsomely, for example. + +So if you ask for `aarch64-unknown-linux-gnu` artifacts, because at the time of this writing +there are no free `aarch64` GitHub runners, dist will assume you meant this: + +```toml +[dist.github-custom-runners] +aarch64-unknown-linux-gnu = "ubuntu-20.04" +``` + +Which really means this: + +```toml +[dist.github-custom-runners.aarch64-unknown-linux-gnu] +runner = "ubuntu-20.04" +host = "x86_64-unknown-linux-gnu" +``` + +...since dist knows which platform GitHub's own [runner +images](https://github.com/actions/runner-images) are. + +So you really only need to specify the `host` if you use [third-party GitHub Actions +runners](https://github.com/neysofu/awesome-github-actions-runners?tab=readme-ov-file#list-of-providers) (Namespace, Buildjet, etc.) + +If you don't specify the host, dist will just assume it's the same platform as +the target, which is why this works: + +```toml +[dist.github-custom-runners] +aarch64-unknown-linux-gnu = "buildjet-8vcpu-ubuntu-2204-arm" +``` + +Building `aarch64-pc-windows-msvc` binaries from a `x86_64-pc-windows-msvc` runner (like +`windows-2019`) is surprisingly hard. But building both binaries from an `x86_64-unknown-linux-gnu` +runner is surprisingly easy via `cargo-xwin` + +This will work, eventually: + +```toml +# in `dist-workspace.toml` + +[dist] +targets = ["x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc"] + +[dist.github-custom-runners.x86_64-pc-windows-msvc] +runner = "ubuntu-20.04" + +[dist.github-custom-runners.aarch64-pc-windows-msvc] +runner = "ubuntu-20.04" +``` + +...because dist can install `cargo-xwin` via `pip`. However, it will take +forever. It's probably best to use a docker image that already has +`cargo-xwin` installed, and other dependencies you probably want: + +```toml +# in `dist-workspace.toml` + +[dist] +targets = ["x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc"] + +[dist.github-custom-runners.x86_64-pc-windows-msvc] +container = "messense/cargo-xwin" + +[dist.github-custom-runners.aarch64-pc-windows-msvc] +container = "messense/cargo-xwin" +``` + +Which is short for: + +```toml +# cut: the rest of the config file + +[dist.github-custom-runners.x86_64-pc-windows-msvc] +container = { image = "messense/cargo-xwin", host = "x86_64-unknown-linux-gnu" } + +# etc. +``` + +...but unfortunately, GitHub Actions's "run workflows in container" feature doesn't +support emulation yet. We'd have to set up qemu, run docker manually, etc. — which +dist doesn't do as of now. So the `host` just defaults to `x86_64-unknown-linux-gnu` +right now, because that's all the GitHub runners support anywyay. + +So, because we're only specifying one feature, it's probably easier to just write this: + +```toml +[dist] +targets = ["x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc"] + +[dist.github-custom-runners] +x86_64-pc-windows-msvc.container = "messense/cargo-xwin" +aarch64-pc-windows-msvc.container = "messense/cargo-xwin" + +# (yes, that /is/ valid TOML) +``` + +Note that you can use containers for non-cross reasons: maybe you want your binaries to be +compatible with really old versions of glibc, older than Ubuntu 20.04: in this case, you +can do something like: + +```toml +[dist.github-custom-runners.x86_64-unknown-linux-gnu] +container = { image = "quay.io/pypa/manylinux_2_28_x86_64", host = "x86_64-unknown-linux-musl" } + +[dist.github-custom-runners.aarch64-unknown-linux-gnu] +container = { image = "quay.io/pypa/manylinux_2_28_x86_64", host = "x86_64-unknown-linux-musl" } +``` + +Note that here, the host triple for those container images is overriden to be `x86_64-unknown-linux-musl`, because dist itself (which must run in the container) might be using a too-recent version of glibc. + +Because of dist's cross-compilation support, if you have both `cargo-zigbuild` and `cargo-xwin` +installed on a macOS machine, you can build pretty much every target dist supports, by running +`dist build --artifacts all` — in fact, this is used to develop dist itself! + ### Build and upload artifacts on every pull request > since 0.3.0 diff --git a/cargo-dist-schema/Cargo.toml b/cargo-dist-schema/Cargo.toml index c5fc9da0..0ad42a1a 100644 --- a/cargo-dist-schema/Cargo.toml +++ b/cargo-dist-schema/Cargo.toml @@ -26,7 +26,7 @@ schemars.workspace = true semver.workspace = true serde.workspace = true serde_json.workspace = true - +target-lexicon.workspace = true [dev-dependencies] insta.workspace = true diff --git a/cargo-dist-schema/src/lib.rs b/cargo-dist-schema/src/lib.rs index 6ab266a9..aa94a498 100644 --- a/cargo-dist-schema/src/lib.rs +++ b/cargo-dist-schema/src/lib.rs @@ -9,19 +9,26 @@ //! The root type of the schema is [`DistManifest`][]. pub mod macros; +pub use target_lexicon; -use std::collections::BTreeMap; +use std::{collections::BTreeMap, str::FromStr}; use schemars::JsonSchema; use semver::Version; use serde::{Deserialize, Serialize}; +use target_lexicon::Triple; declare_strongly_typed_string! { - /// A rust target-triple (e.g. "x86_64-pc-windows-msvc") - pub struct TargetTriple => &TargetTripleRef; + /// A rustc-like target triple/tuple (e.g. "x86_64-pc-windows-msvc") + pub struct TripleName => &TripleNameRef; } -impl TargetTripleRef { +impl TripleNameRef { + /// Parse as a [`Triple`] + pub fn parse(&self) -> Result::Err> { + Triple::from_str(self.as_str()) + } + /// Returns true if this target triple contains the word "musl" pub fn is_musl(&self) -> bool { self.0.contains("musl") @@ -70,12 +77,18 @@ impl TargetTripleRef { self.0.contains("windows-msvc") } } - declare_strongly_typed_string! { /// The name of a Github Actions Runner, like `ubuntu-20.04` or `macos-13` pub struct GithubRunner => &GithubRunnerRef; + + /// A container image, like `quay.io/pypa/manylinux_2_28_x86_64` + pub struct ContainerImage => &ContainerImageRef; } +/// Github runners configuration (which github image/container should be used +/// to build which target). +pub type GithubRunners = BTreeMap; + impl GithubRunnerRef { /// Does the runner name contain the word "buildjet"? pub fn is_buildjet(&self) -> bool { @@ -83,6 +96,31 @@ impl GithubRunnerRef { } } +/// A value or just a string +/// +/// This allows us to have a simple string-based version of a config while still +/// allowing for a more advanced version to exist. +#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] +#[serde(untagged)] +pub enum StringLikeOr { + /// They gave the simple string-like value (see `declare_strongly_typed_string!`) + StringLike(S), + /// They gave a more interesting value + Val(T), +} + +impl StringLikeOr { + /// Constructs a new `StringLikeOr` from the string-like value `s` + pub fn from_s(s: S) -> Self { + Self::StringLike(s) + } + + /// Constructs a new `StringLikeOr` from the more interesting value `t` + pub fn from_t(t: T) -> Self { + Self::Val(t) + } +} + /// A local system path on the machine dist was run. /// /// This is a String because when deserializing this may be a path format from a different OS! @@ -249,7 +287,7 @@ pub struct AssetInfo { /// * length 0: not a meaningful question, maybe some static file /// * length 1: typical of binaries /// * length 2+: some kind of universal binary - pub target_triples: Vec, + pub target_triples: Vec, /// the linkage of this Asset pub linkage: Option, } @@ -284,7 +322,7 @@ pub struct GithubMatrix { /// define each task manually rather than doing cross-product stuff #[serde(default)] #[serde(skip_serializing_if = "Vec::is_empty")] - pub include: Vec, + pub include: Vec, } impl GithubMatrix { @@ -296,29 +334,149 @@ impl GithubMatrix { } } -/// Entry for a github matrix +declare_strongly_typed_string! { + /// A bit of shell script to install brew/apt/chocolatey/etc. packages + pub struct PackageInstallScript => &PackageInstallScriptRef; +} + +/// The version of `GithubRunnerConfig` that's deserialized from the config file: it +/// has optional fields that are computed later. #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] -pub struct GithubMatrixEntry { - /// Targets to build for - #[serde(skip_serializing_if = "Option::is_none")] - pub targets: Option>, - /// Github Runner to user - #[serde(skip_serializing_if = "Option::is_none")] +pub struct GithubRunnerConfigInput { + /// GHA's `runs-on` key: Github Runner image to use, see + /// and + /// + /// This is not necessarily a well-known runner, it could be something self-hosted, it + /// could be from BuildJet, Namespace, etc. + /// + /// If not specified, `container` has to be set. pub runner: Option, + + /// Host triple of the runner (well-known, custom, or best guess). + /// If the runner is one of GitHub's official runner images, the platform + /// is hardcoded. If it's custom, then we have a `target_triple => runner` in the config + pub host: Option, + + /// Container image to run the job in, using GitHub's builtin + /// container support, see + /// + /// This doesn't allow mounting volumes, or anything, because we're only able + /// to set the `container` key to something stringy + /// + /// If not specified, `runner` has to be set. + pub container: Option>, +} + +/// GitHub config that's common between different kinds of jobs (global, local) +#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq, PartialOrd, Ord)] +pub struct GithubRunnerConfig { + /// GHA's `runs-on` key: Github Runner image to use, see + /// and + /// + /// This is not necessarily a well-known runner, it could be something self-hosted, it + /// could be from BuildJet, Namespace, etc. + pub runner: GithubRunner, + + /// Host triple of the runner (well-known, custom, or best guess). + /// If the runner is one of GitHub's official runner images, the platform + /// is hardcoded. If it's custom, then we have a `target_triple => runner` in the config + pub host: TripleName, + + /// Container image to run the job in, using GitHub's builtin + /// container support, see + /// + /// This doesn't allow mounting volumes, or anything, because we're only able + /// to set the `container` key to something stringy + #[serde(skip_serializing_if = "Option::is_none")] + pub container: Option, +} + +impl GithubRunnerConfig { + /// If the container runs through a container, that container might have a different + /// architecture than the outer VM — this returns the container's triple if any, + /// and falls back to the "machine"'s triple if not. + pub fn real_triple_name(&self) -> &TripleNameRef { + if let Some(container) = &self.container { + &container.host + } else { + &self.host + } + } + + /// cf. [`Self::GithubRunnerConfig`], but parsed + pub fn real_triple(&self) -> Triple { + self.real_triple_name().parse().unwrap() + } +} + +/// GitHub config that's common between different kinds of jobs (global, local) +#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] +pub struct ContainerConfigInput { + /// The container image to run, something like `ubuntu:20.04` or + /// `quay.io/pypa/manylinux_2_28_x86_64` + pub image: ContainerImage, + + /// The host triple of the container, something like `x86_64-unknown-linux-gnu` + /// or `aarch64-unknown-linux-musl` or whatever. + pub host: Option, +} + +/// GitHub config that's common between different kinds of jobs (global, local) +#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq, PartialOrd, Ord)] +pub struct ContainerConfig { + /// The container image to run, something like `ubuntu:20.04` or + /// `quay.io/pypa/manylinux_2_28_x86_64` + pub image: ContainerImage, + + /// The host triple of the container, something like `x86_64-unknown-linux-gnu` + /// or `aarch64-unknown-linux-musl` or whatever. + pub host: TripleName, +} + +/// Used in `github/release.yml.j2` to template out "global" build jobs +/// (plan, global assets, announce, etc) +#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] +pub struct GithubGlobalJobConfig { + /// Where to run this job? + #[serde(flatten)] + pub runner: GithubRunnerConfig, + /// Expression to execute to install dist pub install_dist: GhaRunStep, - /// Expression to execute to install cargo-auditable - pub install_cargo_auditable: GhaRunStep, + + /// Arguments to pass to dist + pub dist_args: String, + /// Expression to execute to install cargo-cyclonedx #[serde(skip_serializing_if = "Option::is_none")] pub install_cargo_cyclonedx: Option, +} + +/// Used in `github/release.yml.j2` to template out "local" build jobs +#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] +pub struct GithubLocalJobConfig { + /// Where to run this job? + #[serde(flatten)] + pub runner: GithubRunnerConfig, + + /// Expression to execute to install dist + pub install_dist: GhaRunStep, + /// Arguments to pass to dist + pub dist_args: String, + + /// Target triples to build for #[serde(skip_serializing_if = "Option::is_none")] - pub dist_args: Option, + pub targets: Option>, + + /// Expression to execute to install cargo-auditable + pub install_cargo_auditable: GhaRunStep, + /// Command to run to install dependencies #[serde(skip_serializing_if = "Option::is_none")] - pub packages_install: Option, - /// what cache provider to use + pub packages_install: Option, + + /// What cache provider to use #[serde(skip_serializing_if = "Option::is_none")] pub cache_provider: Option, } @@ -475,7 +633,7 @@ pub struct Artifact { /// The target triple of the bundle #[serde(skip_serializing_if = "Vec::is_empty")] #[serde(default)] - pub target_triples: Vec, + pub target_triples: Vec, /// The location of the artifact on the local system #[serde(skip_serializing_if = "Option::is_none")] #[serde(default)] @@ -911,6 +1069,23 @@ pub enum PackageManager { Apt, } +declare_strongly_typed_string! { + /// A homebrew package name, cf. + pub struct HomebrewPackageName => &HomebrewPackageNameRef; + + /// An APT package name, cf. + pub struct AptPackageName => &AptPackageNameRef; + + /// A chocolatey package name, cf. + pub struct ChocolateyPackageName => &ChocolateyPackageNameRef; + + /// A pip package name + pub struct PipPackageName => &PipPackageNameRef; + + /// A package version + pub struct PackageVersion => &PackageVersionRef; +} + /// Represents a dynamic library located somewhere on the system #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq, PartialOrd, Ord)] pub struct Library { @@ -921,6 +1096,9 @@ pub struct Library { pub source: Option, /// Which package manager provided this library pub package_manager: Option, + // FIXME: `HomebrewPackageName` and others are now strongly-typed, which makes having this + // source/packagemanager thingy problematic. Maybe we could just have an enum, with Apt, + // Homebrew, and Chocolatey variants? That would change the schema though. } impl Linkage { @@ -940,31 +1118,6 @@ impl Linkage { self.other.extend(other.iter().cloned()); self.frameworks.extend(frameworks.iter().cloned()); } - - /// Returns a flat list of packages that come from the specific package manager - pub fn packages_from(&self, package_manager: PackageManager) -> Vec { - let mut packages = vec![]; - packages.extend( - self.system - .iter() - .filter(|l| l.package_manager == Some(package_manager)) - .filter_map(|l| l.source.clone()), - ); - packages.extend( - self.homebrew - .iter() - .filter(|l| l.package_manager == Some(package_manager)) - .filter_map(|l| l.source.clone()), - ); - packages.extend( - self.other - .iter() - .filter(|l| l.package_manager == Some(package_manager)) - .filter_map(|l| l.source.clone()), - ); - - packages - } } impl Library { diff --git a/cargo-dist-schema/src/macros.rs b/cargo-dist-schema/src/macros.rs index 2f6b3d94..8e0ec362 100644 --- a/cargo-dist-schema/src/macros.rs +++ b/cargo-dist-schema/src/macros.rs @@ -110,7 +110,7 @@ /// ```rust,ignore /// declare_strongly_typed_string! { /// /// TargetTriple docs go here -/// pub const TargetTriple => &TargetTripleRef; +/// pub const TargetTriple => &TripleNameRef; /// /// /// GithubRunner docs go here /// pub const GithubRunner => &GithubRunner; @@ -133,14 +133,14 @@ /// } /// ``` /// -/// If you're only reading from it, then maybe you can take a `&TargetTripleRef` instead: +/// If you're only reading from it, then maybe you can take a `&TripleNameRef` instead: /// /// ```rust,ignore /// fn is_target_triple_funny(target: &str) -> bool { /// target.contains("loong") // let's be honest: it's kinda funny /// } /// // 👇 becomes -/// fn is_target_triple_funny(target: &TargetTripleRef) -> bool { +/// fn is_target_triple_funny(target: &TripleNameRef) -> bool { /// target.as_str().contains("loong") /// } /// ``` @@ -173,8 +173,8 @@ /// let target = TargetTriple::new("x86_64-unknown-linux-gnu"); /// ``` /// -/// What you're getting here is a `&'static TargetTripleRef` — no allocations -/// involved, and if your functions take `&TargetTripleRef`, then you're already +/// What you're getting here is a `&'static TripleNameRef` — no allocations +/// involved, and if your functions take `&TripleNameRef`, then you're already /// all set. /// /// ### Treating it as a string anyway @@ -234,14 +234,14 @@ /// This will not work: /// /// ```rust,ignore -/// fn i_take_a_slice(targets: &[TargetTripleRef]) { todo!(targets) } +/// fn i_take_a_slice(targets: &[TripleNameRef]) { todo!(targets) } /// /// let targets = vec![TargetTriple::new("x86_64-unknown-linux-gnu")]; /// i_take_a_slice(&targets); /// ``` /// /// Because you have a `&Vec`, and `Deref` only takes you -/// as far as `&[TargetTriple]`, but not `&[TargetTripleRef]`. If you +/// as far as `&[TargetTriple]`, but not `&[TripleNameRef]`. If you /// encounter that case, it's probably fine to just take a `&[TargetTriple]`. /// /// Note that you would have the same problem with `Vec`: it would give @@ -253,7 +253,7 @@ /// This will not work: /// /// ```rust,ignore -/// fn match_on_target(target: &TargetTripleRef) => &str { +/// fn match_on_target(target: &TripleNameRef) => &str { /// match target { /// TARGET_X64_WINDOWS => "what's up gamers", /// _ => "good morning", @@ -261,7 +261,7 @@ /// } /// ``` /// -/// Even if `TARGET_X64_WINDOWS` is a `&'static TargetTripleRef` and +/// Even if `TARGET_X64_WINDOWS` is a `&'static TripleNameRef` and /// a `const`. Doesn't matter. rustc says no. Maybe in the future. /// /// For now, just stick it in a `HashMap`, or use an if-else chain or something. Sorry! diff --git a/cargo-dist-schema/src/snapshots/cargo_dist_schema__emit.snap b/cargo-dist-schema/src/snapshots/cargo_dist_schema__emit.snap index 1439d74d..585a5e7e 100644 --- a/cargo-dist-schema/src/snapshots/cargo_dist_schema__emit.snap +++ b/cargo-dist-schema/src/snapshots/cargo_dist_schema__emit.snap @@ -671,6 +671,24 @@ snapshot_kind: text } } }, + "ContainerConfig": { + "description": "GitHub config that's common between different kinds of jobs (global, local)", + "type": "object", + "required": [ + "host", + "image" + ], + "properties": { + "host": { + "description": "The host triple of the container, something like `x86_64-unknown-linux-gnu` or `aarch64-unknown-linux-musl` or whatever.", + "type": "string" + }, + "image": { + "description": "The container image to run, something like `ubuntu:20.04` or `quay.io/pypa/manylinux_2_28_x86_64`", + "type": "string" + } + } + }, "EnvironmentVariables": { "description": "Release-specific environment variables", "type": "object", @@ -815,40 +833,42 @@ snapshot_kind: text } } }, - "GithubMatrix": { - "description": "Github CI Matrix", - "type": "object", - "properties": { - "include": { - "description": "define each task manually rather than doing cross-product stuff", - "type": "array", - "items": { - "$ref": "#/definitions/GithubMatrixEntry" - } - } - } - }, - "GithubMatrixEntry": { - "description": "Entry for a github matrix", + "GithubLocalJobConfig": { + "description": "Used in `github/release.yml.j2` to template out \"local\" build jobs", "type": "object", "required": [ + "dist_args", + "host", "install_cargo_auditable", - "install_dist" + "install_dist", + "runner" ], "properties": { "cache_provider": { - "description": "what cache provider to use", + "description": "What cache provider to use", "type": [ "string", "null" ] }, + "container": { + "description": "Container image to run the job in, using GitHub's builtin container support, see \n\nThis doesn't allow mounting volumes, or anything, because we're only able to set the `container` key to something stringy", + "anyOf": [ + { + "$ref": "#/definitions/ContainerConfig" + }, + { + "type": "null" + } + ] + }, "dist_args": { "description": "Arguments to pass to dist", - "type": [ - "string", - "null" - ] + "type": "string" + }, + "host": { + "description": "Host triple of the runner (well-known, custom, or best guess). If the runner is one of GitHub's official runner images, the platform is hardcoded. If it's custom, then we have a `target_triple => runner` in the config", + "type": "string" }, "install_cargo_auditable": { "description": "Expression to execute to install cargo-auditable", @@ -858,17 +878,6 @@ snapshot_kind: text } ] }, - "install_cargo_cyclonedx": { - "description": "Expression to execute to install cargo-cyclonedx", - "anyOf": [ - { - "$ref": "#/definitions/GhaRunStep" - }, - { - "type": "null" - } - ] - }, "install_dist": { "description": "Expression to execute to install dist", "allOf": [ @@ -885,14 +894,11 @@ snapshot_kind: text ] }, "runner": { - "description": "Github Runner to user", - "type": [ - "string", - "null" - ] + "description": "GHA's `runs-on` key: Github Runner image to use, see and \n\nThis is not necessarily a well-known runner, it could be something self-hosted, it could be from BuildJet, Namespace, etc.", + "type": "string" }, "targets": { - "description": "Targets to build for", + "description": "Target triples to build for", "type": [ "array", "null" @@ -903,6 +909,19 @@ snapshot_kind: text } } }, + "GithubMatrix": { + "description": "Github CI Matrix", + "type": "object", + "properties": { + "include": { + "description": "define each task manually rather than doing cross-product stuff", + "type": "array", + "items": { + "$ref": "#/definitions/GithubLocalJobConfig" + } + } + } + }, "GlibcVersion": { "description": "Minimum glibc version required to run software", "type": "object", diff --git a/cargo-dist/src/announce.rs b/cargo-dist/src/announce.rs index 20e8f23c..acb1f10a 100644 --- a/cargo-dist/src/announce.rs +++ b/cargo-dist/src/announce.rs @@ -90,7 +90,7 @@ use std::fmt::Display; use axoproject::PackageIdx; use axotag::{parse_tag, Package, PartialAnnouncementTag, ReleaseType}; -use cargo_dist_schema::{DistManifest, GithubHosting, TargetTriple, TargetTripleRef}; +use cargo_dist_schema::{DistManifest, GithubHosting, TripleName, TripleNameRef}; use itertools::Itertools; use semver::Version; use tracing::info; @@ -977,7 +977,7 @@ pub fn announcement_github(manifest: &mut DistManifest) { } /// Create a key for Properly sorting a list of target triples -fn sortable_triples(triples: &[TargetTriple]) -> Vec> { +fn sortable_triples(triples: &[TripleName]) -> Vec> { // Make each triple sortable, and then sort the list of triples by those // (usually there's only one triple but DETERMINISM) let mut output: Vec> = triples.iter().map(|t| sortable_triple(t)).collect(); @@ -986,7 +986,7 @@ fn sortable_triples(triples: &[TargetTriple]) -> Vec> { } /// Create a key for Properly sorting target triples -fn sortable_triple(triple: &TargetTripleRef) -> Vec { +fn sortable_triple(triple: &TripleNameRef) -> Vec { // We want to sort lexically by: os, abi, arch // We are given arch, vendor, os, abi // @@ -1018,7 +1018,7 @@ fn sortable_triple(triple: &TargetTripleRef) -> Vec { #[cfg(test)] mod tests { - use cargo_dist_schema::TargetTripleRef; + use cargo_dist_schema::TripleNameRef; use super::sortable_triple; #[test] @@ -1045,7 +1045,7 @@ mod tests { "x86_64-unknown-linux-gnu.2.31", "x86_64-unknown-linux-musl-static", ]; - targets.sort_by_cached_key(|t| sortable_triple(TargetTripleRef::from_str(t))); + targets.sort_by_cached_key(|t| sortable_triple(TripleNameRef::from_str(t))); assert_eq!( targets, vec![ diff --git a/cargo-dist/src/backend/ci/github.rs b/cargo-dist/src/backend/ci/github.rs index c8478b13..bd568f47 100644 --- a/cargo-dist/src/backend/ci/github.rs +++ b/cargo-dist/src/backend/ci/github.rs @@ -8,21 +8,26 @@ use axoasset::{LocalAsset, SourceFile}; use axoprocess::Cmd; use camino::{Utf8Path, Utf8PathBuf}; use cargo_dist_schema::{ - GhaRunStep, GithubMatrix, GithubMatrixEntry, GithubRunner, GithubRunnerRef, TargetTriple, - TargetTripleRef, + target_lexicon::{self, OperatingSystem, Triple}, + AptPackageName, ChocolateyPackageName, GhaRunStep, GithubGlobalJobConfig, GithubLocalJobConfig, + GithubMatrix, GithubRunnerConfig, GithubRunnerRef, GithubRunners, HomebrewPackageName, + PackageInstallScript, PackageVersion, PipPackageName, TripleNameRef, }; +use itertools::Itertools; use serde::{Deserialize, Serialize}; use tracing::warn; use crate::{ backend::{diff_files, templates::TEMPLATE_CI_GITHUB}, + build_wrapper_for_cross, config::{ v1::{ci::github::GithubCiConfig, publishers::PublisherConfig}, DependencyKind, GithubPermission, GithubPermissionMap, GithubReleasePhase, HostingStyle, JinjaGithubRepoPair, JobStyle, ProductionMode, PublishStyle, SystemDependencies, }, errors::DistResult, - DistError, DistGraph, SortedMap, SortedSet, + platform::github_runners::target_for_github_runner_or_default, + CargoBuildWrapper, DistError, DistGraph, SortedMap, SortedSet, }; use super::{ @@ -65,7 +70,7 @@ pub struct GithubCiInfo { /// What kind of job to run on pull request pub pr_run_mode: cargo_dist_schema::PrRunMode, /// global task - pub global_task: GithubMatrixEntry, + pub global_task: GithubGlobalJobConfig, /// homebrew tap pub tap: Option, /// plan jobs @@ -222,7 +227,7 @@ impl GithubCiInfo { let need_cargo_cyclonedx = dist.config.builds.cargo.cargo_cyclonedx; // Figure out what builds we need to do - let mut local_targets: SortedSet<&TargetTripleRef> = SortedSet::new(); + let mut local_targets: SortedSet<&TripleNameRef> = SortedSet::new(); for release in &dist.releases { for target in &release.targets { local_targets.insert(target); @@ -258,17 +263,13 @@ impl GithubCiInfo { let global_runner = ci_config .runners .get("global") - .map(|s| s.as_ref()) - .unwrap_or(GITHUB_LINUX_RUNNER); - let global_task = GithubMatrixEntry { - targets: None, - cache_provider: cache_provider_for_runner(global_runner), - runner: Some(global_runner.to_owned()), - dist_args: Some("--artifacts=global".into()), + .cloned() + .unwrap_or_else(default_global_runner_config); + let global_task = GithubGlobalJobConfig { + runner: global_runner.to_owned(), + dist_args: "--artifacts=global".into(), install_dist: dist_install_strategy.dash(), - install_cargo_auditable: cargo_auditable_install_strategy.dash(), install_cargo_cyclonedx: Some(cargo_cyclonedx_install_strategy.dash()), - packages_install: None, }; let tap = dist.global_homebrew_tap.clone(); @@ -322,22 +323,24 @@ impl GithubCiInfo { }; for (runner, targets) in local_runs { use std::fmt::Write; - let install_dist = dist_install_strategy.for_targets(&targets); - let install_cargo_auditable = cargo_auditable_install_strategy.for_targets(&targets); + let real_triple = runner.real_triple(); + let install_dist = dist_install_strategy.for_triple(&real_triple); + let install_cargo_auditable = + cargo_auditable_install_strategy.for_triple(&runner.real_triple()); let mut dist_args = String::from("--artifacts=local"); for target in &targets { write!(dist_args, " --target={target}").unwrap(); } - tasks.push(GithubMatrixEntry { + let packages_install = system_deps_install_script(&runner, &targets, &dependencies)?; + tasks.push(GithubLocalJobConfig { targets: Some(targets.iter().copied().map(|s| s.to_owned()).collect()), cache_provider: cache_provider_for_runner(&runner), - runner: Some(runner), - dist_args: Some(dist_args), + runner, + dist_args, install_dist: install_dist.to_owned(), install_cargo_auditable: install_cargo_auditable.to_owned(), - install_cargo_cyclonedx: None, // Not used by local builds. - packages_install: package_install_for_targets(&targets, &dependencies), + packages_install, }); } @@ -554,8 +557,8 @@ fn build_jobs( /// Get the best `cache-provider` key to use for . /// /// In the future we might make "None" here be a way to say "disable the cache". -fn cache_provider_for_runner(runner: &GithubRunnerRef) -> Option { - if runner.is_buildjet() { +fn cache_provider_for_runner(rc: &GithubRunnerConfig) -> Option { + if rc.runner.is_buildjet() { Some("buildjet".into()) } else { Some("github".into()) @@ -572,20 +575,23 @@ fn cache_provider_for_runner(runner: &GithubRunnerRef) -> Option { /// macos builds. It also makes it impossible to have one macos build fail and the other /// succeed (uploading itself to the draft release). /// -/// In priniciple it does remove some duplicated setup work, so this is ostensibly "cheaper". +/// In principle it does remove some duplicated setup work, so this is ostensibly "cheaper". fn distribute_targets_to_runners_merged<'a>( - targets: SortedSet<&'a TargetTripleRef>, - custom_runners: &BTreeMap, -) -> std::vec::IntoIter<(GithubRunner, Vec<&'a TargetTripleRef>)> { - let mut groups = SortedMap::>::new(); + targets: SortedSet<&'a TripleNameRef>, + custom_runners: &GithubRunners, +) -> std::vec::IntoIter<(GithubRunnerConfig, Vec<&'a TripleNameRef>)> { + let mut groups = SortedMap::>::new(); for target in targets { - let runner = github_runner_for_target(target, custom_runners); - let runner = runner.unwrap_or_else(|| { - let default = GITHUB_LINUX_RUNNER; - warn!("not sure which github runner should be used for {target}, assuming {default}"); - default.to_owned() + let runner_conf = github_runner_for_target(target, custom_runners); + let runner_conf = runner_conf.unwrap_or_else(|| { + let fallback = default_global_runner_config(); + warn!( + "not sure which github runner should be used for {target}, assuming {}", + fallback.runner + ); + fallback.to_owned() }); - groups.entry(runner).or_default().push(target); + groups.entry(runner_conf).or_default().push(target); } // This extra into_iter+collect is needed to make this have the same // return type as distribute_targets_to_runners_split @@ -595,61 +601,66 @@ fn distribute_targets_to_runners_merged<'a>( /// Given a set of targets we want to build local artifacts for, map them to Github Runners /// while preferring each target gets its own runner for latency and fault-isolation. fn distribute_targets_to_runners_split<'a>( - targets: SortedSet<&'a TargetTripleRef>, - custom_runners: &BTreeMap, -) -> std::vec::IntoIter<(GithubRunner, Vec<&'a TargetTripleRef>)> { + targets: SortedSet<&'a TripleNameRef>, + custom_runners: &GithubRunners, +) -> std::vec::IntoIter<(GithubRunnerConfig, Vec<&'a TripleNameRef>)> { let mut groups = vec![]; for target in targets { let runner = github_runner_for_target(target, custom_runners); let runner = runner.unwrap_or_else(|| { - let default = GITHUB_LINUX_RUNNER; - warn!("not sure which github runner should be used for {target}, assuming {default}"); - default.to_owned() + let fallback = default_global_runner_config(); + warn!( + "not sure which github runner should be used for {target}, assuming {}", + fallback.runner + ); + fallback.to_owned() }); groups.push((runner, vec![target])); } groups.into_iter() } -/// The Github Runner to use for Linux -const GITHUB_LINUX_RUNNER: &GithubRunnerRef = GithubRunnerRef::from_str("ubuntu-20.04"); -/// The Github Runner to use for Intel macos -const GITHUB_MACOS_INTEL_RUNNER: &GithubRunnerRef = GithubRunnerRef::from_str("macos-13"); -/// The Github Runner to use for Apple Silicon macos -const GITHUB_MACOS_ARM64_RUNNER: &GithubRunnerRef = GithubRunnerRef::from_str("macos-13"); -/// The Github Runner to use for windows -const GITHUB_WINDOWS_RUNNER: &GithubRunnerRef = GithubRunnerRef::from_str("windows-2019"); +/// Generates a [`GithubRunnerConfig`] from a given github runner name +pub fn runner_to_config(runner: &GithubRunnerRef) -> GithubRunnerConfig { + GithubRunnerConfig { + runner: runner.to_owned(), + host: target_for_github_runner_or_default(runner).to_owned(), + container: None, + } +} + +const DEFAULT_LINUX_RUNNER: &GithubRunnerRef = GithubRunnerRef::from_str("ubuntu-20.04"); + +fn default_global_runner_config() -> GithubRunnerConfig { + runner_to_config(DEFAULT_LINUX_RUNNER) +} /// Get the appropriate Github Runner for building a target fn github_runner_for_target( - target: &TargetTripleRef, - custom_runners: &BTreeMap, -) -> Option { + target: &TripleNameRef, + custom_runners: &GithubRunners, +) -> Option { if let Some(runner) = custom_runners.get(target) { - return Some(runner.to_owned()); + return Some(runner.clone()); } + let target_triple: Triple = target.parse().unwrap(); + // We want to default to older runners to minimize the places // where random system dependencies can creep in and be very // recent. This helps with portability! - if target.is_linux() { - Some(GITHUB_LINUX_RUNNER.to_owned()) - } else if target.is_apple() && target.is_x86_64() { - Some(GITHUB_MACOS_INTEL_RUNNER.to_owned()) - } else if target.is_apple() && target.is_aarch64() { - Some(GITHUB_MACOS_ARM64_RUNNER.to_owned()) - } else if target.is_windows() { - Some(GITHUB_WINDOWS_RUNNER.to_owned()) - } else { - None - } + Some(match target_triple.operating_system { + OperatingSystem::Linux => runner_to_config(GithubRunnerRef::from_str("ubuntu-20.04")), + OperatingSystem::Darwin => runner_to_config(GithubRunnerRef::from_str("macos-13")), + OperatingSystem::Windows => runner_to_config(GithubRunnerRef::from_str("windows-2019")), + _ => return None, + }) } -fn brewfile_from(packages: &[String]) -> String { - let brewfile_lines: Vec = packages - .iter() +fn brewfile_from<'a>(packages: impl Iterator) -> String { + packages .map(|p| { - let lower = p.to_ascii_lowercase(); + let lower = p.as_str().to_ascii_lowercase(); // Although `brew install` can take either a formula or a cask, // Brewfiles require you to use the `cask` verb for casks and `brew` // for formulas. @@ -659,12 +670,10 @@ fn brewfile_from(packages: &[String]) -> String { format!(r#"brew "{p}""#).to_owned() } }) - .collect(); - - brewfile_lines.join("\n") + .join("\n") } -fn brew_bundle_command(packages: &[String]) -> String { +fn brew_bundle_command<'a>(packages: impl Iterator) -> String { format!( r#"cat << EOF >Brewfile {} @@ -675,92 +684,156 @@ brew bundle install"#, ) } -fn package_install_for_targets( - targets: &[&TargetTripleRef], +fn system_deps_install_script( + rc: &GithubRunnerConfig, + targets: &[&TripleNameRef], packages: &SystemDependencies, -) -> Option { - // FIXME?: handle mixed-OS targets - for target in targets { - match target.as_str() { - "i686-apple-darwin" | "x86_64-apple-darwin" | "aarch64-apple-darwin" => { - let packages: Vec = packages - .homebrew - .clone() - .into_iter() - .filter(|(_, package)| package.0.wanted_for_target(target)) - .filter(|(_, package)| package.0.stage_wanted(&DependencyKind::Build)) - .map(|(name, _)| name) - .collect(); +) -> DistResult> { + let mut brew_packages: SortedSet = Default::default(); + let mut apt_packages: SortedSet<(AptPackageName, Option)> = Default::default(); + let mut chocolatey_packages: SortedSet<(ChocolateyPackageName, Option)> = + Default::default(); - if packages.is_empty() { - return None; + let host = rc.real_triple(); + match host.operating_system { + OperatingSystem::Darwin => { + for (name, pkg) in &packages.homebrew { + if !pkg.0.stage_wanted(&DependencyKind::Build) { + continue; } - - return Some(brew_bundle_command(&packages)); + if !targets.iter().any(|target| pkg.0.wanted_for_target(target)) { + continue; + } + brew_packages.insert(name.clone()); + } + } + OperatingSystem::Linux => { + for (name, pkg) in &packages.apt { + if !pkg.0.stage_wanted(&DependencyKind::Build) { + continue; + } + if !targets.iter().any(|target| pkg.0.wanted_for_target(target)) { + continue; + } + apt_packages.insert((name.clone(), pkg.0.version.clone())); } - "i686-unknown-linux-gnu" - | "x86_64-unknown-linux-gnu" - | "aarch64-unknown-linux-gnu" - | "i686-unknown-linux-musl" - | "x86_64-unknown-linux-musl" - | "aarch64-unknown-linux-musl" => { - let mut packages: Vec = packages - .apt - .clone() - .into_iter() - .filter(|(_, package)| package.0.wanted_for_target(target)) - .filter(|(_, package)| package.0.stage_wanted(&DependencyKind::Build)) - .map(|(name, spec)| { - if let Some(version) = spec.0.version { - format!("{name}={version}") - } else { - name - } - }) - .collect(); + let has_musl_target = targets.iter().any(|target| { + target.parse().unwrap().environment == target_lexicon::Environment::Musl + }); + if has_musl_target { // musl builds may require musl-tools to build; // necessary for more complex software - if target.is_linux_musl() { - packages.push("musl-tools".to_owned()); - } - - if packages.is_empty() { - return None; - } - - let apts = packages.join(" "); - return Some( - format!("sudo apt-get update && sudo apt-get install {apts}").to_owned(), - ); + apt_packages.insert((AptPackageName::new("musl-tools".to_owned()), None)); } - "i686-pc-windows-msvc" | "x86_64-pc-windows-msvc" | "aarch64-pc-windows-msvc" => { - let commands: Vec = packages - .chocolatey - .clone() - .into_iter() - .filter(|(_, package)| package.0.wanted_for_target(target)) - .filter(|(_, package)| package.0.stage_wanted(&DependencyKind::Build)) - .map(|(name, package)| { - if let Some(version) = package.0.version { - format!("choco install {name} --version={version}") - } else { - format!("choco install {name}") - } - }) - .collect(); - - if commands.is_empty() { - return None; + } + OperatingSystem::Windows => { + for (name, pkg) in &packages.chocolatey { + if !pkg.0.stage_wanted(&DependencyKind::Build) { + continue; } - - return Some(commands.join("\n")); + if !targets.iter().any(|target| pkg.0.wanted_for_target(target)) { + continue; + } + chocolatey_packages.insert((name.clone(), pkg.0.version.clone())); } - _ => {} + } + _ => { + panic!( + "unsupported host operating system: {:?}", + host.operating_system + ) } } - None + let mut lines = vec![]; + if !brew_packages.is_empty() { + lines.push(brew_bundle_command(brew_packages.iter())) + } + + if !apt_packages.is_empty() { + lines.push("sudo apt-get update".to_owned()); + let args = apt_packages + .iter() + .map(|(pkg, version)| { + if let Some(v) = version { + format!("{pkg}={v}") + } else { + pkg.to_string() + } + }) + .join(" "); + lines.push(format!("sudo apt-get install {args}")); + } + + for (pkg, version) in &chocolatey_packages { + lines.push(if let Some(v) = version { + format!("choco install {pkg} --version={v} --yes") + } else { + format!("choco install {pkg} --yes") + }); + } + + // Regardless of what we're doing, we might need build wrappers! + let mut required_wrappers: SortedSet = Default::default(); + for target in targets { + let target = target.parse().unwrap(); + if let Some(wrapper) = build_wrapper_for_cross(&host, &target)? { + required_wrappers.insert(wrapper); + } + } + + let mut pip_pkgs: SortedSet = Default::default(); + if required_wrappers.contains(&CargoBuildWrapper::ZigBuild) { + pip_pkgs.insert(PipPackageName::new("cargo-zigbuild".to_owned())); + } + if required_wrappers.contains(&CargoBuildWrapper::Xwin) { + pip_pkgs.insert(PipPackageName::new("cargo-xwin".to_owned())); + } + + if !pip_pkgs.is_empty() { + let push_pip_install_lines = |lines: &mut Vec| { + if host.operating_system == OperatingSystem::Linux { + // make sure pip is installed — on dnf-based distros we might need to install + // it (true for e.g. the `quay.io/pypa/manylinux_2_28_x86_64` image) + // + // this doesn't work for all distros of course — others might need to be added + // later. there's no universal way to install tooling in dist right now anyway. + lines.push(" if ! command -v pip3 > /dev/null 2>&1; then".to_owned()); + lines.push(" dnf install --assumeyes python3-pip".to_owned()); + lines.push(" pip3 install --upgrade pip".to_owned()); + lines.push(" fi".to_owned()); + } + }; + + for pip_pkg in pip_pkgs { + match pip_pkg.as_str() { + "cargo-xwin" => { + // that one could already be installed + lines.push("if ! command -v cargo-xwin > /dev/null 2>&1; then".to_owned()); + push_pip_install_lines(&mut lines); + lines.push(" pip3 install cargo-xwin".to_owned()); + lines.push("fi".to_owned()); + } + "cargo-zigbuild" => { + // that one could already be installed + lines.push("if ! command -v cargo-zigbuild > /dev/null 2>&1; then".to_owned()); + push_pip_install_lines(&mut lines); + lines.push(" pip3 install cargo-zigbuild".to_owned()); + lines.push("fi".to_owned()); + } + _ => { + lines.push(format!("pip3 install {pip_pkg}")); + } + } + } + } + + Ok(if lines.is_empty() { + None + } else { + Some(PackageInstallScript::new(lines.join("\n"))) + }) } /// Builder for looking up and reporting errors in the steps provided by the diff --git a/cargo-dist/src/backend/ci/mod.rs b/cargo-dist/src/backend/ci/mod.rs index 11f84e32..4920aabc 100644 --- a/cargo-dist/src/backend/ci/mod.rs +++ b/cargo-dist/src/backend/ci/mod.rs @@ -1,6 +1,9 @@ //! Support for generating CI scripts for running dist -use cargo_dist_schema::{DashScript, GhaRunStep, PowershellScript, TargetTripleRef}; +use cargo_dist_schema::{ + target_lexicon::{OperatingSystem, Triple}, + DashScript, GhaRunStep, PowershellScript, +}; use semver::Version; use serde::Serialize; @@ -49,19 +52,12 @@ pub trait InstallStrategy { fn powershell(&self) -> GhaRunStep; /// Return the right install method for a given set of targets - fn for_targets<'a>(&self, targets: &'a [&'a TargetTripleRef]) -> GhaRunStep { - // FIXME: when doing cross-compilation, `host != runner`, and we should - // pick something that runs on the host. We need knowledge about "which - // platform is this GitHub runner" ahead of time to do that, though. - - for target in targets { - if target.is_linux() || target.is_apple() { - return self.dash(); - } else if target.is_windows() { - return self.powershell(); - } + fn for_triple(&self, triple: &Triple) -> GhaRunStep { + match triple.operating_system { + OperatingSystem::Linux | OperatingSystem::Darwin => self.dash(), + OperatingSystem::Windows => self.powershell(), + _ => panic!("unsupported host triple {triple}"), } - panic!("unsupported target triple(s) {targets:?}"); } } diff --git a/cargo-dist/src/backend/installer/homebrew.rs b/cargo-dist/src/backend/installer/homebrew.rs index 1d3b7e60..9e7172d3 100644 --- a/cargo-dist/src/backend/installer/homebrew.rs +++ b/cargo-dist/src/backend/installer/homebrew.rs @@ -1,7 +1,7 @@ //! Code for generating formula.rb use axoasset::LocalAsset; -use cargo_dist_schema::{ChecksumValue, DistManifest}; +use cargo_dist_schema::{ChecksumValue, DistManifest, HomebrewPackageName}; use serde::Serialize; use spdx::{ expression::{ExprNode, Operator}, @@ -35,7 +35,7 @@ pub struct HomebrewInstallerInfo { /// Generic installer info pub inner: InstallerInfo, /// Additional packages to specify as dependencies - pub dependencies: Vec, + pub dependencies: Vec, /// Whether to install packaged C dynamic libraries pub install_libraries: Vec, } diff --git a/cargo-dist/src/backend/installer/mod.rs b/cargo-dist/src/backend/installer/mod.rs index 01fb6a2e..e3a9299c 100644 --- a/cargo-dist/src/backend/installer/mod.rs +++ b/cargo-dist/src/backend/installer/mod.rs @@ -5,7 +5,7 @@ use std::collections::BTreeMap; use camino::Utf8PathBuf; -use cargo_dist_schema::{ArtifactId, EnvironmentVariables, Hosting, TargetTriple}; +use cargo_dist_schema::{ArtifactId, EnvironmentVariables, Hosting, TripleName}; use homebrew::HomebrewFragments; use macpkg::PkgInstallerInfo; use serde::Serialize; @@ -84,7 +84,7 @@ pub struct InstallerInfo { /// Install receipt to write, if any pub receipt: Option, /// Aliases to install binaries under - pub bin_aliases: BTreeMap>>, + pub bin_aliases: BTreeMap>>, /// Whether to install generated C dynamic libraries pub install_libraries: Vec, /// Platform-specific runtime conditions @@ -101,7 +101,7 @@ pub struct ExecutableZipFragment { /// The id of the artifact pub id: ArtifactId, /// The target the artifact supports - pub target_triple: TargetTriple, + pub target_triple: TripleName, /// The executables the artifact contains (name, assumed at root) pub executables: Vec, /// The dynamic libraries the artifact contains (name, assumed at root) diff --git a/cargo-dist/src/backend/installer/msi.rs b/cargo-dist/src/backend/installer/msi.rs index 67ae374e..d8172d9b 100644 --- a/cargo-dist/src/backend/installer/msi.rs +++ b/cargo-dist/src/backend/installer/msi.rs @@ -2,7 +2,7 @@ use axoasset::{toml_edit, LocalAsset}; use camino::{Utf8Path, Utf8PathBuf}; -use cargo_dist_schema::TargetTriple; +use cargo_dist_schema::TripleName; use tracing::info; use wix::print::{wxs::WxsRenders, RenderOutput}; @@ -18,7 +18,7 @@ pub struct MsiInstallerInfo { /// An ideally unambiguous way to refer to a package for the purpose of cargo -p flags. pub pkg_spec: String, /// Binaries we'll be baking into the msi - pub target: TargetTriple, + pub target: TripleName, /// Final file path of the msi pub file_path: Utf8PathBuf, /// Dir stuff goes to diff --git a/cargo-dist/src/backend/installer/npm.rs b/cargo-dist/src/backend/installer/npm.rs index 62f26bd6..2f019acf 100644 --- a/cargo-dist/src/backend/installer/npm.rs +++ b/cargo-dist/src/backend/installer/npm.rs @@ -2,7 +2,7 @@ use axoasset::{LocalAsset, SourceFile}; use camino::{Utf8Path, Utf8PathBuf}; -use cargo_dist_schema::{ArtifactId, GlibcVersion, TargetTriple}; +use cargo_dist_schema::{ArtifactId, GlibcVersion, TripleName}; use serde::Serialize; use super::InstallerInfo; @@ -42,7 +42,7 @@ const RUN_JS: &str = "run.js"; const PACKAGE_JSON: &str = "package.json"; const PACKAGE_LOCK: &str = "npm-shrinkwrap.json"; -type PackageJsonPlatforms = SortedMap; +type PackageJsonPlatforms = SortedMap; #[derive(Debug, Clone, Serialize)] #[serde(rename_all = "camelCase")] struct PackageJsonPlatform { diff --git a/cargo-dist/src/build/cargo.rs b/cargo-dist/src/build/cargo.rs index 679b8551..4f16eed1 100644 --- a/cargo-dist/src/build/cargo.rs +++ b/cargo-dist/src/build/cargo.rs @@ -4,14 +4,16 @@ use std::env; use axoprocess::Cmd; use axoproject::WorkspaceIdx; -use cargo_dist_schema::{DistManifest, TargetTriple}; +use cargo_dist_schema::target_lexicon::{Architecture, Environment, Triple}; +use cargo_dist_schema::{DistManifest, TripleName}; use miette::{Context, IntoDiagnostic}; use tracing::warn; use crate::build::BuildExpectations; use crate::env::{calculate_ldflags, fetch_brew_env, parse_env, select_brew_env}; use crate::{ - errors::*, BinaryIdx, BuildStep, DistGraphBuilder, AXOUPDATER_MINIMUM_VERSION, PROFILE_DIST, + build_wrapper_for_cross, errors::*, BinaryIdx, BuildStep, CargoBuildWrapper, DistGraphBuilder, + AXOUPDATER_MINIMUM_VERSION, PROFILE_DIST, }; use crate::{ CargoBuildStep, CargoTargetFeatureList, CargoTargetPackages, DistGraph, RustupStep, SortedMap, @@ -25,7 +27,7 @@ impl<'a> DistGraphBuilder<'a> { let cargo = self.inner.tools.cargo()?; // For now we can be really simplistic and just do a workspace build for every // target-triple we have a binary-that-needs-a-real-build for. - let mut targets = SortedMap::>::new(); + let mut targets = SortedMap::>::new(); let working_dir = self .workspaces .workspace(workspace_idx) @@ -66,7 +68,8 @@ impl<'a> DistGraphBuilder<'a> { } let mut builds = vec![]; - for (target, binaries) in targets { + for (target_triple, binaries) in targets { + let target = target_triple.parse().unwrap(); let mut rustflags = std::env::var("RUSTFLAGS").unwrap_or_default(); // FIXME: is there a more principled way for us to add things to RUSTFLAGS @@ -88,24 +91,27 @@ impl<'a> DistGraphBuilder<'a> { // on. Not doing that is basically rolling some dice and hoping the user already // has it installed, which isn't great. We should support redists eventually, // but for now this hacky global flag is here to let you roll dice. - if self.inner.config.builds.cargo.msvc_crt_static && target.is_windows_msvc() { + if self.inner.config.builds.cargo.msvc_crt_static + && target.environment == Environment::Msvc + { rustflags.push_str(" -Ctarget-feature=+crt-static"); } // Likewise, the default for musl will change in the future, so // we can future-proof this by adding the flag now // See: https://github.com/axodotdev/cargo-dist/issues/486 - if target.is_linux_musl() { + if target.environment == Environment::Musl { rustflags.push_str(" -Ctarget-feature=+crt-static -Clink-self-contained=yes"); } - // If we're trying to cross-compile, ensure the rustup toolchain - // is setup! - if target != cargo.host_target { + let host = cargo.host_target.parse().unwrap(); + + // If we're trying to cross-compile, ensure the rustup toolchain is set up! + if target != host { if let Some(rustup) = self.inner.tools.rustup.clone() { builds.push(BuildStep::Rustup(RustupStep { rustup, - target: target.clone(), + target: target_triple.clone(), })); } else { warn!("You're trying to cross-compile, but I can't find rustup to ensure you have the rust toolchains for it!") @@ -126,7 +132,7 @@ impl<'a> DistGraphBuilder<'a> { } for ((pkg_spec, features), expected_binaries) in builds_by_pkg_spec { builds.push(BuildStep::Cargo(CargoBuildStep { - target_triple: target.clone(), + target_triple: target_triple.clone(), package: CargoTargetPackages::Package(pkg_spec), features, rustflags: rustflags.clone(), @@ -142,7 +148,7 @@ impl<'a> DistGraphBuilder<'a> { .map(|&idx| self.binary(idx).features.clone()) .unwrap_or_default(); builds.push(BuildStep::Cargo(CargoBuildStep { - target_triple: target.clone(), + target_triple: target_triple.clone(), package: CargoTargetPackages::Workspace, features, rustflags, @@ -156,34 +162,68 @@ impl<'a> DistGraphBuilder<'a> { } } -// This function was split out of build_cargo_target() so it can have unit -// tests on its own. -fn make_build_cargo_target_command( - cargo_cmd: &String, - rustflags: &String, - target: &CargoBuildStep, +/// Generate a `cargo build` command +pub fn make_build_cargo_target_command( + host: &Triple, + cargo_cmd: &str, + rustflags: &str, + step: &CargoBuildStep, auditable: bool, -) -> Cmd { - let mut command = Cmd::new(cargo_cmd, "build your app with Cargo"); +) -> DistResult { + let target: Triple = step.target_triple.parse().unwrap(); + eprint!("building {target} target"); + let wrapper = build_wrapper_for_cross(host, &target)?; + if &target != host { + eprint!(", from {host} host"); + if let Some(wrapper) = wrapper.as_ref() { + eprint!(", via {wrapper}"); + } + } + eprint!(", using cargo profile {}", step.profile); + + let mut command = Cmd::new(cargo_cmd, "build your app with Cargo"); if auditable { command.arg("auditable"); + if wrapper.is_some() { + return Err(DistError::CannotDoCargoAuditableAndCrossCompile { + host: host.to_owned(), + target, + }); + } + } + match wrapper { + None => { + command.arg("build"); + } + Some(CargoBuildWrapper::ZigBuild) => { + command.arg("zigbuild"); + } + Some(CargoBuildWrapper::Xwin) => { + // cf. + let arch = match target.architecture { + Architecture::X86_32(_) => "x86", + Architecture::X86_64 => "x86_64", + Architecture::Aarch64(_) => "aarch64", + _ => panic!("cargo-xwin doesn't support {target} because of its architecture",), + }; + command.env("XWIN_ARCH", arch); + command.arg("xwin").arg("build"); + } } - command - .arg("build") .arg("--profile") - .arg(&target.profile) + .arg(&step.profile) .arg("--message-format=json-render-diagnostics") .arg("--target") - .arg(target.target_triple.as_str()) + .arg(step.target_triple.as_str()) .env("RUSTFLAGS", rustflags) - .current_dir(&target.working_dir) + .current_dir(&step.working_dir) .stdout(std::process::Stdio::piped()); - if !target.features.default_features { + if !step.features.default_features { command.arg("--no-default-features"); } - match &target.features.features { + match &step.features.features { CargoTargetFeatureList::All => { command.arg("--all-features"); } @@ -198,7 +238,7 @@ fn make_build_cargo_target_command( } } } - match &target.package { + match &step.package { CargoTargetPackages::Workspace => { command.arg("--workspace"); eprintln!(" --workspace)"); @@ -209,27 +249,22 @@ fn make_build_cargo_target_command( } } - command + Ok(command) } /// Build a cargo target pub fn build_cargo_target( dist_graph: &DistGraph, manifest: &mut DistManifest, - target: &CargoBuildStep, + step: &CargoBuildStep, ) -> DistResult<()> { let cargo = dist_graph.tools.cargo()?; - eprint!( - "building cargo target ({}/{}", - target.target_triple, target.profile - ); - - let mut rustflags = target.rustflags.clone(); + let mut rustflags = step.rustflags.clone(); let mut desired_extra_env = vec![]; let skip_brewfile = env::var("DO_NOT_USE_BREWFILE").is_ok(); if !skip_brewfile { - if let Some(env_output) = fetch_brew_env(dist_graph, &target.working_dir)? { + if let Some(env_output) = fetch_brew_env(dist_graph, &step.working_dir)? { let brew_env = parse_env(&env_output)?; desired_extra_env = select_brew_env(&brew_env); rustflags = determine_brew_rustflags(&rustflags, &brew_env); @@ -237,14 +272,16 @@ pub fn build_cargo_target( } let auditable = dist_graph.config.builds.cargo.cargo_auditable; - let mut command = make_build_cargo_target_command(&cargo.cmd, &rustflags, target, auditable); + let host = cargo_dist_schema::target_lexicon::HOST; + let mut command = + make_build_cargo_target_command(&host, &cargo.cmd, &rustflags, step, auditable)?; // If we generated any extra environment variables to // inject into the environment, apply them now. command.envs(desired_extra_env); let mut task = command.spawn()?; - let mut expected = BuildExpectations::new(dist_graph, &target.expected_binaries); + let mut expected = BuildExpectations::new(dist_graph, &step.expected_binaries); // Collect up the compiler messages to find out where binaries ended up let reader = std::io::BufReader::new(task.stdout.take().unwrap()); @@ -297,9 +334,11 @@ fn determine_brew_rustflags(base_rustflags: &str, environment: &SortedMap<&str, #[cfg(test)] mod tests { + use super::make_build_cargo_target_command; + use crate::platform::targets; use crate::tasks::{CargoTargetFeatureList, CargoTargetFeatures, CargoTargetPackages}; - use crate::{CargoBuildStep, TargetTriple}; + use crate::CargoBuildStep; #[test] fn build_command_not_auditable() { @@ -311,17 +350,24 @@ mod tests { default_features: true, features: CargoTargetFeatureList::default(), }; - let target = CargoBuildStep { - expected_binaries: vec![], + let step = CargoBuildStep { + target_triple: targets::TARGET_X64_LINUX_GNU.to_owned(), features, package: CargoTargetPackages::Workspace, profile: "release".to_string(), rustflags: "--this-rust-flag-gets-ignored".to_string(), - target_triple: TargetTriple::new("x86_64-unknown-linux-gnu".to_string()), + expected_binaries: vec![], working_dir: ".".to_string().into(), // this feels mildly cursed -duckinator. }; - let cmd = make_build_cargo_target_command(&cargo_cmd, &rustflags, &target, auditable); + let cmd = make_build_cargo_target_command( + &step.target_triple.parse().unwrap(), + &cargo_cmd, + &rustflags, + &step, + auditable, + ) + .unwrap(); let mut args = cmd.inner.get_args(); @@ -339,17 +385,24 @@ mod tests { default_features: true, features: CargoTargetFeatureList::default(), }; - let target = CargoBuildStep { - expected_binaries: vec![], + let step = CargoBuildStep { + target_triple: targets::TARGET_X64_LINUX_GNU.to_owned(), features, package: CargoTargetPackages::Workspace, profile: "release".to_string(), rustflags: "--this-rust-flag-gets-ignored".to_string(), - target_triple: TargetTriple::new("x86_64-unknown-linux-gnu".to_string()), + expected_binaries: vec![], working_dir: ".".to_string().into(), // this feels mildly cursed -duckinator. }; - let cmd = make_build_cargo_target_command(&cargo_cmd, &rustflags, &target, auditable); + let cmd = make_build_cargo_target_command( + &step.target_triple.parse().unwrap(), + &cargo_cmd, + &rustflags, + &step, + auditable, + ) + .unwrap(); let mut args = cmd.inner.get_args(); diff --git a/cargo-dist/src/build/generic.rs b/cargo-dist/src/build/generic.rs index 3f9a6c92..e4209dbf 100644 --- a/cargo-dist/src/build/generic.rs +++ b/cargo-dist/src/build/generic.rs @@ -5,7 +5,7 @@ use std::{env, process::ExitStatus}; use axoprocess::Cmd; use axoproject::WorkspaceIdx; use camino::{Utf8Path, Utf8PathBuf}; -use cargo_dist_schema::{DistManifest, TargetTriple, TargetTripleRef}; +use cargo_dist_schema::{DistManifest, TripleName, TripleNameRef}; use crate::{ build::{package_id_string, BuildExpectations}, @@ -19,7 +19,7 @@ impl<'a> DistGraphBuilder<'a> { pub(crate) fn compute_generic_builds(&mut self, workspace_idx: WorkspaceIdx) -> Vec { // For now we can be really simplistic and just do a workspace build for every // target-triple we have a binary-that-needs-a-real-build for. - let mut targets = SortedMap::>::new(); + let mut targets = SortedMap::>::new(); for (binary_idx, binary) in self.inner.binaries.iter().enumerate() { // Only bother with binaries owned by this workspace if self.workspaces.workspace_for_package(binary.pkg_idx) != workspace_idx { @@ -95,7 +95,7 @@ impl<'a> DistGraphBuilder<'a> { } } -fn platform_appropriate_cc(target: &TargetTripleRef) -> &str { +fn platform_appropriate_cc(target: &TripleNameRef) -> &str { if target.is_darwin() { "clang" } else if target.is_linux() { @@ -107,7 +107,7 @@ fn platform_appropriate_cc(target: &TargetTripleRef) -> &str { } } -fn platform_appropriate_cxx(target: &TargetTripleRef) -> &str { +fn platform_appropriate_cxx(target: &TripleNameRef) -> &str { if target.is_darwin() { "clang++" } else if target.is_linux() { @@ -123,7 +123,7 @@ fn run_build( dist_graph: &DistGraph, build_command: &[String], working_dir: &Utf8Path, - target: Option<&TargetTriple>, + target: Option<&TripleName>, ) -> DistResult { let mut command_string = build_command.to_owned(); diff --git a/cargo-dist/src/build/mod.rs b/cargo-dist/src/build/mod.rs index a5f3a154..388e49e5 100644 --- a/cargo-dist/src/build/mod.rs +++ b/cargo-dist/src/build/mod.rs @@ -2,7 +2,7 @@ use axoproject::PackageId; use camino::Utf8PathBuf; -use cargo_dist_schema::{AssetInfo, DistManifest, TargetTripleRef}; +use cargo_dist_schema::{AssetInfo, DistManifest, TripleNameRef}; use tracing::info; use crate::{ @@ -195,7 +195,7 @@ impl BuildExpectations { dist: &DistGraph, manifest: &mut DistManifest, src: &ExpectedBinary, - target: &TargetTripleRef, + target: &TripleNameRef, ) -> DistResult<()> { let src_path = src .src_path diff --git a/cargo-dist/src/cli.rs b/cargo-dist/src/cli.rs index 73c7e109..c9995698 100644 --- a/cargo-dist/src/cli.rs +++ b/cargo-dist/src/cli.rs @@ -2,7 +2,7 @@ use camino::Utf8PathBuf; use cargo_dist::announce::{TagMode, TagSettings}; -use cargo_dist_schema::TargetTriple; +use cargo_dist_schema::TripleName; use clap::{ builder::{PossibleValuesParser, TypedValueParser}, Args, Parser, Subcommand, ValueEnum, @@ -49,7 +49,7 @@ pub struct Cli { /// except for `dist init` which will select some "good defaults" for you. #[clap(long, short, value_delimiter(','))] #[clap(help_heading = "GLOBAL OPTIONS", global = true)] - pub target: Vec, + pub target: Vec, /// Installers we want to build /// @@ -111,6 +111,12 @@ pub enum Commands { /// Build artifacts #[clap(disable_version_flag = true)] Build(BuildArgs), + + /// Print the upload files from a manifest (useful in GitHub Actions to avoid relying on jq) + #[clap(disable_version_flag = true)] + #[clap(hide = true)] + PrintUploadFilesFromManifest(PrintUploadFilesFromManifestArgs), + /// Setup or update dist /// /// This will interactively guide you through the process of selecting configuration options @@ -438,6 +444,13 @@ pub struct ManifestSchemaArgs { pub output: Option, } +#[derive(Args, Clone, Debug)] +pub struct PrintUploadFilesFromManifestArgs { + /// The manifest to print upload files from + #[clap(long)] + pub manifest: String, +} + #[derive(Args, Clone, Debug)] pub struct HostArgs { /// The hosting steps to perform diff --git a/cargo-dist/src/config/mod.rs b/cargo-dist/src/config/mod.rs index 6a9df5e8..829a518e 100644 --- a/cargo-dist/src/config/mod.rs +++ b/cargo-dist/src/config/mod.rs @@ -5,7 +5,10 @@ use std::collections::BTreeMap; use axoasset::{toml_edit, SourceFile}; use axoproject::local_repo::LocalRepo; use camino::{Utf8Path, Utf8PathBuf}; -use cargo_dist_schema::{ChecksumExtensionRef, TargetTriple, TargetTripleRef}; +use cargo_dist_schema::{ + AptPackageName, ChecksumExtensionRef, ChocolateyPackageName, HomebrewPackageName, + PackageVersion, TripleName, TripleNameRef, +}; use serde::{Deserialize, Serialize}; use crate::announce::TagSettings; @@ -54,7 +57,7 @@ pub struct Config { /// If true, override allow-dirty in the config and ignore all dirtiness pub allow_all_dirty: bool, /// Target triples we want to build for - pub targets: Vec, + pub targets: Vec, /// CI kinds we want to support pub ci: Vec, /// Installers we want to generate @@ -748,16 +751,17 @@ pub struct SystemDependencies { /// Packages to install in Homebrew #[serde(default)] #[serde(skip_serializing_if = "BTreeMap::is_empty")] - // #[serde(with = "sysdep_derive")] - pub homebrew: BTreeMap, + pub homebrew: BTreeMap, + /// Packages to install in apt #[serde(default)] #[serde(skip_serializing_if = "BTreeMap::is_empty")] - pub apt: BTreeMap, + pub apt: BTreeMap, + /// Package to install in Chocolatey #[serde(default)] #[serde(skip_serializing_if = "BTreeMap::is_empty")] - pub chocolatey: BTreeMap, + pub chocolatey: BTreeMap, } impl SystemDependencies { @@ -778,18 +782,18 @@ pub struct SystemDependency(pub SystemDependencyComplex); #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize)] pub struct SystemDependencyComplex { /// The version to install, as expected by the underlying package manager - pub version: Option, + pub version: Option, /// Stages at which the dependency is required #[serde(default)] pub stage: Vec, /// One or more targets this package should be installed on; defaults to all targets if not specified #[serde(default)] - pub targets: Vec, + pub targets: Vec, } impl SystemDependencyComplex { /// Checks if this dependency should be installed on the specified target. - pub fn wanted_for_target(&self, target: &TargetTripleRef) -> bool { + pub fn wanted_for_target(&self, target: &TripleNameRef) -> bool { if self.targets.is_empty() { true } else { @@ -851,7 +855,7 @@ impl<'de> Deserialize<'de> for SystemDependency { SystemDependencyKind::Untagged(version) => { let v = if version == "*" { None } else { Some(version) }; SystemDependencyComplex { - version: v, + version: v.map(PackageVersion::new), stage: vec![], targets: vec![], } diff --git a/cargo-dist/src/config/v0.rs b/cargo-dist/src/config/v0.rs index d0bb2143..88553b7c 100644 --- a/cargo-dist/src/config/v0.rs +++ b/cargo-dist/src/config/v0.rs @@ -1,7 +1,9 @@ //! v0 config use camino::{Utf8Path, Utf8PathBuf}; -use cargo_dist_schema::{declare_strongly_typed_string, GithubRunner}; +use cargo_dist_schema::{ + declare_strongly_typed_string, GithubRunner, GithubRunnerConfigInput, StringLikeOr, +}; use semver::Version; use serde::{Deserialize, Serialize}; use tracing::log::warn; @@ -130,7 +132,7 @@ pub struct DistMetadata { /// /// FIXME: Allow higher level requests like "[macos, windows, linux] x [x86_64, aarch64]"? #[serde(skip_serializing_if = "Option::is_none")] - pub targets: Option>, + pub targets: Option>, /// Include the following static files in bundles like archives. /// @@ -404,7 +406,8 @@ pub struct DistMetadata { /// Custom GitHub runners, mapped by triple target #[serde(skip_serializing_if = "Option::is_none")] - pub github_custom_runners: Option>, + pub github_custom_runners: + Option>>, /// Custom permissions for jobs #[serde(skip_serializing_if = "Option::is_none")] diff --git a/cargo-dist/src/config/v1/ci/github.rs b/cargo-dist/src/config/v1/ci/github.rs index 6d6b156a..1113b6af 100644 --- a/cargo-dist/src/config/v1/ci/github.rs +++ b/cargo-dist/src/config/v1/ci/github.rs @@ -1,6 +1,11 @@ //! github ci config -use cargo_dist_schema::{GithubRunner, TargetTriple}; +use cargo_dist_schema::{ + ContainerConfig, GithubRunner, GithubRunnerConfig, GithubRunnerConfigInput, StringLikeOr, + TripleName, +}; + +use crate::platform::{github_runners::target_for_github_runner, targets}; use super::*; @@ -14,7 +19,7 @@ pub struct GithubCiLayer { /// Custom GitHub runners, mapped by triple target #[serde(skip_serializing_if = "Option::is_none")] - pub runners: Option>, + pub runners: Option>>, /// Custom permissions for jobs #[serde(skip_serializing_if = "Option::is_none")] @@ -24,15 +29,19 @@ pub struct GithubCiLayer { #[serde(skip_serializing_if = "Option::is_none")] pub build_setup: Option, } + /// github ci config (final) #[derive(Debug, Default, Clone)] pub struct GithubCiConfig { /// Common options pub common: CommonCiConfig, + /// Custom GitHub runners, mapped by triple target - pub runners: SortedMap, + pub runners: SortedMap, + /// Custom permissions for jobs pub permissions: SortedMap, + /// Custom permissions for jobs pub build_setup: Option, } @@ -61,7 +70,66 @@ impl ApplyLayer for GithubCiConfig { }: Self::Layer, ) { self.common.apply_layer(common); - self.runners.apply_val(runners); + + let mk_default_github_runner = || GithubRunner::new("ubuntu-20.04".to_owned()); + self.runners.apply_val(runners.map(|runners| { + runners + .into_iter() + .map(|(target_triple, runner)| { + ( + target_triple.clone(), + match runner { + StringLikeOr::StringLike(runner) => { + let host = target_for_github_runner(&runner) + .map(|t| t.to_owned()) + .unwrap_or_else(|| target_triple.clone()); + GithubRunnerConfig { + host, + runner, + container: None, + } + } + StringLikeOr::Val(runner_config) => { + let runner = runner_config + .runner + .unwrap_or_else(mk_default_github_runner); + let host = runner_config + .host + .or_else(|| { + target_for_github_runner(&runner).map(|t| t.to_owned()) + }) + .unwrap_or_else(|| { + // if not specified, then assume the custom github runner is + // the right platform (host == target) + target_triple.clone() + }); + let container = + runner_config.container.map(|container| match container { + StringLikeOr::StringLike(image_name) => { + ContainerConfig { + image: image_name, + // assume x86_64-unknown-linux-musl if not specified + host: targets::TARGET_X64_LINUX_MUSL.to_owned(), + } + } + StringLikeOr::Val(container_config) => ContainerConfig { + image: container_config.image, + host: container_config.host.unwrap_or_else(|| { + targets::TARGET_X64_LINUX_MUSL.to_owned() + }), + }, + }); + GithubRunnerConfig { + runner, + host, + container, + } + } + }, + ) + }) + .collect() + })); self.permissions.apply_val(permissions); self.build_setup.apply_opt(build_setup); } diff --git a/cargo-dist/src/config/v1/mod.rs b/cargo-dist/src/config/v1/mod.rs index 9c5a8b96..bd10f112 100644 --- a/cargo-dist/src/config/v1/mod.rs +++ b/cargo-dist/src/config/v1/mod.rs @@ -283,7 +283,7 @@ pub struct AppConfig { /// Whether the package should be distributed/built by dist pub dist: Option, /// The full set of target triples to build for. - pub targets: Vec, + pub targets: Vec, } /// Config scoped to a particular App /// @@ -303,7 +303,7 @@ pub struct AppConfigInheritable { /// Whether the package should be distributed/built by dist pub dist: Option, /// The full set of target triples to build for. - pub targets: Vec, + pub targets: Vec, } impl AppConfigInheritable { /// Get the defaults for the given package @@ -419,7 +419,7 @@ pub struct TomlLayer { /// /// FIXME: Allow higher level requests like "[macos, windows, linux] x [x86_64, aarch64]"? #[serde(skip_serializing_if = "Option::is_none")] - pub targets: Option>, + pub targets: Option>, /// artifact config #[serde(skip_serializing_if = "Option::is_none")] diff --git a/cargo-dist/src/errors.rs b/cargo-dist/src/errors.rs index ffdc7e61..182eb6c9 100644 --- a/cargo-dist/src/errors.rs +++ b/cargo-dist/src/errors.rs @@ -9,7 +9,7 @@ use axoproject::errors::AxoprojectError; use backtrace::Backtrace; use camino::Utf8PathBuf; -use cargo_dist_schema::{ArtifactId, TargetTriple}; +use cargo_dist_schema::{target_lexicon::Triple, ArtifactId, TripleName}; use color_backtrace::BacktracePrinter; use console::style; use miette::{Diagnostic, SourceOffset, SourceSpan}; @@ -322,9 +322,9 @@ pub enum DistError { #[error("unable to run linkage report for {target} on {host}")] LinkageCheckInvalidOS { /// The OS the check was run on - host: TargetTriple, + host: String, /// The OS being checked - target: TargetTriple, + target: TripleName, }, /// Linkage report can't be run for this target @@ -410,7 +410,7 @@ pub enum DistError { #[diagnostic(help("try adding --target={host_target}"))] CliMissingTargets { /// Current host target - host_target: TargetTriple, + host_target: TripleName, }, /// Workspace isn't init @@ -452,7 +452,7 @@ pub enum DistError { #[diagnostic(help("The full list of supported targets can be found here: https://opensource.axo.dev/cargo-dist/book/reference/config.html#targets"))] UnrecognizedTarget { /// The target in question - target: TargetTriple, + target: TripleName, }, /// Installers requested despite having nothing to install @@ -522,6 +522,30 @@ pub enum DistError { manifest: Utf8PathBuf, }, + /// Unsupported cross-compilation host/target combination + #[error("Cross-compilation from {host} to {target} is not supported")] + #[diagnostic(help("{details}"))] + UnsupportedCrossCompile { + /// The host system + host: Triple, + /// The target system + target: Triple, + /// Additional details about why this combination is unsupported + details: String, + }, + + /// Cannot use cross-compilation with cargo-auditable + #[error( + "Cross-compilation builds from {host} to {target} cannot be used with cargo-auditable" + )] + #[diagnostic(help("set cargo-auditable to false or don't do cross-compilation"))] + CannotDoCargoAuditableAndCrossCompile { + /// The host system + host: Triple, + /// The target system + target: Triple, + }, + /// missing "build-command" for a package that needs one #[error("dist package was missing a build-command\n{manifest}")] #[diagnostic(help( diff --git a/cargo-dist/src/init.rs b/cargo-dist/src/init.rs index 59564542..a72aa440 100644 --- a/cargo-dist/src/init.rs +++ b/cargo-dist/src/init.rs @@ -1,7 +1,7 @@ use axoasset::toml_edit; use axoproject::{WorkspaceGraph, WorkspaceInfo, WorkspaceKind}; use camino::Utf8PathBuf; -use cargo_dist_schema::TargetTripleRef; +use cargo_dist_schema::TripleNameRef; use semver::Version; use serde::Deserialize; @@ -491,7 +491,7 @@ fn get_new_dist_metadata( } // Prettify/sort things - let desc = move |triple: &TargetTripleRef| -> String { + let desc = move |triple: &TripleNameRef| -> String { let pretty = triple_to_display_name(triple).unwrap_or("[unknown]"); format!("{pretty} ({triple})") }; diff --git a/cargo-dist/src/lib.rs b/cargo-dist/src/lib.rs index c50e58e3..d9a05f05 100644 --- a/cargo-dist/src/lib.rs +++ b/cargo-dist/src/lib.rs @@ -27,7 +27,7 @@ use build::{ fake::{build_fake_cargo_target, build_fake_generic_target}, }; use camino::{Utf8Path, Utf8PathBuf}; -use cargo_dist_schema::{ArtifactId, ChecksumValue, ChecksumValueRef, DistManifest, TargetTriple}; +use cargo_dist_schema::{ArtifactId, ChecksumValue, ChecksumValueRef, DistManifest, TripleName}; use config::{ ArtifactMode, ChecksumStyle, CompressionImpl, Config, DirtyMode, GenerateMode, ZipStyle, }; @@ -799,7 +799,7 @@ fn generate_installer( } /// Get the default list of targets -pub fn default_desktop_targets() -> Vec { +pub fn default_desktop_targets() -> Vec { use crate::platform::targets as t; vec![ @@ -807,16 +807,15 @@ pub fn default_desktop_targets() -> Vec { t::TARGET_X64_LINUX_GNU.to_owned(), t::TARGET_X64_WINDOWS.to_owned(), t::TARGET_X64_MAC.to_owned(), - // Apple is really easy to cross from Apple t::TARGET_ARM64_MAC.to_owned(), - // other cross-compiles not yet supported - // targets::TARGET_ARM64_LINUX_GNU.to_owned(), - // targets::TARGET_ARM64_WINDOWS.to_owned(), + t::TARGET_ARM64_LINUX_GNU.to_owned(), + // that one requires a bit of config (use the `messense/cargo-xwin` image) + // t::TARGET_ARM64_WINDOWS.to_owned(), ] } /// Get the list of all known targets -pub fn known_desktop_targets() -> Vec { +pub fn known_desktop_targets() -> Vec { use crate::platform::targets as t; vec![ @@ -825,10 +824,8 @@ pub fn known_desktop_targets() -> Vec { t::TARGET_X64_LINUX_MUSL.to_owned(), t::TARGET_X64_WINDOWS.to_owned(), t::TARGET_X64_MAC.to_owned(), - // Apple is really easy to cross from Apple t::TARGET_ARM64_MAC.to_owned(), - // other cross-compiles not yet supported - // t::TARGET_ARM64_LINUX_GNU.to_owned(), - // t::TARGET_ARM64_WINDOWS.to_owned(), + t::TARGET_ARM64_LINUX_GNU.to_owned(), + t::TARGET_ARM64_WINDOWS.to_owned(), ] } diff --git a/cargo-dist/src/linkage.rs b/cargo-dist/src/linkage.rs index 9ac357a0..23d8214b 100644 --- a/cargo-dist/src/linkage.rs +++ b/cargo-dist/src/linkage.rs @@ -10,16 +10,14 @@ use axoprocess::Cmd; use camino::Utf8PathBuf; use cargo_dist_schema::{ AssetInfo, BuildEnvironment, DistManifest, GlibcVersion, Library, Linkage, PackageManager, - TargetTripleRef, + TripleNameRef, }; use comfy_table::{presets::UTF8_FULL, Table}; use goblin::Object; use mach_object::{LoadCommand, OFile}; use tracing::warn; -use crate::{ - config::Config, errors::*, gather_work, platform::targets::TARGET_HOST, Artifact, DistGraph, -}; +use crate::{config::Config, errors::*, gather_work, Artifact, DistGraph}; /// Arguments for `dist linkage` ([`do_linkage][]) #[derive(Debug)] @@ -383,7 +381,7 @@ fn do_pe(path: &Utf8PathBuf) -> DistResult> { /// Get the linkage for a single binary /// /// If linkage fails for any reason we warn and return the default empty linkage -pub fn determine_linkage(path: &Utf8PathBuf, target: &TargetTripleRef) -> Linkage { +pub fn determine_linkage(path: &Utf8PathBuf, target: &TripleNameRef) -> Linkage { match try_determine_linkage(path, target) { Ok(linkage) => linkage, Err(e) => { @@ -394,14 +392,14 @@ pub fn determine_linkage(path: &Utf8PathBuf, target: &TargetTripleRef) -> Linkag } /// Get the linkage for a single binary -fn try_determine_linkage(path: &Utf8PathBuf, target: &TargetTripleRef) -> DistResult { +fn try_determine_linkage(path: &Utf8PathBuf, target: &TripleNameRef) -> DistResult { let libraries = if target.is_darwin() { do_otool(path)? } else if target.is_linux() { // Currently can only be run on Linux - if !TARGET_HOST.is_linux() { + if std::env::consts::OS != "linux" { return Err(DistError::LinkageCheckInvalidOS { - host: TARGET_HOST.to_owned(), + host: std::env::consts::OS.to_owned(), target: target.to_owned(), }); } @@ -450,7 +448,7 @@ fn try_determine_linkage(path: &Utf8PathBuf, target: &TargetTripleRef) -> DistRe /// Determine the build environment on the current host /// This should be done local to the builder! -pub fn determine_build_environment(target: &TargetTripleRef) -> BuildEnvironment { +pub fn determine_build_environment(target: &TripleNameRef) -> BuildEnvironment { if target.is_darwin() { determine_macos_build_environment().unwrap_or(BuildEnvironment::Indeterminate) } else if target.is_linux() { diff --git a/cargo-dist/src/main.rs b/cargo-dist/src/main.rs index c93d24cd..2f317931 100644 --- a/cargo-dist/src/main.rs +++ b/cargo-dist/src/main.rs @@ -14,6 +14,7 @@ use cargo_dist_schema::{AssetKind, DistManifest}; use clap::Parser; use cli::{ Cli, Commands, GenerateMode, HelpMarkdownArgs, HostArgs, ManifestArgs, OutputFormat, PlanArgs, + PrintUploadFilesFromManifestArgs, }; use console::Term; use miette::{miette, IntoDiagnostic}; @@ -56,6 +57,9 @@ fn real_main(cli: &axocli::CliApp) -> Result<(), miette::Report> { Commands::HelpMarkdown(args) => cmd_help_md(config, args), Commands::ManifestSchema(args) => cmd_manifest_schema(config, args), Commands::Build(args) => cmd_build(config, args), + Commands::PrintUploadFilesFromManifest(args) => { + cmd_print_upload_files_from_manifest(config, args) + } Commands::Host(args) => cmd_host(config, args), Commands::Selfupdate(args) => runtime.block_on(cmd_update(config, args)), } @@ -232,6 +236,24 @@ fn cmd_build(cli: &Cli, args: &BuildArgs) -> Result<(), miette::Report> { ) } +fn cmd_print_upload_files_from_manifest( + _cli: &Cli, + args: &PrintUploadFilesFromManifestArgs, +) -> Result<(), miette::Report> { + let manifest_str = axoasset::LocalAsset::load_string(&args.manifest)?; + let manifest = serde_json::from_str::(&manifest_str) + .into_diagnostic() + .map_err(|err| miette!("Failed to parse manifest as JSON: {}", err))?; + + let mut out = Term::stdout(); + for artifact in manifest.artifacts.values() { + if let Some(path) = &artifact.path { + writeln!(out, "{}", path).into_diagnostic()?; + } + } + Ok(()) +} + fn cmd_host(cli: &Cli, args: &HostArgs) -> Result<(), miette::Report> { let args = cargo_dist::config::HostArgs { steps: args.steps.iter().map(|m| m.to_lib()).collect(), diff --git a/cargo-dist/src/platform.rs b/cargo-dist/src/platform.rs index dff3181f..65da43ea 100644 --- a/cargo-dist/src/platform.rs +++ b/cargo-dist/src/platform.rs @@ -227,13 +227,14 @@ #![allow(rustdoc::private_intra_doc_links)] +pub mod github_runners; pub mod targets; use std::collections::HashMap; use cargo_dist_schema::{ ArtifactId, AssetId, BuildEnvironment, ChecksumExtension, ChecksumValue, DistManifest, - GlibcVersion, Linkage, SystemInfo, TargetTriple, TargetTripleRef, + GlibcVersion, Linkage, SystemInfo, TripleName, TripleNameRef, }; use serde::Serialize; @@ -391,7 +392,7 @@ pub struct PlatformSupport { /// /// The list of PlatformEntries is pre-sorted in descending quality, so the first /// is the best and should be used if possible (but maybe there's troublesome RuntimeConditions). - pub platforms: SortedMap>, + pub platforms: SortedMap>, } /// An archive of the prebuilt binaries for an app that can be fetched @@ -404,9 +405,9 @@ pub struct FetchableArchive { /// (You can largely ignore these in favour of the runtime_conditions in PlatformEntry) pub native_runtime_conditions: RuntimeConditions, /// "The" target triple to use - pub target_triple: TargetTriple, + pub target_triple: TripleName, /// What target triples does this archive natively support - pub target_triples: Vec, + pub target_triples: Vec, /// The checksum of the archive, if any pub checksum: Option, /// The executables in the archive (may include .exe, assumed to be in root) @@ -464,7 +465,7 @@ pub struct PlatformEntry { impl PlatformSupport { /// Compute the PlatformSupport for a Release pub(crate) fn new(dist: &DistGraphBuilder, release_idx: ReleaseIdx) -> PlatformSupport { - let mut platforms = SortedMap::>::new(); + let mut platforms = SortedMap::>::new(); let release = dist.release(release_idx); let mut archives = vec![]; let mut updaters = vec![]; @@ -505,7 +506,7 @@ impl PlatformSupport { let archive = FetchableArchive { id: artifact.id, // computed later - target_triple: TargetTriple::new("".to_owned()), + target_triple: TripleName::new("".to_owned()), target_triples: artifact.target_triples, executables: executables .map(|(_, dest_path)| dest_path.file_name().unwrap().to_owned()) @@ -648,8 +649,8 @@ impl PlatformSupport { fn supports( archive_idx: FetchableArchiveIdx, archive: &FetchableArchive, -) -> Vec<(TargetTriple, PlatformEntry)> { - let mut res: Vec<(TargetTriple, PlatformEntry)> = Vec::new(); +) -> Vec<(TripleName, PlatformEntry)> { + let mut res: Vec<(TripleName, PlatformEntry)> = Vec::new(); for target in &archive.target_triples { // this whole function manipulates targets as a string slice, which // is unfortunate — these manipulations would be better done on a @@ -677,7 +678,7 @@ fn supports( // First, add the target itself as a HostNative entry res.push(( - TargetTriple::new(target.clone()), + TripleName::new(target.clone()), PlatformEntry { quality: SupportQuality::HostNative, runtime_conditions: archive.native_runtime_conditions.clone(), @@ -692,7 +693,7 @@ fn supports( }; for &libc in LINUX_STATIC_REPLACEABLE_LIBCS { res.push(( - TargetTriple::new(format!("{system}{libc}{abigunk}")), + TripleName::new(format!("{system}{libc}{abigunk}")), PlatformEntry { quality: SupportQuality::ImperfectNative, runtime_conditions: archive.native_runtime_conditions.clone(), @@ -724,7 +725,7 @@ fn supports( )); } - let target = TargetTriple::new(target); + let target = TripleName::new(target); // FIXME?: technically we could add "run 32-bit intel macos on 64-bit intel" // BUT this is unlikely to succeed as you increasingly need an EOL macOS, @@ -790,7 +791,7 @@ fn supports( // for now all 5 arm64 mingw users can be a little sad. if let Some(system) = target.as_str().strip_suffix("windows-msvc") { res.push(( - TargetTriple::new(format!("{system}windows-gnu")), + TripleName::new(format!("{system}windows-gnu")), PlatformEntry { quality: SupportQuality::ImperfectNative, runtime_conditions: archive.native_runtime_conditions.clone(), @@ -933,7 +934,7 @@ fn native_musl_version(_system: &SystemInfo, _linkage: &Linkage) -> Option Option<&'static str> { +pub fn triple_to_display_name(name: &TripleNameRef) -> Option<&'static str> { if name.as_str() == "all" { Some("All Platforms") } else { @@ -942,7 +943,7 @@ pub fn triple_to_display_name(name: &TargetTripleRef) -> Option<&'static str> { } lazy_static::lazy_static! { - static ref TARGET_TRIPLE_DISPLAY_NAMES: HashMap<&'static TargetTripleRef, &'static str> = + static ref TARGET_TRIPLE_DISPLAY_NAMES: HashMap<&'static TripleNameRef, &'static str> = { use targets::*; diff --git a/cargo-dist/src/platform/github_runners.rs b/cargo-dist/src/platform/github_runners.rs new file mode 100644 index 00000000..061c9bfd --- /dev/null +++ b/cargo-dist/src/platform/github_runners.rs @@ -0,0 +1,102 @@ +//! Statically-known information about various GitHub Actions runner names + +use std::collections::HashMap; + +use crate::platform::targets as t; +use cargo_dist_schema::{target_lexicon::Triple, GithubRunnerRef, TripleNameRef}; +use tracing::warn; + +lazy_static::lazy_static! { + static ref KNOWN_GITHUB_RUNNERS: HashMap<&'static GithubRunnerRef, &'static TripleNameRef> = { + let mut m = HashMap::new(); + // cf. https://github.com/actions/runner-images/blob/main/README.md + // last updated 2024-10-25 + + //-------- linux + m.insert(GithubRunnerRef::from_str("ubuntu-20.04"), t::TARGET_X64_LINUX_GNU); + m.insert(GithubRunnerRef::from_str("ubuntu-22.04"), t::TARGET_X64_LINUX_GNU); + m.insert(GithubRunnerRef::from_str("ubuntu-24.04"), t::TARGET_X64_LINUX_GNU); + m.insert(GithubRunnerRef::from_str("ubuntu-latest"), t::TARGET_X64_LINUX_GNU); + + //-------- windows + m.insert(GithubRunnerRef::from_str("windows-2019"), t::TARGET_X64_WINDOWS); + m.insert(GithubRunnerRef::from_str("windows-2022"), t::TARGET_X64_WINDOWS); + m.insert(GithubRunnerRef::from_str("windows-latest"), t::TARGET_X64_WINDOWS); + + //-------- macos x64 + m.insert(GithubRunnerRef::from_str("macos-12"), t::TARGET_X64_MAC); // deprecated + m.insert(GithubRunnerRef::from_str("macos-12-large"), t::TARGET_X64_MAC); + m.insert(GithubRunnerRef::from_str("macos-13"), t::TARGET_X64_MAC); + m.insert(GithubRunnerRef::from_str("macos-13-large"), t::TARGET_X64_MAC); + m.insert(GithubRunnerRef::from_str("macos-14-large"), t::TARGET_X64_MAC); + m.insert(GithubRunnerRef::from_str("macos-15-large"), t::TARGET_X64_MAC); + m.insert(GithubRunnerRef::from_str("macos-latest-large"), t::TARGET_X64_MAC); + + //-------- macos arm64 + m.insert(GithubRunnerRef::from_str("macos-13-xlarge"), t::TARGET_ARM64_MAC); + m.insert(GithubRunnerRef::from_str("macos-14"), t::TARGET_ARM64_MAC); + m.insert(GithubRunnerRef::from_str("macos-14-xlarge"), t::TARGET_ARM64_MAC); + m.insert(GithubRunnerRef::from_str("macos-15"), t::TARGET_ARM64_MAC); + m.insert(GithubRunnerRef::from_str("macos-15-xlarge"), t::TARGET_ARM64_MAC); + m.insert(GithubRunnerRef::from_str("macos-latest"), t::TARGET_ARM64_MAC); + m.insert(GithubRunnerRef::from_str("macos-latest-xlarge"), t::TARGET_ARM64_MAC); + + m + }; +} + +/// Get the target triple for a given GitHub Actions runner (if we know about it) +pub fn target_for_github_runner(runner: &GithubRunnerRef) -> Option<&'static TripleNameRef> { + if let Some(target) = KNOWN_GITHUB_RUNNERS.get(runner).copied() { + return Some(target); + } + + let runner_str = runner.as_str(); + if let Some(rest) = runner_str.strip_prefix("buildjet-") { + if rest.contains("ubuntu") { + if rest.ends_with("-arm") { + return Some(t::TARGET_ARM64_LINUX_GNU); + } else { + return Some(t::TARGET_X64_LINUX_GNU); + } + } + } + + None +} + +/// Get the target triple for a given GitHub Actions runner (if we know about it), or assume x64-linux-gnu +pub fn target_for_github_runner_or_default(runner: &GithubRunnerRef) -> &'static TripleNameRef { + const DEFAULT_ASSUMED_TARGET: &TripleNameRef = t::TARGET_X64_LINUX_GNU; + + target_for_github_runner(runner).unwrap_or_else(|| { + warn!( + "don't know the triple for github runner '{runner}', assuming {DEFAULT_ASSUMED_TARGET}" + ); + DEFAULT_ASSUMED_TARGET + }) +} + +/// Gets the parsed [`Triple`] for a given GitHub runner. +pub fn triple_for_github_runner_or_default(runner: &GithubRunnerRef) -> Triple { + // unwrap safety: all the triples in `KNOWN_GITHUB_RUNNERS` should parse + // cleanly. + target_for_github_runner_or_default(runner).parse().unwrap() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_target_for_github_runner() { + assert_eq!( + target_for_github_runner(GithubRunnerRef::from_str("ubuntu-20.04")), + Some(t::TARGET_X64_LINUX_GNU) + ); + assert_eq!( + target_for_github_runner(GithubRunnerRef::from_str("buildjet-8vcpu-ubuntu-2204-arm")), + Some(t::TARGET_ARM64_LINUX_GNU) + ); + } +} diff --git a/cargo-dist/src/platform/targets.rs b/cargo-dist/src/platform/targets.rs index 87a2afe0..1b9008a5 100644 --- a/cargo-dist/src/platform/targets.rs +++ b/cargo-dist/src/platform/targets.rs @@ -2,13 +2,13 @@ // Various target triples -use cargo_dist_schema::TargetTripleRef; +use cargo_dist_schema::TripleNameRef; macro_rules! define_target_triples { ($($(#[$meta:meta])* const $name:ident = $triple:expr;)*) => { $( $(#[$meta])* - pub const $name: &TargetTripleRef = TargetTripleRef::from_str($triple); + pub const $name: &TripleNameRef = TripleNameRef::from_str($triple); )* }; } @@ -29,7 +29,7 @@ define_target_triples!( ); /// List of all recognized Windows targets -pub const KNOWN_WINDOWS_TARGETS: &[&TargetTripleRef] = &[ +pub const KNOWN_WINDOWS_TARGETS: &[&TripleNameRef] = &[ TARGET_X86_WINDOWS, TARGET_X64_WINDOWS, TARGET_ARM64_WINDOWS, @@ -48,7 +48,7 @@ define_target_triples!( ); /// List of all recognized Mac targets -pub const KNOWN_MAC_TARGETS: &[&TargetTripleRef] = +pub const KNOWN_MAC_TARGETS: &[&TripleNameRef] = &[TARGET_X86_MAC, TARGET_X64_MAC, TARGET_ARM64_MAC]; define_target_triples!( @@ -81,7 +81,7 @@ define_target_triples!( ); /// List of all recognized Linux glibc targets -pub const KNOWN_LINUX_GNU_TARGETS: &[&TargetTripleRef] = &[ +pub const KNOWN_LINUX_GNU_TARGETS: &[&TripleNameRef] = &[ TARGET_X86_LINUX_GNU, TARGET_X64_LINUX_GNU, TARGET_ARM64_LINUX_GNU, @@ -126,7 +126,7 @@ define_target_triples!( ); /// List of all recognized Linux MUSL targets -pub const KNOWN_LINUX_MUSL_TARGETS: &[&TargetTripleRef] = &[ +pub const KNOWN_LINUX_MUSL_TARGETS: &[&TripleNameRef] = &[ TARGET_X86_LINUX_MUSL, TARGET_X64_LINUX_MUSL, TARGET_ARM64_LINUX_MUSL, @@ -142,7 +142,7 @@ pub const KNOWN_LINUX_MUSL_TARGETS: &[&TargetTripleRef] = &[ ]; /// List of all recognized Linux targets -pub const KNOWN_LINUX_TARGETS: &[&[&TargetTripleRef]] = +pub const KNOWN_LINUX_TARGETS: &[&[&TripleNameRef]] = &[KNOWN_LINUX_GNU_TARGETS, KNOWN_LINUX_MUSL_TARGETS]; define_target_triples!( @@ -177,7 +177,7 @@ define_target_triples!( ); /// List of all recognized Other targets -pub const KNOWN_OTHER_TARGETS: &[&TargetTripleRef] = &[ +pub const KNOWN_OTHER_TARGETS: &[&TripleNameRef] = &[ TARGET_X64_FREEBSD, TARGET_X64_ILLUMOS, TARGET_X64_NETBSD, @@ -195,14 +195,10 @@ pub const KNOWN_OTHER_TARGETS: &[&TargetTripleRef] = &[ ]; /// List of all recognized targets -pub const KNOWN_TARGET_TRIPLES: &[&[&TargetTripleRef]] = &[ +pub const KNOWN_TARGET_TRIPLES: &[&[&TripleNameRef]] = &[ KNOWN_WINDOWS_TARGETS, KNOWN_MAC_TARGETS, KNOWN_LINUX_GNU_TARGETS, KNOWN_LINUX_MUSL_TARGETS, KNOWN_OTHER_TARGETS, ]; - -/// The current host target (the target of the machine this code is running on). -/// This is determined through `std::env::consts::OS` rather than running `cargo` -pub const TARGET_HOST: &TargetTripleRef = TargetTripleRef::from_str(std::env::consts::OS); diff --git a/cargo-dist/src/sign/macos.rs b/cargo-dist/src/sign/macos.rs index 8d390842..ee267d3b 100644 --- a/cargo-dist/src/sign/macos.rs +++ b/cargo-dist/src/sign/macos.rs @@ -22,7 +22,7 @@ use axoasset::LocalAsset; use axoprocess::Cmd; use base64::Engine; use camino::{Utf8Path, Utf8PathBuf}; -use cargo_dist_schema::TargetTripleRef; +use cargo_dist_schema::TripleNameRef; use temp_dir::TempDir; use tracing::warn; @@ -157,7 +157,7 @@ impl std::fmt::Debug for CodesignEnv { } impl Codesign { - pub fn new(host_target: &TargetTripleRef) -> DistResult> { + pub fn new(host_target: &TripleNameRef) -> DistResult> { if !host_target.is_darwin() { return Ok(None); } diff --git a/cargo-dist/src/sign/mod.rs b/cargo-dist/src/sign/mod.rs index 5b2ab52b..19bfc5d2 100644 --- a/cargo-dist/src/sign/mod.rs +++ b/cargo-dist/src/sign/mod.rs @@ -5,7 +5,7 @@ use std::os::unix::fs::PermissionsExt; use axoasset::AxoClient; use camino::Utf8Path; -use cargo_dist_schema::TargetTripleRef; +use cargo_dist_schema::TripleNameRef; use crate::{config::ProductionMode, DistResult}; @@ -23,7 +23,7 @@ impl Signing { /// Setup signing pub fn new( client: &AxoClient, - host_target: &TargetTripleRef, + host_target: &TripleNameRef, dist_dir: &Utf8Path, ssldotcom_windows_sign: Option, macos_sign: bool, diff --git a/cargo-dist/src/sign/ssldotcom.rs b/cargo-dist/src/sign/ssldotcom.rs index b48237c3..73a878fd 100644 --- a/cargo-dist/src/sign/ssldotcom.rs +++ b/cargo-dist/src/sign/ssldotcom.rs @@ -4,7 +4,7 @@ use axoasset::LocalAsset; use axoprocess::Cmd; use camino::Utf8Path; use camino::Utf8PathBuf; -use cargo_dist_schema::TargetTripleRef; +use cargo_dist_schema::TripleNameRef; use tracing::info; use tracing::warn; @@ -71,7 +71,7 @@ impl CodeSignToolEnv { impl CodeSignTool { pub fn new( client: &AxoClient, - host_target: &TargetTripleRef, + host_target: &TripleNameRef, dist_dir: &Utf8Path, ssldotcom_windows_sign: Option, ) -> DistResult> { diff --git a/cargo-dist/src/tasks.rs b/cargo-dist/src/tasks.rs index b4e31744..fb827fad 100644 --- a/cargo-dist/src/tasks.rs +++ b/cargo-dist/src/tasks.rs @@ -58,8 +58,10 @@ use axoasset::AxoClient; use axoprocess::Cmd; use axoproject::{PackageId, PackageIdx, WorkspaceGraph}; use camino::{Utf8Path, Utf8PathBuf}; +use cargo_dist_schema::target_lexicon::{OperatingSystem, Triple}; use cargo_dist_schema::{ - ArtifactId, BuildEnvironment, DistManifest, SystemId, SystemInfo, TargetTriple, TargetTripleRef, + ArtifactId, BuildEnvironment, DistManifest, HomebrewPackageName, SystemId, SystemInfo, + TripleName, TripleNameRef, }; use semver::Version; use serde::Serialize; @@ -151,7 +153,7 @@ pub struct BinaryAliases(BTreeMap>); impl BinaryAliases { /// Returns a formatted copy of the map, with file extensions added /// if necessary. - pub fn for_target(&self, target: &TargetTripleRef) -> BTreeMap> { + pub fn for_target(&self, target: &TripleNameRef) -> BTreeMap> { if target.is_windows() { BTreeMap::from_iter(self.0.iter().map(|(k, v)| { ( @@ -168,8 +170,8 @@ impl BinaryAliases { /// executable extensions added if necessary. pub fn for_targets( &self, - targets: &[TargetTriple], - ) -> BTreeMap>> { + targets: &[TripleName], + ) -> BTreeMap>> { BTreeMap::from_iter( targets .iter() @@ -264,7 +266,7 @@ pub struct HostingInfo { #[derive(Debug, Clone)] pub struct Tools { /// Info on the host - pub host_target: TargetTriple, + pub host_target: TripleName, /// Info on cargo pub cargo: Option, /// rustup, useful for getting specific toolchains @@ -296,7 +298,7 @@ pub struct CargoInfo { /// The first line of running cargo with `-vV`, should be version info pub version_line: Option, /// The host target triple (obtained from `-vV`) - pub host_target: TargetTriple, + pub host_target: TripleName, } /// A tool we have found installed on the system @@ -329,7 +331,7 @@ pub struct Binary { /// The filename the binary will have pub file_name: String, /// The target triple to build it for - pub target: TargetTriple, + pub target: TripleName, /// The artifact for this Binary's symbols pub symbols_artifact: Option, /// Places the executable needs to be copied to @@ -394,7 +396,7 @@ pub enum BuildStep { #[derive(Debug)] pub struct CargoBuildStep { /// The --target triple to pass - pub target_triple: TargetTriple, + pub target_triple: TripleName, /// The feature flags to pass pub features: CargoTargetFeatures, /// What package to build (or "the workspace") @@ -409,11 +411,101 @@ pub struct CargoBuildStep { pub working_dir: Utf8PathBuf, } +/// A wrapper to use instead of `cargo build`, generally used for cross-compilation +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub enum CargoBuildWrapper { + /// Run 'cargo zigbuild' to cross-compile, e.g. from `x86_64-unknown-linux-gnu` to `aarch64-unknown-linux-gnu` + /// cf. + ZigBuild, + + /// Run 'cargo xwin' to cross-compile, e.g. from `aarch64-apple-darwin` to `x86_64-pc-windows-msvc` + /// cf. + Xwin, +} + +impl std::fmt::Display for CargoBuildWrapper { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.pad(match self { + CargoBuildWrapper::ZigBuild => "cargo-zigbuild", + CargoBuildWrapper::Xwin => "cargo-xwin", + }) + } +} + +/// Returns the cargo build wrapper required to perform a certain cross-compilation +pub fn build_wrapper_for_cross( + host: &Triple, + target: &Triple, +) -> DistResult> { + if host.operating_system == target.operating_system && host.architecture == target.architecture + { + // we're not cross-compiling, not really... maybe we're making a GNU binary from a "musl" host but meh. + return Ok(None); + } + + match target.operating_system { + // compiling for macOS (making Mach-O binaries, .dylib files, etc.) + OperatingSystem::Darwin => match host.operating_system { + OperatingSystem::Darwin => { + // from mac to mac, even if we do aarch64 => x86_64, or the other way + // around, _all we need_ is to add the target to rustup + Ok(None) + } + _ => { + Err(DistError::UnsupportedCrossCompile { + host: host.clone(), + target: target.clone(), + details: "cross-compiling to macOS is a road paved with sadness — we cowardly refuse to walk it.".to_string(), + }) + } + }, + // compiling for Linux (making ELF binaries, .so files, etc.) + OperatingSystem::Linux => match host.operating_system { + OperatingSystem::Linux | OperatingSystem::Darwin | OperatingSystem::Windows => { + // zigbuild works for e.g. x86_64-unknown-linux-gnu => aarch64-unknown-linux-gnu + Ok(Some(CargoBuildWrapper::ZigBuild)) + } + _ => { + Err(DistError::UnsupportedCrossCompile { + host: host.clone(), + target: target.clone(), + details: format!("no idea how to cross-compile from {host} to linux"), + }) + } + }, + // compiling for Windows (making PE binaries, .dll files, etc.) + OperatingSystem::Windows => match host.operating_system { + OperatingSystem::Windows => { + // this is just cross-arch, hopefully no wrappers are needed? + Ok(Some(CargoBuildWrapper::ZigBuild)) + } + OperatingSystem::Linux | OperatingSystem::Darwin => { + // cargo-xwin is made for that + Ok(Some(CargoBuildWrapper::Xwin)) + } + _ => { + Err(DistError::UnsupportedCrossCompile { + host: host.clone(), + target: target.clone(), + details: format!("no idea how to cross-compile from {host} to windows"), + }) + } + }, + _ => { + Err(DistError::UnsupportedCrossCompile { + host: host.clone(), + target: target.clone(), + details: format!("no idea how to cross-compile from anything (including the current host, {host}) to {target}"), + }) + } + } +} + /// A cargo build (and copy the outputs to various locations) #[derive(Debug)] pub struct GenericBuildStep { /// The --target triple to pass - pub target_triple: TargetTriple, + pub target_triple: TripleName, /// Binaries we expect from this build pub expected_binaries: Vec, /// The working directory to run the build in @@ -441,7 +533,7 @@ pub struct RustupStep { /// The rustup to invoke (mostly here to prove you Have rustup) pub rustup: Tool, /// The target to install - pub target: TargetTriple, + pub target: TripleName, } /// zip/tarball some directory @@ -515,7 +607,7 @@ pub struct SourceTarballStep { #[derive(Debug, Clone)] pub struct UpdaterStep { /// The target triple this updater is for - pub target_triple: TargetTriple, + pub target_triple: TripleName, /// The file this should produce pub target_filename: Utf8PathBuf, } @@ -552,7 +644,7 @@ pub struct Artifact { /// The target platform /// /// i.e. `x86_64-pc-windows-msvc` - pub target_triples: Vec, + pub target_triples: Vec, /// If constructing this artifact involves creating a directory, /// copying static files into it, and then zip/tarring it, set this /// value to automate those tasks. @@ -686,7 +778,7 @@ pub struct Release { /// misc app-specific config pub config: AppConfig, /// Targets this Release has artifacts for - pub targets: Vec, + pub targets: Vec, /// Binaries that every variant should ostensibly provide /// /// The string is the name of the binary under that package (without .exe extension) @@ -721,7 +813,7 @@ pub struct Release { #[derive(Debug)] pub struct ReleaseVariant { /// The target triple this variant is for - pub target: TargetTriple, + pub target: TripleName, /// The unique identifying string used for things related to this variant /// (e.g. "my-app-v1.0.0-x86_64-pc-windows-msvc") pub id: String, @@ -1165,7 +1257,7 @@ impl<'pkg_graph> DistGraphBuilder<'pkg_graph> { fn add_variant( &mut self, to_release: ReleaseIdx, - target: TargetTriple, + target: TripleName, ) -> DistResult { let idx = ReleaseVariantIdx(self.inner.variants.len()); let Release { @@ -1910,7 +2002,7 @@ impl<'pkg_graph> DistGraphBuilder<'pkg_graph> { .map(|a| a.target_triple.clone()) .collect::>(); - let find_fragment = |triple: &TargetTripleRef| -> Option { + let find_fragment = |triple: &TripleNameRef| -> Option { artifacts .iter() .find(|a| a.target_triple == triple) @@ -1952,7 +2044,7 @@ impl<'pkg_graph> DistGraphBuilder<'pkg_graph> { let runtime_conditions = release.platform_support.safe_conflated_runtime_conditions(); - let dependencies: Vec = release + let dependencies: Vec = release .config .builds .system_dependencies @@ -2652,7 +2744,7 @@ impl<'pkg_graph> DistGraphBuilder<'pkg_graph> { &mut self, cfg: &Config, announcing: &AnnouncementTag, - triples: &[TargetTriple], + triples: &[TripleName], bypass_package_target_prefs: bool, ) -> DistResult<()> { // Create a Release for each package @@ -2967,14 +3059,14 @@ pub fn get_cargo_info(cargo: String) -> DistResult { return Ok(CargoInfo { cmd: cargo, version_line, - host_target: TargetTriple::new(target.to_owned()), + host_target: TripleName::new(target.to_owned()), }); } } Err(DistError::FailedCargoVersion) } -fn target_symbol_kind(target: &TargetTripleRef) -> Option { +fn target_symbol_kind(target: &TripleNameRef) -> Option { #[allow(clippy::if_same_then_else)] if target.is_windows_msvc() { // Temporary disabled pending redesign of symbol handling! @@ -3005,7 +3097,7 @@ fn tool_info() -> DistResult { None }; Ok(Tools { - host_target: TargetTriple::new(current_platform::CURRENT_PLATFORM.to_owned()), + host_target: TripleName::new(current_platform::CURRENT_PLATFORM.to_owned()), cargo, rustup: find_tool("rustup", "-V"), brew: find_tool("brew", "--version"), diff --git a/cargo-dist/templates/ci/github/release.yml.j2 b/cargo-dist/templates/ci/github/release.yml.j2 index 110fd631..d7e0f4f0 100644 --- a/cargo-dist/templates/ci/github/release.yml.j2 +++ b/cargo-dist/templates/ci/github/release.yml.j2 @@ -201,6 +201,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -222,6 +223,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi {{%- if rust_version %}} - name: Use rustup to set correct Rust version run: rustup update {{{ rust_version }}} --no-self-update && rustup default {{{ rust_version }}} @@ -319,7 +327,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/integration-tests.rs b/cargo-dist/tests/integration-tests.rs index d7567534..c5bc34a1 100644 --- a/cargo-dist/tests/integration-tests.rs +++ b/cargo-dist/tests/integration-tests.rs @@ -1914,3 +1914,69 @@ windows-archive = ".tar.gz" Ok(()) }) } + +#[test] +fn axolotlsay_cross1() -> Result<(), miette::Report> { + let test_name = _function_name!(); + AXOLOTLSAY.run_test(|ctx| { + let dist_version = ctx.tools.cargo_dist.version().unwrap(); + ctx.patch_cargo_toml(format!( + r#" +[workspace.metadata.dist] +cargo-dist-version = "{dist_version}" +installers = ["shell", "powershell"] +targets = ["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc"] +ci = ["github"] +unix-archive = ".tar.gz" +windows-archive = ".tar.gz" + +[workspace.metadata.dist.github-custom-runners] +x86_64-pc-windows-msvc.container = "messense/cargo-xwin" +aarch64-pc-windows-msvc.container = "messense/cargo-xwin" +# aarch64-unknown-linux-gnu should work out of the box +"# + ))?; + + // Run generate to make sure stuff is up to date before running other commands + let ci_result = ctx.cargo_dist_generate(test_name)?; + let ci_snap = ci_result.check_all()?; + // Do usual build+plan checks + let main_result = ctx.cargo_dist_build_and_plan(test_name)?; + let main_snap = main_result.check_all(&ctx, ".cargo/bin/")?; + // snapshot all + main_snap.join(ci_snap).snap(); + Ok(()) + }) +} + +#[test] +fn axolotlsay_cross2() -> Result<(), miette::Report> { + let test_name = _function_name!(); + AXOLOTLSAY.run_test(|ctx| { + let dist_version = ctx.tools.cargo_dist.version().unwrap(); + ctx.patch_cargo_toml(format!( + r#" +[workspace.metadata.dist] +cargo-dist-version = "{dist_version}" +installers = ["shell", "powershell"] +targets = ["aarch64-unknown-linux-gnu"] +ci = ["github"] +unix-archive = ".tar.gz" +windows-archive = ".tar.gz" + +[workspace.metadata.dist.github-custom-runners.aarch64-unknown-linux-gnu] +container = {{ image = "quay.io/pypa/manylinux_2_28_x86_64", host = "aarch64-unknown-linux-gnu" }} +"# + ))?; + + // Run generate to make sure stuff is up to date before running other commands + let ci_result = ctx.cargo_dist_generate(test_name)?; + let ci_snap = ci_result.check_all()?; + // Do usual build+plan checks + let main_result = ctx.cargo_dist_build_and_plan(test_name)?; + let main_snap = main_result.check_all(&ctx, ".cargo/bin/")?; + // snapshot all + main_snap.join(ci_snap).snap(); + Ok(()) + }) +} diff --git a/cargo-dist/tests/snapshots/akaikatana_basic.snap b/cargo-dist/tests/snapshots/akaikatana_basic.snap index f23f8b4e..8ab57b76 100644 --- a/cargo-dist/tests/snapshots/akaikatana_basic.snap +++ b/cargo-dist/tests/snapshots/akaikatana_basic.snap @@ -2210,67 +2210,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -2394,6 +2398,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -2404,6 +2409,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Use rustup to set correct Rust version run: rustup update "1.67.1" --no-self-update && rustup default "1.67.1" - name: Install dist @@ -2432,7 +2444,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/akaikatana_musl.snap b/cargo-dist/tests/snapshots/akaikatana_musl.snap index 6dd62aba..42a2ef40 100644 --- a/cargo-dist/tests/snapshots/akaikatana_musl.snap +++ b/cargo-dist/tests/snapshots/akaikatana_musl.snap @@ -1595,68 +1595,72 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { + "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "targets": [ "x86_64-unknown-linux-gnu" ], - "runner": "ubuntu-20.04", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-musl" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-musl", + "targets": [ + "x86_64-unknown-linux-musl" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-musl", - "packages_install": "sudo apt-get update && sudo apt-get install musl-tools", + "packages_install": "sudo apt-get update\nsudo apt-get install musl-tools", "cache_provider": "github" } ] @@ -1780,6 +1784,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -1790,6 +1795,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Use rustup to set correct Rust version run: rustup update "1.67.1" --no-self-update && rustup default "1.67.1" - name: Install dist @@ -1818,7 +1830,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/akaikatana_one_alias_among_many_binaries.snap b/cargo-dist/tests/snapshots/akaikatana_one_alias_among_many_binaries.snap index 3002f445..54a3869c 100644 --- a/cargo-dist/tests/snapshots/akaikatana_one_alias_among_many_binaries.snap +++ b/cargo-dist/tests/snapshots/akaikatana_one_alias_among_many_binaries.snap @@ -2240,67 +2240,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -2424,6 +2428,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -2434,6 +2439,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Use rustup to set correct Rust version run: rustup update "1.67.1" --no-self-update && rustup default "1.67.1" - name: Install dist @@ -2462,7 +2474,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/akaikatana_two_bin_aliases.snap b/cargo-dist/tests/snapshots/akaikatana_two_bin_aliases.snap index a9211d30..9f133ace 100644 --- a/cargo-dist/tests/snapshots/akaikatana_two_bin_aliases.snap +++ b/cargo-dist/tests/snapshots/akaikatana_two_bin_aliases.snap @@ -2266,67 +2266,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -2450,6 +2454,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -2460,6 +2465,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Use rustup to set correct Rust version run: rustup update "1.67.1" --no-self-update && rustup default "1.67.1" - name: Install dist @@ -2488,7 +2500,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/akaikatana_updaters.snap b/cargo-dist/tests/snapshots/akaikatana_updaters.snap index abec39aa..21e7db9e 100644 --- a/cargo-dist/tests/snapshots/akaikatana_updaters.snap +++ b/cargo-dist/tests/snapshots/akaikatana_updaters.snap @@ -2250,67 +2250,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -2434,6 +2438,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -2444,6 +2449,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Use rustup to set correct Rust version run: rustup update "1.67.1" --no-self-update && rustup default "1.67.1" - name: Install dist @@ -2472,7 +2484,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_abyss.snap b/cargo-dist/tests/snapshots/axolotlsay_abyss.snap index edf5c460..963a7f00 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_abyss.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_abyss.snap @@ -3782,67 +3782,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -3969,6 +3973,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3979,6 +3984,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -4009,7 +4021,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_abyss_only.snap b/cargo-dist/tests/snapshots/axolotlsay_abyss_only.snap index 1e59fa75..219818ba 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_abyss_only.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_abyss_only.snap @@ -3775,67 +3775,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -3955,6 +3959,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3965,6 +3970,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -3991,7 +4003,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_alias.snap b/cargo-dist/tests/snapshots/axolotlsay_alias.snap index 7a852577..c60e0fd5 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_alias.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_alias.snap @@ -3823,67 +3823,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -4005,6 +4009,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -4015,6 +4020,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -4041,7 +4053,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap b/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap index 0bfee42d..9bc4f404 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap @@ -3825,67 +3825,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -4007,6 +4011,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -4017,6 +4022,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -4043,7 +4055,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic.snap b/cargo-dist/tests/snapshots/axolotlsay_basic.snap index a605e44e..75488f69 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic.snap @@ -3885,22 +3885,30 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { - "targets": [ - "aarch64-apple-darwin" - ], "runner": "macos-13", + "host": "x86_64-apple-darwin", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", + "targets": [ + "aarch64-apple-darwin" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "i686-unknown-linux-gnu" ], @@ -3920,48 +3928,44 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -4083,6 +4087,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -4093,6 +4098,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -4121,7 +4133,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap b/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap index 6753ae1b..ef6ef83a 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap @@ -3894,67 +3894,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -4076,6 +4080,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -4086,6 +4091,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -4112,7 +4124,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap b/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap index 82d2e6ce..823d70c4 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap @@ -3791,67 +3791,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -3973,6 +3977,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3983,6 +3988,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: "Some build step" uses: "some-action-user/some-action" with: @@ -4026,7 +4038,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_checksum_blake2b.snap b/cargo-dist/tests/snapshots/axolotlsay_checksum_blake2b.snap index 20ad5f40..400a33dc 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_checksum_blake2b.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_checksum_blake2b.snap @@ -1575,67 +1575,71 @@ download_binary_and_run_installer "$@" || exit 1 "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -1757,6 +1761,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -1767,6 +1772,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -1793,7 +1805,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_checksum_blake2s.snap b/cargo-dist/tests/snapshots/axolotlsay_checksum_blake2s.snap index 0f3aaed8..ac44024a 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_checksum_blake2s.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_checksum_blake2s.snap @@ -1575,67 +1575,71 @@ download_binary_and_run_installer "$@" || exit 1 "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -1757,6 +1761,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -1767,6 +1772,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -1793,7 +1805,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_checksum_sha3_256.snap b/cargo-dist/tests/snapshots/axolotlsay_checksum_sha3_256.snap index 0db0f387..b34cc3a9 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_checksum_sha3_256.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_checksum_sha3_256.snap @@ -1575,67 +1575,71 @@ download_binary_and_run_installer "$@" || exit 1 "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -1757,6 +1761,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -1767,6 +1772,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -1793,7 +1805,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_checksum_sha3_512.snap b/cargo-dist/tests/snapshots/axolotlsay_checksum_sha3_512.snap index 565c4583..ba4cfca2 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_checksum_sha3_512.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_checksum_sha3_512.snap @@ -1575,67 +1575,71 @@ download_binary_and_run_installer "$@" || exit 1 "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -1757,6 +1761,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -1767,6 +1772,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -1793,7 +1805,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_cross1.snap b/cargo-dist/tests/snapshots/axolotlsay_cross1.snap new file mode 100644 index 00000000..4a855ea7 --- /dev/null +++ b/cargo-dist/tests/snapshots/axolotlsay_cross1.snap @@ -0,0 +1,2698 @@ +--- +source: cargo-dist/tests/gallery/dist/snapshot.rs +expression: self.payload +--- +================ axolotlsay-installer.sh ================ +#!/bin/sh +# shellcheck shell=dash +# +# Licensed under the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +if [ "$KSH_VERSION" = 'Version JM 93t+ 2010-03-05' ]; then + # The version of ksh93 that ships with many illumos systems does not + # support the "local" extension. Print a message rather than fail in + # subtle ways later on: + echo 'this installer does not work with this ksh93 version; please try bash!' >&2 + exit 1 +fi + +set -u + +APP_NAME="axolotlsay" +APP_VERSION="0.2.2" +# Look for GitHub Enterprise-style base URL first +if [ -n "${AXOLOTLSAY_INSTALLER_GHE_BASE_URL:-}" ]; then + INSTALLER_BASE_URL="$AXOLOTLSAY_INSTALLER_GHE_BASE_URL" +else + INSTALLER_BASE_URL="${AXOLOTLSAY_INSTALLER_GITHUB_BASE_URL:-https://github.com}" +fi +if [ -n "${INSTALLER_DOWNLOAD_URL:-}" ]; then + ARTIFACT_DOWNLOAD_URL="$INSTALLER_DOWNLOAD_URL" +else + ARTIFACT_DOWNLOAD_URL="${INSTALLER_BASE_URL}/axodotdev/axolotlsay/releases/download/v0.2.2" +fi +PRINT_VERBOSE=${INSTALLER_PRINT_VERBOSE:-0} +PRINT_QUIET=${INSTALLER_PRINT_QUIET:-0} +if [ -n "${AXOLOTLSAY_NO_MODIFY_PATH:-}" ]; then + NO_MODIFY_PATH="$AXOLOTLSAY_NO_MODIFY_PATH" +else + NO_MODIFY_PATH=${INSTALLER_NO_MODIFY_PATH:-0} +fi +if [ "${AXOLOTLSAY_DISABLE_UPDATE:-0}" = "1" ]; then + INSTALL_UPDATER=0 +else + INSTALL_UPDATER=1 +fi +UNMANAGED_INSTALL="${AXOLOTLSAY_UNMANAGED_INSTALL:-}" +if [ -n "${UNMANAGED_INSTALL}" ]; then + NO_MODIFY_PATH=1 + INSTALL_UPDATER=0 +fi + +read -r RECEIPT <&2 + say_verbose " from $_url" 1>&2 + say_verbose " to $_file" 1>&2 + + ensure mkdir -p "$_dir" + + if ! downloader "$_url" "$_file"; then + say "failed to download $_url" + say "this may be a standard network error, but it may also indicate" + say "that $APP_NAME's release process is not working. When in doubt" + say "please feel free to open an issue!" + exit 1 + fi + + if [ -n "${_checksum_style:-}" ]; then + verify_checksum "$_file" "$_checksum_style" "$_checksum_value" + else + say "no checksums to verify" + fi + + # ...and then the updater, if it exists + if [ -n "$_updater_name" ] && [ "$INSTALL_UPDATER" = "1" ]; then + local _updater_url="$ARTIFACT_DOWNLOAD_URL/$_updater_name" + # This renames the artifact while doing the download, removing the + # target triple and leaving just the appname-update format + local _updater_file="$_dir/$APP_NAME-update" + + if ! downloader "$_updater_url" "$_updater_file"; then + say "failed to download $_updater_url" + say "this may be a standard network error, but it may also indicate" + say "that $APP_NAME's release process is not working. When in doubt" + say "please feel free to open an issue!" + exit 1 + fi + + # Add the updater to the list of binaries to install + _bins="$_bins $APP_NAME-update" + fi + + # unpack the archive + case "$_zip_ext" in + ".zip") + ensure unzip -q "$_file" -d "$_dir" + ;; + + ".tar."*) + ensure tar xf "$_file" --strip-components 1 -C "$_dir" + ;; + *) + err "unknown archive format: $_zip_ext" + ;; + esac + + install "$_dir" "$_bins" "$_libs" "$_staticlibs" "$_arch" "$@" + local _retval=$? + if [ "$_retval" != 0 ]; then + return "$_retval" + fi + + ignore rm -rf "$_dir" + + # Install the install receipt + if [ "$INSTALL_UPDATER" = "1" ]; then + if ! mkdir -p "$RECEIPT_HOME"; then + err "unable to create receipt directory at $RECEIPT_HOME" + else + echo "$RECEIPT" > "$RECEIPT_HOME/$APP_NAME-receipt.json" + # shellcheck disable=SC2320 + local _retval=$? + fi + else + local _retval=0 + fi + + return "$_retval" +} + +# Replaces $HOME with the variable name for display to the user, +# only if $HOME is defined. +replace_home() { + local _str="$1" + + if [ -n "${HOME:-}" ]; then + echo "$_str" | sed "s,$HOME,\$HOME," + else + echo "$_str" + fi +} + +json_binary_aliases() { + local _arch="$1" + + case "$_arch" in + "aarch64-apple-darwin") + echo '{}' + ;; + "aarch64-pc-windows-gnu") + echo '{}' + ;; + "aarch64-unknown-linux-gnu") + echo '{}' + ;; + "x86_64-apple-darwin") + echo '{}' + ;; + "x86_64-pc-windows-gnu") + echo '{}' + ;; + "x86_64-unknown-linux-gnu") + echo '{}' + ;; + *) + echo '{}' + ;; + esac +} + +aliases_for_binary() { + local _bin="$1" + local _arch="$2" + + case "$_arch" in + "aarch64-apple-darwin") + case "$_bin" in + *) + echo "" + ;; + esac + ;; + "aarch64-pc-windows-gnu") + case "$_bin" in + *) + echo "" + ;; + esac + ;; + "aarch64-unknown-linux-gnu") + case "$_bin" in + *) + echo "" + ;; + esac + ;; + "x86_64-apple-darwin") + case "$_bin" in + *) + echo "" + ;; + esac + ;; + "x86_64-pc-windows-gnu") + case "$_bin" in + *) + echo "" + ;; + esac + ;; + "x86_64-unknown-linux-gnu") + case "$_bin" in + *) + echo "" + ;; + esac + ;; + *) + echo "" + ;; + esac +} + +select_archive_for_arch() { + local _true_arch="$1" + local _archive + + # try each archive, checking runtime conditions like libc versions + # accepting the first one that matches, as it's the best match + case "$_true_arch" in + "aarch64-apple-darwin") + _archive="axolotlsay-aarch64-apple-darwin.tar.gz" + if [ -n "$_archive" ]; then + echo "$_archive" + return 0 + fi + _archive="axolotlsay-x86_64-apple-darwin.tar.gz" + if [ -n "$_archive" ]; then + echo "$_archive" + return 0 + fi + ;; + "aarch64-pc-windows-gnu") + _archive="axolotlsay-aarch64-pc-windows-msvc.tar.gz" + if [ -n "$_archive" ]; then + echo "$_archive" + return 0 + fi + ;; + "aarch64-pc-windows-msvc") + _archive="axolotlsay-aarch64-pc-windows-msvc.tar.gz" + if [ -n "$_archive" ]; then + echo "$_archive" + return 0 + fi + _archive="axolotlsay-x86_64-pc-windows-msvc.tar.gz" + if [ -n "$_archive" ]; then + echo "$_archive" + return 0 + fi + ;; + "aarch64-unknown-linux-gnu") + _archive="axolotlsay-aarch64-unknown-linux-gnu.tar.gz" + if ! check_glibc "2" "31"; then + _archive="" + fi + if [ -n "$_archive" ]; then + echo "$_archive" + return 0 + fi + ;; + "x86_64-apple-darwin") + _archive="axolotlsay-x86_64-apple-darwin.tar.gz" + if [ -n "$_archive" ]; then + echo "$_archive" + return 0 + fi + ;; + "x86_64-pc-windows-gnu") + _archive="axolotlsay-x86_64-pc-windows-msvc.tar.gz" + if [ -n "$_archive" ]; then + echo "$_archive" + return 0 + fi + ;; + "x86_64-pc-windows-msvc") + _archive="axolotlsay-x86_64-pc-windows-msvc.tar.gz" + if [ -n "$_archive" ]; then + echo "$_archive" + return 0 + fi + ;; + "x86_64-unknown-linux-gnu") + _archive="axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + if ! check_glibc "2" "31"; then + _archive="" + fi + if [ -n "$_archive" ]; then + echo "$_archive" + return 0 + fi + ;; + *) + err "there isn't a download for your platform $_true_arch" + ;; + esac + err "no compatible downloads were found for your platform $_true_arch" +} + +check_glibc() { + local _min_glibc_major="$1" + local _min_glibc_series="$2" + + # Parsing version out from line 1 like: + # ldd (Ubuntu GLIBC 2.35-0ubuntu3.1) 2.35 + _local_glibc="$(ldd --version | awk -F' ' '{ if (FNR<=1) print $NF }')" + + if [ "$(echo "${_local_glibc}" | awk -F. '{ print $1 }')" = "$_min_glibc_major" ] && [ "$(echo "${_local_glibc}" | awk -F. '{ print $2 }')" -ge "$_min_glibc_series" ]; then + return 0 + else + say "System glibc version (\`${_local_glibc}') is too old; checking alternatives" >&2 + return 1 + fi +} + +# See discussion of late-bound vs early-bound for why we use single-quotes with env vars +# shellcheck disable=SC2016 +install() { + # This code needs to both compute certain paths for itself to write to, and + # also write them to shell/rc files so that they can look them up to e.g. + # add them to PATH. This requires an active distinction between paths + # and expressions that can compute them. + # + # The distinction lies in when we want env-vars to be evaluated. For instance + # if we determine that we want to install to $HOME/.myapp, which do we add + # to e.g. $HOME/.profile: + # + # * early-bound: export PATH="/home/myuser/.myapp:$PATH" + # * late-bound: export PATH="$HOME/.myapp:$PATH" + # + # In this case most people would prefer the late-bound version, but in other + # cases the early-bound version might be a better idea. In particular when using + # other env-vars than $HOME, they are more likely to be only set temporarily + # for the duration of this install script, so it's more advisable to erase their + # existence with early-bounding. + # + # This distinction is handled by "double-quotes" (early) vs 'single-quotes' (late). + # + # However if we detect that "$SOME_VAR/..." is a subdir of $HOME, we try to rewrite + # it to be '$HOME/...' to get the best of both worlds. + # + # This script has a few different variants, the most complex one being the + # CARGO_HOME version which attempts to install things to Cargo's bin dir, + # potentially setting up a minimal version if the user hasn't ever installed Cargo. + # + # In this case we need to: + # + # * Install to $HOME/.cargo/bin/ + # * Create a shell script at $HOME/.cargo/env that: + # * Checks if $HOME/.cargo/bin/ is on PATH + # * and if not prepends it to PATH + # * Edits $HOME/.profile to run $HOME/.cargo/env (if the line doesn't exist) + # + # To do this we need these 4 values: + + # The actual path we're going to install to + local _install_dir + # The directory C dynamic/static libraries install to + local _lib_install_dir + # The install prefix we write to the receipt. + # For organized install methods like CargoHome, which have + # subdirectories, this is the root without `/bin`. For other + # methods, this is the same as `_install_dir`. + local _receipt_install_dir + # Path to the an shell script that adds install_dir to PATH + local _env_script_path + # Potentially-late-bound version of install_dir to write env_script + local _install_dir_expr + # Potentially-late-bound version of env_script_path to write to rcfiles like $HOME/.profile + local _env_script_path_expr + # Forces the install to occur at this path, not the default + local _force_install_dir + # Which install layout to use - "flat" or "hierarchical" + local _install_layout="unspecified" + + # Check the newer app-specific variable before falling back + # to the older generic one + if [ -n "${AXOLOTLSAY_INSTALL_DIR:-}" ]; then + _force_install_dir="$AXOLOTLSAY_INSTALL_DIR" + _install_layout="cargo-home" + elif [ -n "${CARGO_DIST_FORCE_INSTALL_DIR:-}" ]; then + _force_install_dir="$CARGO_DIST_FORCE_INSTALL_DIR" + _install_layout="cargo-home" + elif [ -n "$UNMANAGED_INSTALL" ]; then + _force_install_dir="$UNMANAGED_INSTALL" + _install_layout="flat" + fi + + # Check if the install layout should be changed from `flat` to `cargo-home` + # for backwards compatible updates of applications that switched layouts. + if [ -n "${_force_install_dir:-}" ]; then + if [ "$_install_layout" = "flat" ]; then + # If the install directory is targeting the Cargo home directory, then + # we assume this application was previously installed that layout + if [ "$_force_install_dir" = "${CARGO_HOME:-${HOME:-}/.cargo}" ]; then + _install_layout="cargo-home" + fi + fi + fi + + # Before actually consulting the configured install strategy, see + # if we're overriding it. + if [ -n "${_force_install_dir:-}" ]; then + case "$_install_layout" in + "hierarchical") + _install_dir="$_force_install_dir/bin" + _lib_install_dir="$_force_install_dir/lib" + _receipt_install_dir="$_force_install_dir" + _env_script_path="$_force_install_dir/env" + _install_dir_expr="$(replace_home "$_force_install_dir/bin")" + _env_script_path_expr="$(replace_home "$_force_install_dir/env")" + ;; + "cargo-home") + _install_dir="$_force_install_dir/bin" + _lib_install_dir="$_force_install_dir/bin" + _receipt_install_dir="$_force_install_dir" + _env_script_path="$_force_install_dir/env" + _install_dir_expr="$(replace_home "$_force_install_dir/bin")" + _env_script_path_expr="$(replace_home "$_force_install_dir/env")" + ;; + "flat") + _install_dir="$_force_install_dir" + _lib_install_dir="$_force_install_dir" + _receipt_install_dir="$_install_dir" + _env_script_path="$_force_install_dir/env" + _install_dir_expr="$(replace_home "$_force_install_dir")" + _env_script_path_expr="$(replace_home "$_force_install_dir/env")" + ;; + *) + err "Unrecognized install layout: $_install_layout" + ;; + esac + fi + if [ -z "${_install_dir:-}" ]; then + _install_layout="cargo-home" + # first try $CARGO_HOME, then fallback to $HOME/.cargo + if [ -n "${CARGO_HOME:-}" ]; then + _receipt_install_dir="$CARGO_HOME" + _install_dir="$CARGO_HOME/bin" + _lib_install_dir="$CARGO_HOME/bin" + _env_script_path="$CARGO_HOME/env" + # Initially make this early-bound to erase the potentially-temporary env-var + _install_dir_expr="$_install_dir" + _env_script_path_expr="$_env_script_path" + # If CARGO_HOME was set but it ended up being the default $HOME-based path, + # then keep things late-bound. Otherwise bake the value for safety. + # This is what rustup does, and accurately reproducing it is useful. + if [ -n "${HOME:-}" ]; then + if [ "$HOME/.cargo/bin" = "$_install_dir" ]; then + _install_dir_expr='$HOME/.cargo/bin' + _env_script_path_expr='$HOME/.cargo/env' + fi + fi + elif [ -n "${HOME:-}" ]; then + _receipt_install_dir="$HOME/.cargo" + _install_dir="$HOME/.cargo/bin" + _lib_install_dir="$HOME/.cargo/bin" + _env_script_path="$HOME/.cargo/env" + _install_dir_expr='$HOME/.cargo/bin' + _env_script_path_expr='$HOME/.cargo/env' + fi + fi + + if [ -z "$_install_dir_expr" ]; then + err "could not find a valid path to install to!" + fi + + # Identical to the sh version, just with a .fish file extension + # We place it down here to wait until it's been assigned in every + # path. + _fish_env_script_path="${_env_script_path}.fish" + _fish_env_script_path_expr="${_env_script_path_expr}.fish" + + # Replace the temporary cargo home with the calculated one + RECEIPT=$(echo "$RECEIPT" | sed "s,AXO_INSTALL_PREFIX,$_receipt_install_dir,") + # Also replace the aliases with the arch-specific one + RECEIPT=$(echo "$RECEIPT" | sed "s'\"binary_aliases\":{}'\"binary_aliases\":$(json_binary_aliases "$_arch")'") + # And replace the install layout + RECEIPT=$(echo "$RECEIPT" | sed "s'\"install_layout\":\"unspecified\"'\"install_layout\":\"$_install_layout\"'") + if [ "$NO_MODIFY_PATH" = "1" ]; then + RECEIPT=$(echo "$RECEIPT" | sed "s'\"modify_path\":true'\"modify_path\":false'") + fi + + say "installing to $_install_dir" + ensure mkdir -p "$_install_dir" + ensure mkdir -p "$_lib_install_dir" + + # copy all the binaries to the install dir + local _src_dir="$1" + local _bins="$2" + local _libs="$3" + local _staticlibs="$4" + local _arch="$5" + for _bin_name in $_bins; do + local _bin="$_src_dir/$_bin_name" + ensure mv "$_bin" "$_install_dir" + # unzip seems to need this chmod + ensure chmod +x "$_install_dir/$_bin_name" + for _dest in $(aliases_for_binary "$_bin_name" "$_arch"); do + ln -sf "$_install_dir/$_bin_name" "$_install_dir/$_dest" + done + say " $_bin_name" + done + # Like the above, but no aliases + for _lib_name in $_libs; do + local _lib="$_src_dir/$_lib_name" + ensure mv "$_lib" "$_lib_install_dir" + # unzip seems to need this chmod + ensure chmod +x "$_lib_install_dir/$_lib_name" + say " $_lib_name" + done + for _lib_name in $_staticlibs; do + local _lib="$_src_dir/$_lib_name" + ensure mv "$_lib" "$_lib_install_dir" + # unzip seems to need this chmod + ensure chmod +x "$_lib_install_dir/$_lib_name" + say " $_lib_name" + done + + say "everything's installed!" + + # Avoid modifying the users PATH if they are managing their PATH manually + case :$PATH: + in *:$_install_dir:*) NO_MODIFY_PATH=1 ;; + *) ;; + esac + + if [ "0" = "$NO_MODIFY_PATH" ]; then + add_install_dir_to_ci_path "$_install_dir" + add_install_dir_to_path "$_install_dir_expr" "$_env_script_path" "$_env_script_path_expr" ".profile" "sh" + exit1=$? + shotgun_install_dir_to_path "$_install_dir_expr" "$_env_script_path" "$_env_script_path_expr" ".profile .bashrc .bash_profile .bash_login" "sh" + exit2=$? + add_install_dir_to_path "$_install_dir_expr" "$_env_script_path" "$_env_script_path_expr" ".zshrc .zshenv" "sh" + exit3=$? + # This path may not exist by default + ensure mkdir -p "$HOME/.config/fish/conf.d" + exit4=$? + add_install_dir_to_path "$_install_dir_expr" "$_fish_env_script_path" "$_fish_env_script_path_expr" ".config/fish/conf.d/$APP_NAME.env.fish" "fish" + exit5=$? + + if [ "${exit1:-0}" = 1 ] || [ "${exit2:-0}" = 1 ] || [ "${exit3:-0}" = 1 ] || [ "${exit4:-0}" = 1 ] || [ "${exit5:-0}" = 1 ]; then + say "" + say "To add $_install_dir_expr to your PATH, either restart your shell or run:" + say "" + say " source $_env_script_path_expr (sh, bash, zsh)" + say " source $_fish_env_script_path_expr (fish)" + fi + fi +} + +print_home_for_script() { + local script="$1" + + local _home + case "$script" in + # zsh has a special ZDOTDIR directory, which if set + # should be considered instead of $HOME + .zsh*) + if [ -n "${ZDOTDIR:-}" ]; then + _home="$ZDOTDIR" + else + _home="$HOME" + fi + ;; + *) + _home="$HOME" + ;; + esac + + echo "$_home" +} + +add_install_dir_to_ci_path() { + # Attempt to do CI-specific rituals to get the install-dir on PATH faster + local _install_dir="$1" + + # If GITHUB_PATH is present, then write install_dir to the file it refs. + # After each GitHub Action, the contents will be added to PATH. + # So if you put a curl | sh for this script in its own "run" step, + # the next step will have this dir on PATH. + # + # Note that GITHUB_PATH will not resolve any variables, so we in fact + # want to write install_dir and not install_dir_expr + if [ -n "${GITHUB_PATH:-}" ]; then + ensure echo "$_install_dir" >> "$GITHUB_PATH" + fi +} + +add_install_dir_to_path() { + # Edit rcfiles ($HOME/.profile) to add install_dir to $PATH + # + # We do this slightly indirectly by creating an "env" shell script which checks if install_dir + # is on $PATH already, and prepends it if not. The actual line we then add to rcfiles + # is to just source that script. This allows us to blast it into lots of different rcfiles and + # have it run multiple times without causing problems. It's also specifically compatible + # with the system rustup uses, so that we don't conflict with it. + local _install_dir_expr="$1" + local _env_script_path="$2" + local _env_script_path_expr="$3" + local _rcfiles="$4" + local _shell="$5" + + if [ -n "${HOME:-}" ]; then + local _target + local _home + + # Find the first file in the array that exists and choose + # that as our target to write to + for _rcfile_relative in $_rcfiles; do + _home="$(print_home_for_script "$_rcfile_relative")" + local _rcfile="$_home/$_rcfile_relative" + + if [ -f "$_rcfile" ]; then + _target="$_rcfile" + break + fi + done + + # If we didn't find anything, pick the first entry in the + # list as the default to create and write to + if [ -z "${_target:-}" ]; then + local _rcfile_relative + _rcfile_relative="$(echo "$_rcfiles" | awk '{ print $1 }')" + _home="$(print_home_for_script "$_rcfile_relative")" + _target="$_home/$_rcfile_relative" + fi + + # `source x` is an alias for `. x`, and the latter is more portable/actually-posix. + # This apparently comes up a lot on freebsd. It's easy enough to always add + # the more robust line to rcfiles, but when telling the user to apply the change + # to their current shell ". x" is pretty easy to misread/miscopy, so we use the + # prettier "source x" line there. Hopefully people with Weird Shells are aware + # this is a thing and know to tweak it (or just restart their shell). + local _robust_line=". \"$_env_script_path_expr\"" + local _pretty_line="source \"$_env_script_path_expr\"" + + # Add the env script if it doesn't already exist + if [ ! -f "$_env_script_path" ]; then + say_verbose "creating $_env_script_path" + if [ "$_shell" = "sh" ]; then + write_env_script_sh "$_install_dir_expr" "$_env_script_path" + else + write_env_script_fish "$_install_dir_expr" "$_env_script_path" + fi + else + say_verbose "$_env_script_path already exists" + fi + + # Check if the line is already in the rcfile + # grep: 0 if matched, 1 if no match, and 2 if an error occurred + # + # Ideally we could use quiet grep (-q), but that makes "match" and "error" + # have the same behaviour, when we want "no match" and "error" to be the same + # (on error we want to create the file, which >> conveniently does) + # + # We search for both kinds of line here just to do the right thing in more cases. + if ! grep -F "$_robust_line" "$_target" > /dev/null 2>/dev/null && \ + ! grep -F "$_pretty_line" "$_target" > /dev/null 2>/dev/null + then + # If the script now exists, add the line to source it to the rcfile + # (This will also create the rcfile if it doesn't exist) + if [ -f "$_env_script_path" ]; then + local _line + # Fish has deprecated `.` as an alias for `source` and + # it will be removed in a later version. + # https://fishshell.com/docs/current/cmds/source.html + # By contrast, `.` is the traditional syntax in sh and + # `source` isn't always supported in all circumstances. + if [ "$_shell" = "fish" ]; then + _line="$_pretty_line" + else + _line="$_robust_line" + fi + say_verbose "adding $_line to $_target" + # prepend an extra newline in case the user's file is missing a trailing one + ensure echo "" >> "$_target" + ensure echo "$_line" >> "$_target" + return 1 + fi + else + say_verbose "$_install_dir already on PATH" + fi + fi +} + +shotgun_install_dir_to_path() { + # Edit rcfiles ($HOME/.profile) to add install_dir to $PATH + # (Shotgun edition - write to all provided files that exist rather than just the first) + local _install_dir_expr="$1" + local _env_script_path="$2" + local _env_script_path_expr="$3" + local _rcfiles="$4" + local _shell="$5" + + if [ -n "${HOME:-}" ]; then + local _found=false + local _home + + for _rcfile_relative in $_rcfiles; do + _home="$(print_home_for_script "$_rcfile_relative")" + local _rcfile_abs="$_home/$_rcfile_relative" + + if [ -f "$_rcfile_abs" ]; then + _found=true + add_install_dir_to_path "$_install_dir_expr" "$_env_script_path" "$_env_script_path_expr" "$_rcfile_relative" "$_shell" + fi + done + + # Fall through to previous "create + write to first file in list" behavior + if [ "$_found" = false ]; then + add_install_dir_to_path "$_install_dir_expr" "$_env_script_path" "$_env_script_path_expr" "$_rcfiles" "$_shell" + fi + fi +} + +write_env_script_sh() { + # write this env script to the given path (this cat/EOF stuff is a "heredoc" string) + local _install_dir_expr="$1" + local _env_script_path="$2" + ensure cat < "$_env_script_path" +#!/bin/sh +# add binaries to PATH if they aren't added yet +# affix colons on either side of \$PATH to simplify matching +case ":\${PATH}:" in + *:"$_install_dir_expr":*) + ;; + *) + # Prepending path in case a system-installed binary needs to be overridden + export PATH="$_install_dir_expr:\$PATH" + ;; +esac +EOF +} + +write_env_script_fish() { + # write this env script to the given path (this cat/EOF stuff is a "heredoc" string) + local _install_dir_expr="$1" + local _env_script_path="$2" + ensure cat < "$_env_script_path" +if not contains "$_install_dir_expr" \$PATH + # Prepending path in case a system-installed binary needs to be overridden + set -x PATH "$_install_dir_expr" \$PATH +end +EOF +} + +check_proc() { + # Check for /proc by looking for the /proc/self/exe link + # This is only run on Linux + if ! test -L /proc/self/exe ; then + err "fatal: Unable to find /proc/self/exe. Is /proc mounted? Installation cannot proceed without /proc." + fi +} + +get_bitness() { + need_cmd head + # Architecture detection without dependencies beyond coreutils. + # ELF files start out "\x7fELF", and the following byte is + # 0x01 for 32-bit and + # 0x02 for 64-bit. + # The printf builtin on some shells like dash only supports octal + # escape sequences, so we use those. + local _current_exe_head + _current_exe_head=$(head -c 5 /proc/self/exe ) + if [ "$_current_exe_head" = "$(printf '\177ELF\001')" ]; then + echo 32 + elif [ "$_current_exe_head" = "$(printf '\177ELF\002')" ]; then + echo 64 + else + err "unknown platform bitness" + fi +} + +is_host_amd64_elf() { + need_cmd head + need_cmd tail + # ELF e_machine detection without dependencies beyond coreutils. + # Two-byte field at offset 0x12 indicates the CPU, + # but we're interested in it being 0x3E to indicate amd64, or not that. + local _current_exe_machine + _current_exe_machine=$(head -c 19 /proc/self/exe | tail -c 1) + [ "$_current_exe_machine" = "$(printf '\076')" ] +} + +get_endianness() { + local cputype=$1 + local suffix_eb=$2 + local suffix_el=$3 + + # detect endianness without od/hexdump, like get_bitness() does. + need_cmd head + need_cmd tail + + local _current_exe_endianness + _current_exe_endianness="$(head -c 6 /proc/self/exe | tail -c 1)" + if [ "$_current_exe_endianness" = "$(printf '\001')" ]; then + echo "${cputype}${suffix_el}" + elif [ "$_current_exe_endianness" = "$(printf '\002')" ]; then + echo "${cputype}${suffix_eb}" + else + err "unknown platform endianness" + fi +} + +get_architecture() { + local _ostype + local _cputype + _ostype="$(uname -s)" + _cputype="$(uname -m)" + local _clibtype="gnu" + local _local_glibc + + if [ "$_ostype" = Linux ]; then + if [ "$(uname -o)" = Android ]; then + _ostype=Android + fi + if ldd --version 2>&1 | grep -q 'musl'; then + _clibtype="musl-dynamic" + else + # Assume all other linuxes are glibc (even if wrong, static libc fallback will apply) + _clibtype="gnu" + fi + fi + + if [ "$_ostype" = Darwin ] && [ "$_cputype" = i386 ]; then + # Darwin `uname -m` lies + if sysctl hw.optional.x86_64 | grep -q ': 1'; then + _cputype=x86_64 + fi + fi + + if [ "$_ostype" = Darwin ] && [ "$_cputype" = x86_64 ]; then + # Rosetta on aarch64 + if [ "$(sysctl -n hw.optional.arm64 2>/dev/null)" = "1" ]; then + _cputype=aarch64 + fi + fi + + if [ "$_ostype" = SunOS ]; then + # Both Solaris and illumos presently announce as "SunOS" in "uname -s" + # so use "uname -o" to disambiguate. We use the full path to the + # system uname in case the user has coreutils uname first in PATH, + # which has historically sometimes printed the wrong value here. + if [ "$(/usr/bin/uname -o)" = illumos ]; then + _ostype=illumos + fi + + # illumos systems have multi-arch userlands, and "uname -m" reports the + # machine hardware name; e.g., "i86pc" on both 32- and 64-bit x86 + # systems. Check for the native (widest) instruction set on the + # running kernel: + if [ "$_cputype" = i86pc ]; then + _cputype="$(isainfo -n)" + fi + fi + + case "$_ostype" in + + Android) + _ostype=linux-android + ;; + + Linux) + check_proc + _ostype=unknown-linux-$_clibtype + _bitness=$(get_bitness) + ;; + + FreeBSD) + _ostype=unknown-freebsd + ;; + + NetBSD) + _ostype=unknown-netbsd + ;; + + DragonFly) + _ostype=unknown-dragonfly + ;; + + Darwin) + _ostype=apple-darwin + ;; + + illumos) + _ostype=unknown-illumos + ;; + + MINGW* | MSYS* | CYGWIN* | Windows_NT) + _ostype=pc-windows-gnu + ;; + + *) + err "unrecognized OS type: $_ostype" + ;; + + esac + + case "$_cputype" in + + i386 | i486 | i686 | i786 | x86) + _cputype=i686 + ;; + + xscale | arm) + _cputype=arm + if [ "$_ostype" = "linux-android" ]; then + _ostype=linux-androideabi + fi + ;; + + armv6l) + _cputype=arm + if [ "$_ostype" = "linux-android" ]; then + _ostype=linux-androideabi + else + _ostype="${_ostype}eabihf" + fi + ;; + + armv7l | armv8l) + _cputype=armv7 + if [ "$_ostype" = "linux-android" ]; then + _ostype=linux-androideabi + else + _ostype="${_ostype}eabihf" + fi + ;; + + aarch64 | arm64) + _cputype=aarch64 + ;; + + x86_64 | x86-64 | x64 | amd64) + _cputype=x86_64 + ;; + + mips) + _cputype=$(get_endianness mips '' el) + ;; + + mips64) + if [ "$_bitness" -eq 64 ]; then + # only n64 ABI is supported for now + _ostype="${_ostype}abi64" + _cputype=$(get_endianness mips64 '' el) + fi + ;; + + ppc) + _cputype=powerpc + ;; + + ppc64) + _cputype=powerpc64 + ;; + + ppc64le) + _cputype=powerpc64le + ;; + + s390x) + _cputype=s390x + ;; + riscv64) + _cputype=riscv64gc + ;; + loongarch64) + _cputype=loongarch64 + ;; + *) + err "unknown CPU type: $_cputype" + + esac + + # Detect 64-bit linux with 32-bit userland + if [ "${_ostype}" = unknown-linux-gnu ] && [ "${_bitness}" -eq 32 ]; then + case $_cputype in + x86_64) + # 32-bit executable for amd64 = x32 + if is_host_amd64_elf; then { + err "x32 linux unsupported" + }; else + _cputype=i686 + fi + ;; + mips64) + _cputype=$(get_endianness mips '' el) + ;; + powerpc64) + _cputype=powerpc + ;; + aarch64) + _cputype=armv7 + if [ "$_ostype" = "linux-android" ]; then + _ostype=linux-androideabi + else + _ostype="${_ostype}eabihf" + fi + ;; + riscv64gc) + err "riscv64 with 32-bit userland unsupported" + ;; + esac + fi + + # treat armv7 systems without neon as plain arm + if [ "$_ostype" = "unknown-linux-gnueabihf" ] && [ "$_cputype" = armv7 ]; then + if ensure grep '^Features' /proc/cpuinfo | grep -q -v neon; then + # At least one processor does not have NEON. + _cputype=arm + fi + fi + + _arch="${_cputype}-${_ostype}" + + RETVAL="$_arch" +} + +say() { + if [ "0" = "$PRINT_QUIET" ]; then + echo "$1" + fi +} + +say_verbose() { + if [ "1" = "$PRINT_VERBOSE" ]; then + echo "$1" + fi +} + +err() { + if [ "0" = "$PRINT_QUIET" ]; then + local red + local reset + red=$(tput setaf 1 2>/dev/null || echo '') + reset=$(tput sgr0 2>/dev/null || echo '') + say "${red}ERROR${reset}: $1" >&2 + fi + exit 1 +} + +need_cmd() { + if ! check_cmd "$1" + then err "need '$1' (command not found)" + fi +} + +check_cmd() { + command -v "$1" > /dev/null 2>&1 + return $? +} + +assert_nz() { + if [ -z "$1" ]; then err "assert_nz $2"; fi +} + +# Run a command that should never fail. If the command fails execution +# will immediately terminate with an error showing the failing +# command. +ensure() { + if ! "$@"; then err "command failed: $*"; fi +} + +# This is just for indicating that commands' results are being +# intentionally ignored. Usually, because it's being executed +# as part of error handling. +ignore() { + "$@" +} + +# This wraps curl or wget. Try curl first, if not installed, +# use wget instead. +downloader() { + if check_cmd curl + then _dld=curl + elif check_cmd wget + then _dld=wget + else _dld='curl or wget' # to be used in error message of need_cmd + fi + + if [ "$1" = --check ] + then need_cmd "$_dld" + elif [ "$_dld" = curl ] + then curl -sSfL "$1" -o "$2" + elif [ "$_dld" = wget ] + then wget "$1" -O "$2" + else err "Unknown downloader" # should not reach here + fi +} + +verify_checksum() { + local _file="$1" + local _checksum_style="$2" + local _checksum_value="$3" + local _calculated_checksum + + if [ -z "$_checksum_value" ]; then + return 0 + fi + case "$_checksum_style" in + sha256) + if ! check_cmd sha256sum; then + say "skipping sha256 checksum verification (it requires the 'sha256sum' command)" + return 0 + fi + _calculated_checksum="$(sha256sum -b "$_file" | awk '{printf $1}')" + ;; + sha512) + if ! check_cmd sha512sum; then + say "skipping sha512 checksum verification (it requires the 'sha512sum' command)" + return 0 + fi + _calculated_checksum="$(sha512sum -b "$_file" | awk '{printf $1}')" + ;; + sha3-256) + if ! check_cmd openssl; then + say "skipping sha3-256 checksum verification (it requires the 'openssl' command)" + return 0 + fi + _calculated_checksum="$(openssl dgst -sha3-256 "$_file" | awk '{printf $NF}')" + ;; + sha3-512) + if ! check_cmd openssl; then + say "skipping sha3-512 checksum verification (it requires the 'openssl' command)" + return 0 + fi + _calculated_checksum="$(openssl dgst -sha3-512 "$_file" | awk '{printf $NF}')" + ;; + blake2s) + if ! check_cmd b2sum; then + say "skipping blake2s checksum verification (it requires the 'b2sum' command)" + return 0 + fi + # Test if we have official b2sum with blake2s support + local _well_known_blake2s_checksum="93314a61f470985a40f8da62df10ba0546dc5216e1d45847bf1dbaa42a0e97af" + local _test_blake2s + _test_blake2s="$(printf "can do blake2s" | b2sum -a blake2s | awk '{printf $1}')" || _test_blake2s="" + + if [ "X$_test_blake2s" = "X$_well_known_blake2s_checksum" ]; then + _calculated_checksum="$(b2sum -a blake2s "$_file" | awk '{printf $1}')" || _calculated_checksum="" + else + say "skipping blake2s checksum verification (installed b2sum doesn't support blake2s)" + return 0 + fi + ;; + blake2b) + if ! check_cmd b2sum; then + say "skipping blake2b checksum verification (it requires the 'b2sum' command)" + return 0 + fi + _calculated_checksum="$(b2sum "$_file" | awk '{printf $1}')" + ;; + false) + ;; + *) + say "skipping unknown checksum style: $_checksum_style" + return 0 + ;; + esac + + if [ "$_calculated_checksum" != "$_checksum_value" ]; then + err "checksum mismatch + want: $_checksum_value + got: $_calculated_checksum" + fi +} + +download_binary_and_run_installer "$@" || exit 1 + +================ axolotlsay-installer.ps1 ================ +# Licensed under the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +<# +.SYNOPSIS + +The installer for axolotlsay 0.2.2 + +.DESCRIPTION + +This script detects what platform you're on and fetches an appropriate archive from +https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2 +then unpacks the binaries and installs them to + + $env:CARGO_HOME/bin (or $HOME/.cargo/bin) + +It will then add that dir to PATH by editing your Environment.Path registry key + +.PARAMETER ArtifactDownloadUrl +The URL of the directory where artifacts can be fetched from + +.PARAMETER NoModifyPath +Don't add the install directory to PATH + +.PARAMETER Help +Print help + +#> + +param ( + [Parameter(HelpMessage = "The URL of the directory where artifacts can be fetched from")] + [string]$ArtifactDownloadUrl = 'https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2', + [Parameter(HelpMessage = "Don't add the install directory to PATH")] + [switch]$NoModifyPath, + [Parameter(HelpMessage = "Print Help")] + [switch]$Help +) + +$app_name = 'axolotlsay' +$app_version = '0.2.2' +if ($env:AXOLOTLSAY_INSTALLER_GHE_BASE_URL) { + $installer_base_url = $env:AXOLOTLSAY_INSTALLER_GHE_BASE_URL +} elseif ($env:AXOLOTLSAY_INSTALLER_GITHUB_BASE_URL) { + $installer_base_url = $env:AXOLOTLSAY_INSTALLER_GITHUB_BASE_URL +} else { + $installer_base_url = "https://github.com" +} +if ($env:INSTALLER_DOWNLOAD_URL) { + $ArtifactDownloadUrl = $env:INSTALLER_DOWNLOAD_URL +} else { + $ArtifactDownloadUrl = "$installer_base_url/axodotdev/axolotlsay/releases/download/v0.2.2" +} + +$receipt = @" +{"binaries":["CARGO_DIST_BINS"],"binary_aliases":{},"cdylibs":["CARGO_DIST_DYLIBS"],"cstaticlibs":["CARGO_DIST_STATICLIBS"],"install_layout":"unspecified","install_prefix":"AXO_INSTALL_PREFIX","modify_path":true,"provider":{"source":"cargo-dist","version":"CENSORED"},"source":{"app_name":"axolotlsay","name":"axolotlsay","owner":"axodotdev","release_type":"github"},"version":"CENSORED"} +"@ +$receipt_home = "${env:LOCALAPPDATA}\axolotlsay" + +if ($env:AXOLOTLSAY_DISABLE_UPDATE) { + $install_updater = $false +} else { + $install_updater = $true +} + +if ($NoModifyPath) { + Write-Information "-NoModifyPath has been deprecated; please set AXOLOTLSAY_NO_MODIFY_PATH=1 in the environment" +} + +if ($env:AXOLOTLSAY_NO_MODIFY_PATH) { + $NoModifyPath = $true +} + +$unmanaged_install = $env:AXOLOTLSAY_UNMANAGED_INSTALL + +if ($unmanaged_install) { + $NoModifyPath = $true + $install_updater = $false +} + +function Install-Binary($install_args) { + if ($Help) { + Get-Help $PSCommandPath -Detailed + Exit + } + + Initialize-Environment + + # Platform info injected by dist + $platforms = @{ + "aarch64-pc-windows-msvc" = @{ + "artifact_name" = "axolotlsay-aarch64-pc-windows-msvc.tar.gz" + "bins" = @("axolotlsay.exe") + "libs" = @() + "staticlibs" = @() + "zip_ext" = ".tar.gz" + "aliases" = @{ + } + "aliases_json" = '{}' + } + "x86_64-pc-windows-msvc" = @{ + "artifact_name" = "axolotlsay-x86_64-pc-windows-msvc.tar.gz" + "bins" = @("axolotlsay.exe") + "libs" = @() + "staticlibs" = @() + "zip_ext" = ".tar.gz" + "aliases" = @{ + } + "aliases_json" = '{}' + } + } + + $fetched = Download "$ArtifactDownloadUrl" $platforms + # FIXME: add a flag that lets the user not do this step + try { + Invoke-Installer -artifacts $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } +} + +function Get-TargetTriple() { + try { + # NOTE: this might return X64 on ARM64 Windows, which is OK since emulation is available. + # It works correctly starting in PowerShell Core 7.3 and Windows PowerShell in Win 11 22H2. + # Ideally this would just be + # [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture + # but that gets a type from the wrong assembly on Windows PowerShell (i.e. not Core) + $a = [System.Reflection.Assembly]::LoadWithPartialName("System.Runtime.InteropServices.RuntimeInformation") + $t = $a.GetType("System.Runtime.InteropServices.RuntimeInformation") + $p = $t.GetProperty("OSArchitecture") + # Possible OSArchitecture Values: https://learn.microsoft.com/dotnet/api/system.runtime.interopservices.architecture + # Rust supported platforms: https://doc.rust-lang.org/stable/rustc/platform-support.html + switch ($p.GetValue($null).ToString()) + { + "X86" { return "i686-pc-windows-msvc" } + "X64" { return "x86_64-pc-windows-msvc" } + "Arm" { return "thumbv7a-pc-windows-msvc" } + "Arm64" { return "aarch64-pc-windows-msvc" } + } + } catch { + # The above was added in .NET 4.7.1, so Windows PowerShell in versions of Windows + # prior to Windows 10 v1709 may not have this API. + Write-Verbose "Get-TargetTriple: Exception when trying to determine OS architecture." + Write-Verbose $_ + } + + # This is available in .NET 4.0. We already checked for PS 5, which requires .NET 4.5. + Write-Verbose("Get-TargetTriple: falling back to Is64BitOperatingSystem.") + if ([System.Environment]::Is64BitOperatingSystem) { + return "x86_64-pc-windows-msvc" + } else { + return "i686-pc-windows-msvc" + } +} + +function Download($download_url, $platforms) { + $arch = Get-TargetTriple + + if (-not $platforms.ContainsKey($arch)) { + $platforms_json = ConvertTo-Json $platforms + throw "ERROR: could not find binaries for this platform. Last platform tried: $arch platform info: $platforms_json" + } + + # Lookup what we expect this platform to look like + $info = $platforms[$arch] + $zip_ext = $info["zip_ext"] + $bin_names = $info["bins"] + $lib_names = $info["libs"] + $staticlib_names = $info["staticlibs"] + $artifact_name = $info["artifact_name"] + + # Make a new temp dir to unpack things to + $tmp = New-Temp-Dir + $dir_path = "$tmp\$app_name$zip_ext" + + # Download and unpack! + $url = "$download_url/$artifact_name" + Write-Information "Downloading $app_name $app_version ($arch)" + Write-Verbose " from $url" + Write-Verbose " to $dir_path" + $wc = New-Object Net.Webclient + $wc.downloadFile($url, $dir_path) + + Write-Verbose "Unpacking to $tmp" + + # Select the tool to unpack the files with. + # + # As of windows 10(?), powershell comes with tar preinstalled, but in practice + # it only seems to support .tar.gz, and not xz/zstd. Still, we should try to + # forward all tars to it in case the user has a machine that can handle it! + switch -Wildcard ($zip_ext) { + ".zip" { + Expand-Archive -Path $dir_path -DestinationPath "$tmp"; + Break + } + ".tar.*" { + tar xf $dir_path --strip-components 1 -C "$tmp"; + Break + } + Default { + throw "ERROR: unknown archive format $zip_ext" + } + } + + # Let the next step know what to copy + $bin_paths = @() + foreach ($bin_name in $bin_names) { + Write-Verbose " Unpacked $bin_name" + $bin_paths += "$tmp\$bin_name" + } + $lib_paths = @() + foreach ($lib_name in $lib_names) { + Write-Verbose " Unpacked $lib_name" + $lib_paths += "$tmp\$lib_name" + } + $staticlib_paths = @() + foreach ($lib_name in $staticlib_names) { + Write-Verbose " Unpacked $lib_name" + $staticlib_paths += "$tmp\$lib_name" + } + + if (($null -ne $info["updater"]) -and $install_updater) { + $updater_id = $info["updater"]["artifact_name"] + $updater_url = "$download_url/$updater_id" + $out_name = "$tmp\axolotlsay-update.exe" + + $wc.downloadFile($updater_url, $out_name) + $bin_paths += $out_name + } + + return @{ + "bin_paths" = $bin_paths + "lib_paths" = $lib_paths + "staticlib_paths" = $staticlib_paths + } +} + +function Invoke-Installer($artifacts, $platforms) { + # Replaces the placeholder binary entry with the actual list of binaries + $arch = Get-TargetTriple + + if (-not $platforms.ContainsKey($arch)) { + $platforms_json = ConvertTo-Json $platforms + throw "ERROR: could not find binaries for this platform. Last platform tried: $arch platform info: $platforms_json" + } + + $info = $platforms[$arch] + + # Forces the install to occur at this path, not the default + $force_install_dir = $null + $install_layout = "unspecified" + # Check the newer app-specific variable before falling back + # to the older generic one + if (($env:AXOLOTLSAY_INSTALL_DIR)) { + $force_install_dir = $env:AXOLOTLSAY_INSTALL_DIR + $install_layout = "cargo-home" + } elseif (($env:CARGO_DIST_FORCE_INSTALL_DIR)) { + $force_install_dir = $env:CARGO_DIST_FORCE_INSTALL_DIR + $install_layout = "cargo-home" + } elseif ($unmanaged_install) { + $force_install_dir = $unmanaged_install + $install_layout = "flat" + } + + # Check if the install layout should be changed from `flat` to `cargo-home` + # for backwards compatible updates of applications that switched layouts. + if (($force_install_dir) -and ($install_layout -eq "flat")) { + # If the install directory is targeting the Cargo home directory, then + # we assume this application was previously installed that layout + # Note the installer passes the path with `\\` separators, but here they are + # `\` so we normalize for comparison. We don't use `Resolve-Path` because they + # may not exist. + $cargo_home = if ($env:CARGO_HOME) { $env:CARGO_HOME } else { + Join-Path $(if ($env:HOME) { $env:HOME } else { "" }) ".cargo" + } + if ($force_install_dir.Replace('\\', '\') -eq $cargo_home) { + $install_layout = "cargo-home" + } + } + + # The actual path we're going to install to + $dest_dir = $null + $dest_dir_lib = $null + # The install prefix we write to the receipt. + # For organized install methods like CargoHome, which have + # subdirectories, this is the root without `/bin`. For other + # methods, this is the same as `_install_dir`. + $receipt_dest_dir = $null + # Before actually consulting the configured install strategy, see + # if we're overriding it. + if (($force_install_dir)) { + switch ($install_layout) { + "hierarchical" { + $dest_dir = Join-Path $force_install_dir "bin" + $dest_dir_lib = Join-Path $force_install_dir "lib" + } + "cargo-home" { + $dest_dir = Join-Path $force_install_dir "bin" + $dest_dir_lib = $dest_dir + } + "flat" { + $dest_dir = $force_install_dir + $dest_dir_lib = $dest_dir + } + Default { + throw "Error: unrecognized installation layout: $install_layout" + } + } + $receipt_dest_dir = $force_install_dir + } + if (-Not $dest_dir) { + # first try $env:CARGO_HOME, then fallback to $HOME + # (for whatever reason $HOME is not a normal env var and doesn't need the $env: prefix) + $root = if (($base_dir = $env:CARGO_HOME)) { + $base_dir + } elseif (($base_dir = $HOME)) { + Join-Path $base_dir ".cargo" + } else { + throw "ERROR: could not find your HOME dir or CARGO_HOME to install binaries to" + } + + $dest_dir = Join-Path $root "bin" + $dest_dir_lib = $dest_dir + $receipt_dest_dir = $root + $install_layout = "cargo-home" + } + + # Looks like all of the above assignments failed + if (-Not $dest_dir) { + throw "ERROR: could not find a valid path to install to; please check the installation instructions" + } + + # The replace call here ensures proper escaping is inlined into the receipt + $receipt = $receipt.Replace('AXO_INSTALL_PREFIX', $receipt_dest_dir.replace("\", "\\")) + $receipt = $receipt.Replace('"install_layout":"unspecified"', -join('"install_layout":"', $install_layout, '"')) + + $dest_dir = New-Item -Force -ItemType Directory -Path $dest_dir + $dest_dir_lib = New-Item -Force -ItemType Directory -Path $dest_dir_lib + Write-Information "Installing to $dest_dir" + # Just copy the binaries from the temp location to the install dir + foreach ($bin_path in $artifacts["bin_paths"]) { + $installed_file = Split-Path -Path "$bin_path" -Leaf + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop + Write-Information " $installed_file" + + if (($dests = $info["aliases"][$installed_file])) { + $source = Join-Path "$dest_dir" "$installed_file" + foreach ($dest_name in $dests) { + $dest = Join-Path $dest_dir $dest_name + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop + } + } + } + foreach ($lib_path in $artifacts["lib_paths"]) { + $installed_file = Split-Path -Path "$lib_path" -Leaf + Copy-Item "$lib_path" -Destination "$dest_dir_lib" -ErrorAction Stop + Remove-Item "$lib_path" -Recurse -Force -ErrorAction Stop + Write-Information " $installed_file" + } + foreach ($lib_path in $artifacts["staticlib_paths"]) { + $installed_file = Split-Path -Path "$lib_path" -Leaf + Copy-Item "$lib_path" -Destination "$dest_dir_lib" -ErrorAction Stop + Remove-Item "$lib_path" -Recurse -Force -ErrorAction Stop + Write-Information " $installed_file" + } + + $formatted_bins = ($info["bins"] | ForEach-Object { '"' + $_ + '"' }) -join "," + $receipt = $receipt.Replace('"CARGO_DIST_BINS"', $formatted_bins) + $formatted_libs = ($info["libs"] | ForEach-Object { '"' + $_ + '"' }) -join "," + $receipt = $receipt.Replace('"CARGO_DIST_DYLIBS"', $formatted_libs) + $formatted_staticlibs = ($info["staticlibs"] | ForEach-Object { '"' + $_ + '"' }) -join "," + $receipt = $receipt.Replace('"CARGO_DIST_STATICLIBS"', $formatted_staticlibs) + # Also replace the aliases with the arch-specific one + $receipt = $receipt.Replace('"binary_aliases":{}', -join('"binary_aliases":', $info['aliases_json'])) + if ($NoModifyPath) { + $receipt = $receipt.Replace('"modify_path":true', '"modify_path":false') + } + + # Write the install receipt + if ($install_updater) { + $null = New-Item -Path $receipt_home -ItemType "directory" -ErrorAction SilentlyContinue + # Trying to get Powershell 5.1 (not 6+, which is fake and lies) to write utf8 is a crime + # because "Out-File -Encoding utf8" actually still means utf8BOM, so we need to pull out + # .NET's APIs which actually do what you tell them (also apparently utf8NoBOM is the + # default in newer .NETs but I'd rather not rely on that at this point). + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [IO.File]::WriteAllLines("$receipt_home/axolotlsay-receipt.json", "$receipt", $Utf8NoBomEncoding) + } + + # Respect the environment, but CLI takes precedence + if ($null -eq $NoModifyPath) { + $NoModifyPath = $env:INSTALLER_NO_MODIFY_PATH + } + + Write-Information "everything's installed!" + if (-not $NoModifyPath) { + Add-Ci-Path $dest_dir + if (Add-Path $dest_dir) { + Write-Information "" + Write-Information "To add $dest_dir to your PATH, either restart your system or run:" + Write-Information "" + Write-Information " set Path=$dest_dir;%Path% (cmd)" + Write-Information " `$env:Path = `"$dest_dir;`$env:Path`" (powershell)" + } + } +} + +# Attempt to do CI-specific rituals to get the install-dir on PATH faster +function Add-Ci-Path($OrigPathToAdd) { + # If GITHUB_PATH is present, then write install_dir to the file it refs. + # After each GitHub Action, the contents will be added to PATH. + # So if you put a curl | sh for this script in its own "run" step, + # the next step will have this dir on PATH. + # + # Note that GITHUB_PATH will not resolve any variables, so we in fact + # want to write the install dir and not an expression that evals to it + if (($gh_path = $env:GITHUB_PATH)) { + Write-Output "$OrigPathToAdd" | Out-File -FilePath "$gh_path" -Encoding utf8 -Append + } +} + +# Try to add the given path to PATH via the registry +# +# Returns true if the registry was modified, otherwise returns false +# (indicating it was already on PATH) +function Add-Path($OrigPathToAdd) { + Write-Verbose "Adding $OrigPathToAdd to your PATH" + $RegistryPath = "HKCU:\Environment" + $PropertyName = "Path" + $PathToAdd = $OrigPathToAdd + + $Item = if (Test-Path $RegistryPath) { + # If the registry key exists, get it + Get-Item -Path $RegistryPath + } else { + # If the registry key doesn't exist, create it + Write-Verbose "Creating $RegistryPath" + New-Item -Path $RegistryPath -Force + } + + $OldPath = "" + try { + # Try to get the old PATH value. If that fails, assume we're making it from scratch. + # Otherwise assume there's already paths in here and use a ; separator + $OldPath = $Item | Get-ItemPropertyValue -Name $PropertyName + $PathToAdd = "$PathToAdd;" + } catch { + # We'll be creating the PATH from scratch + Write-Verbose "No $PropertyName Property exists on $RegistryPath (we'll make one)" + } + + # Check if the path is already there + # + # We don't want to incorrectly match "C:\blah\" to "C:\blah\blah\", so we include the semicolon + # delimiters when searching, ensuring exact matches. To avoid corner cases we add semicolons to + # both sides of the input, allowing us to pretend we're always in the middle of a list. + Write-Verbose "Old $PropertyName Property is $OldPath" + if (";$OldPath;" -like "*;$OrigPathToAdd;*") { + # Already on path, nothing to do + Write-Verbose "install dir already on PATH, all done!" + return $false + } else { + # Actually update PATH + Write-Verbose "Actually mutating $PropertyName Property" + $NewPath = $PathToAdd + $OldPath + # We use -Force here to make the value already existing not be an error + $Item | New-ItemProperty -Name $PropertyName -Value $NewPath -PropertyType String -Force | Out-Null + return $true + } +} + +function Initialize-Environment() { + If (($PSVersionTable.PSVersion.Major) -lt 5) { + throw @" +Error: PowerShell 5 or later is required to install $app_name. +Upgrade PowerShell: + + https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell + +"@ + } + + # show notification to change execution policy: + $allowedExecutionPolicy = @('Unrestricted', 'RemoteSigned', 'ByPass') + If ((Get-ExecutionPolicy).ToString() -notin $allowedExecutionPolicy) { + throw @" +Error: PowerShell requires an execution policy in [$($allowedExecutionPolicy -join ", ")] to run $app_name. For example, to set the execution policy to 'RemoteSigned' please run: + + Set-ExecutionPolicy RemoteSigned -scope CurrentUser + +"@ + } + + # GitHub requires TLS 1.2 + If ([System.Enum]::GetNames([System.Net.SecurityProtocolType]) -notcontains 'Tls12') { + throw @" +Error: Installing $app_name requires at least .NET Framework 4.5 +Please download and install it first: + + https://www.microsoft.com/net/download + +"@ + } +} + +function New-Temp-Dir() { + [CmdletBinding(SupportsShouldProcess)] + param() + $parent = [System.IO.Path]::GetTempPath() + [string] $name = [System.Guid]::NewGuid() + New-Item -ItemType Directory -Path (Join-Path $parent $name) +} + +# PSScriptAnalyzer doesn't like how we use our params as globals, this calms it +$Null = $ArtifactDownloadUrl, $NoModifyPath, $Help +# Make Write-Information statements be visible +$InformationPreference = "Continue" + +# The default interactive handler +try { + Install-Binary "$Args" +} catch { + Write-Information $_ + exit 1 +} + +================ sha256.sum ================ +CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.gz + + +================ dist-manifest.json ================ +{ + "dist_version": "CENSORED", + "announcement_tag": "v0.2.2", + "announcement_tag_is_implicit": true, + "announcement_is_prerelease": false, + "announcement_title": "Version 0.2.2", + "announcement_changelog": "```text\n +----------------------------------+\n | now with arm64 linux binaries!!! |\n +----------------------------------+\n /\n≽(◕ ᴗ ◕)≼\n```", + "announcement_github_body": "## Release Notes\n\n```text\n +----------------------------------+\n | now with arm64 linux binaries!!! |\n +----------------------------------+\n /\n≽(◕ ᴗ ◕)≼\n```\n\n## Install axolotlsay 0.2.2\n\n### Install prebuilt binaries via shell script\n\n```sh\ncurl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-installer.sh | sh\n```\n\n### Install prebuilt binaries via powershell script\n\n```sh\npowershell -ExecutionPolicy ByPass -c \"irm https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-installer.ps1 | iex\"\n```\n\n## Download axolotlsay 0.2.2\n\n| File | Platform | Checksum |\n|--------|----------|----------|\n| [axolotlsay-aarch64-apple-darwin.tar.gz](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-aarch64-apple-darwin.tar.gz) | Apple Silicon macOS | [checksum](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-aarch64-apple-darwin.tar.gz.sha256) |\n| [axolotlsay-x86_64-apple-darwin.tar.gz](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-x86_64-apple-darwin.tar.gz) | Intel macOS | [checksum](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-x86_64-apple-darwin.tar.gz.sha256) |\n| [axolotlsay-aarch64-pc-windows-msvc.tar.gz](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-aarch64-pc-windows-msvc.tar.gz) | ARM64 Windows | [checksum](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-aarch64-pc-windows-msvc.tar.gz.sha256) |\n| [axolotlsay-x86_64-pc-windows-msvc.tar.gz](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-x86_64-pc-windows-msvc.tar.gz) | x64 Windows | [checksum](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-x86_64-pc-windows-msvc.tar.gz.sha256) |\n| [axolotlsay-aarch64-unknown-linux-gnu.tar.gz](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-aarch64-unknown-linux-gnu.tar.gz) | ARM64 Linux | [checksum](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-aarch64-unknown-linux-gnu.tar.gz.sha256) |\n| [axolotlsay-x86_64-unknown-linux-gnu.tar.gz](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-x86_64-unknown-linux-gnu.tar.gz) | x64 Linux | [checksum](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-x86_64-unknown-linux-gnu.tar.gz.sha256) |\n\n", + "releases": [ + { + "app_name": "axolotlsay", + "app_version": "0.2.2", + "env": { + "install_dir_env_var": "AXOLOTLSAY_INSTALL_DIR", + "unmanaged_dir_env_var": "AXOLOTLSAY_UNMANAGED_INSTALL", + "disable_update_env_var": "AXOLOTLSAY_DISABLE_UPDATE", + "no_modify_path_env_var": "AXOLOTLSAY_NO_MODIFY_PATH", + "github_base_url_env_var": "AXOLOTLSAY_INSTALLER_GITHUB_BASE_URL", + "ghe_base_url_env_var": "AXOLOTLSAY_INSTALLER_GHE_BASE_URL" + }, + "display_name": "axolotlsay", + "display": true, + "artifacts": [ + "source.tar.gz", + "source.tar.gz.sha256", + "axolotlsay-installer.sh", + "axolotlsay-installer.ps1", + "sha256.sum", + "axolotlsay-aarch64-apple-darwin.tar.gz", + "axolotlsay-aarch64-apple-darwin.tar.gz.sha256", + "axolotlsay-aarch64-pc-windows-msvc.tar.gz", + "axolotlsay-aarch64-pc-windows-msvc.tar.gz.sha256", + "axolotlsay-aarch64-unknown-linux-gnu.tar.gz", + "axolotlsay-aarch64-unknown-linux-gnu.tar.gz.sha256", + "axolotlsay-x86_64-apple-darwin.tar.gz", + "axolotlsay-x86_64-apple-darwin.tar.gz.sha256", + "axolotlsay-x86_64-pc-windows-msvc.tar.gz", + "axolotlsay-x86_64-pc-windows-msvc.tar.gz.sha256", + "axolotlsay-x86_64-unknown-linux-gnu.tar.gz", + "axolotlsay-x86_64-unknown-linux-gnu.tar.gz.sha256" + ], + "hosting": { + "github": { + "artifact_base_url": "https://github.com", + "artifact_download_path": "/axodotdev/axolotlsay/releases/download/v0.2.2", + "owner": "axodotdev", + "repo": "axolotlsay" + } + } + } + ], + "artifacts": { + "axolotlsay-aarch64-apple-darwin.tar.gz": { + "name": "axolotlsay-aarch64-apple-darwin.tar.gz", + "kind": "executable-zip", + "target_triples": [ + "aarch64-apple-darwin" + ], + "assets": [ + { + "name": "CHANGELOG.md", + "path": "CHANGELOG.md", + "kind": "changelog" + }, + { + "name": "LICENSE-APACHE", + "path": "LICENSE-APACHE", + "kind": "license" + }, + { + "name": "LICENSE-MIT", + "path": "LICENSE-MIT", + "kind": "license" + }, + { + "name": "README.md", + "path": "README.md", + "kind": "readme" + }, + { + "id": "axolotlsay-aarch64-apple-darwin-exe-axolotlsay", + "name": "axolotlsay", + "path": "axolotlsay", + "kind": "executable" + } + ], + "checksum": "axolotlsay-aarch64-apple-darwin.tar.gz.sha256" + }, + "axolotlsay-aarch64-apple-darwin.tar.gz.sha256": { + "name": "axolotlsay-aarch64-apple-darwin.tar.gz.sha256", + "kind": "checksum", + "target_triples": [ + "aarch64-apple-darwin" + ] + }, + "axolotlsay-aarch64-pc-windows-msvc.tar.gz": { + "name": "axolotlsay-aarch64-pc-windows-msvc.tar.gz", + "kind": "executable-zip", + "target_triples": [ + "aarch64-pc-windows-msvc" + ], + "assets": [ + { + "name": "CHANGELOG.md", + "path": "CHANGELOG.md", + "kind": "changelog" + }, + { + "name": "LICENSE-APACHE", + "path": "LICENSE-APACHE", + "kind": "license" + }, + { + "name": "LICENSE-MIT", + "path": "LICENSE-MIT", + "kind": "license" + }, + { + "name": "README.md", + "path": "README.md", + "kind": "readme" + }, + { + "id": "axolotlsay-aarch64-pc-windows-msvc-exe-axolotlsay", + "name": "axolotlsay", + "path": "axolotlsay.exe", + "kind": "executable" + } + ], + "checksum": "axolotlsay-aarch64-pc-windows-msvc.tar.gz.sha256" + }, + "axolotlsay-aarch64-pc-windows-msvc.tar.gz.sha256": { + "name": "axolotlsay-aarch64-pc-windows-msvc.tar.gz.sha256", + "kind": "checksum", + "target_triples": [ + "aarch64-pc-windows-msvc" + ] + }, + "axolotlsay-aarch64-unknown-linux-gnu.tar.gz": { + "name": "axolotlsay-aarch64-unknown-linux-gnu.tar.gz", + "kind": "executable-zip", + "target_triples": [ + "aarch64-unknown-linux-gnu" + ], + "assets": [ + { + "name": "CHANGELOG.md", + "path": "CHANGELOG.md", + "kind": "changelog" + }, + { + "name": "LICENSE-APACHE", + "path": "LICENSE-APACHE", + "kind": "license" + }, + { + "name": "LICENSE-MIT", + "path": "LICENSE-MIT", + "kind": "license" + }, + { + "name": "README.md", + "path": "README.md", + "kind": "readme" + }, + { + "id": "axolotlsay-aarch64-unknown-linux-gnu-exe-axolotlsay", + "name": "axolotlsay", + "path": "axolotlsay", + "kind": "executable" + } + ], + "checksum": "axolotlsay-aarch64-unknown-linux-gnu.tar.gz.sha256" + }, + "axolotlsay-aarch64-unknown-linux-gnu.tar.gz.sha256": { + "name": "axolotlsay-aarch64-unknown-linux-gnu.tar.gz.sha256", + "kind": "checksum", + "target_triples": [ + "aarch64-unknown-linux-gnu" + ] + }, + "axolotlsay-installer.ps1": { + "name": "axolotlsay-installer.ps1", + "kind": "installer", + "target_triples": [ + "aarch64-pc-windows-msvc", + "x86_64-pc-windows-msvc" + ], + "install_hint": "powershell -ExecutionPolicy ByPass -c \"irm https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-installer.ps1 | iex\"", + "description": "Install prebuilt binaries via powershell script" + }, + "axolotlsay-installer.sh": { + "name": "axolotlsay-installer.sh", + "kind": "installer", + "target_triples": [ + "aarch64-apple-darwin", + "aarch64-pc-windows-gnu", + "aarch64-unknown-linux-gnu", + "x86_64-apple-darwin", + "x86_64-pc-windows-gnu", + "x86_64-unknown-linux-gnu" + ], + "install_hint": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-installer.sh | sh", + "description": "Install prebuilt binaries via shell script" + }, + "axolotlsay-x86_64-apple-darwin.tar.gz": { + "name": "axolotlsay-x86_64-apple-darwin.tar.gz", + "kind": "executable-zip", + "target_triples": [ + "x86_64-apple-darwin" + ], + "assets": [ + { + "name": "CHANGELOG.md", + "path": "CHANGELOG.md", + "kind": "changelog" + }, + { + "name": "LICENSE-APACHE", + "path": "LICENSE-APACHE", + "kind": "license" + }, + { + "name": "LICENSE-MIT", + "path": "LICENSE-MIT", + "kind": "license" + }, + { + "name": "README.md", + "path": "README.md", + "kind": "readme" + }, + { + "id": "axolotlsay-x86_64-apple-darwin-exe-axolotlsay", + "name": "axolotlsay", + "path": "axolotlsay", + "kind": "executable" + } + ], + "checksum": "axolotlsay-x86_64-apple-darwin.tar.gz.sha256" + }, + "axolotlsay-x86_64-apple-darwin.tar.gz.sha256": { + "name": "axolotlsay-x86_64-apple-darwin.tar.gz.sha256", + "kind": "checksum", + "target_triples": [ + "x86_64-apple-darwin" + ] + }, + "axolotlsay-x86_64-pc-windows-msvc.tar.gz": { + "name": "axolotlsay-x86_64-pc-windows-msvc.tar.gz", + "kind": "executable-zip", + "target_triples": [ + "x86_64-pc-windows-msvc" + ], + "assets": [ + { + "name": "CHANGELOG.md", + "path": "CHANGELOG.md", + "kind": "changelog" + }, + { + "name": "LICENSE-APACHE", + "path": "LICENSE-APACHE", + "kind": "license" + }, + { + "name": "LICENSE-MIT", + "path": "LICENSE-MIT", + "kind": "license" + }, + { + "name": "README.md", + "path": "README.md", + "kind": "readme" + }, + { + "id": "axolotlsay-x86_64-pc-windows-msvc-exe-axolotlsay", + "name": "axolotlsay", + "path": "axolotlsay.exe", + "kind": "executable" + } + ], + "checksum": "axolotlsay-x86_64-pc-windows-msvc.tar.gz.sha256" + }, + "axolotlsay-x86_64-pc-windows-msvc.tar.gz.sha256": { + "name": "axolotlsay-x86_64-pc-windows-msvc.tar.gz.sha256", + "kind": "checksum", + "target_triples": [ + "x86_64-pc-windows-msvc" + ] + }, + "axolotlsay-x86_64-unknown-linux-gnu.tar.gz": { + "name": "axolotlsay-x86_64-unknown-linux-gnu.tar.gz", + "kind": "executable-zip", + "target_triples": [ + "x86_64-unknown-linux-gnu" + ], + "assets": [ + { + "name": "CHANGELOG.md", + "path": "CHANGELOG.md", + "kind": "changelog" + }, + { + "name": "LICENSE-APACHE", + "path": "LICENSE-APACHE", + "kind": "license" + }, + { + "name": "LICENSE-MIT", + "path": "LICENSE-MIT", + "kind": "license" + }, + { + "name": "README.md", + "path": "README.md", + "kind": "readme" + }, + { + "id": "axolotlsay-x86_64-unknown-linux-gnu-exe-axolotlsay", + "name": "axolotlsay", + "path": "axolotlsay", + "kind": "executable" + } + ], + "checksum": "axolotlsay-x86_64-unknown-linux-gnu.tar.gz.sha256" + }, + "axolotlsay-x86_64-unknown-linux-gnu.tar.gz.sha256": { + "name": "axolotlsay-x86_64-unknown-linux-gnu.tar.gz.sha256", + "kind": "checksum", + "target_triples": [ + "x86_64-unknown-linux-gnu" + ] + }, + "sha256.sum": { + "name": "sha256.sum", + "kind": "unified-checksum" + }, + "source.tar.gz": { + "name": "source.tar.gz", + "kind": "source-tarball", + "checksum": "source.tar.gz.sha256" + }, + "source.tar.gz.sha256": { + "name": "source.tar.gz.sha256", + "kind": "checksum" + } + }, + "systems": { + "plan:all:": { + "id": "plan:all:", + "cargo_version_line": "CENSORED" + "build_environment": "indeterminate" + } + }, + "publish_prereleases": false, + "force_latest": false, + "ci": { + "github": { + "artifacts_matrix": { + "include": [ + { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", + "targets": [ + "aarch64-apple-darwin" + ], + "install_cargo_auditable": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" + }, + "cache_provider": "github" + }, + { + "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", + "container": { + "image": "messense/cargo-xwin", + "host": "x86_64-unknown-linux-musl" + }, + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-pc-windows-msvc", + "targets": [ + "aarch64-pc-windows-msvc" + ], + "install_cargo_auditable": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" + }, + "packages_install": "if ! command -v cargo-xwin > /dev/null 2>&1; then\n if ! command -v pip3 > /dev/null 2>&1; then\n dnf install --assumeyes python3-pip\n pip3 install --upgrade pip\n fi\n pip3 install cargo-xwin\nfi", + "cache_provider": "github" + }, + { + "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-unknown-linux-gnu", + "targets": [ + "aarch64-unknown-linux-gnu" + ], + "install_cargo_auditable": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" + }, + "packages_install": "if ! command -v cargo-zigbuild > /dev/null 2>&1; then\n if ! command -v pip3 > /dev/null 2>&1; then\n dnf install --assumeyes python3-pip\n pip3 install --upgrade pip\n fi\n pip3 install cargo-zigbuild\nfi", + "cache_provider": "github" + }, + { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", + "targets": [ + "x86_64-apple-darwin" + ], + "install_cargo_auditable": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" + }, + "cache_provider": "github" + }, + { + "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", + "container": { + "image": "messense/cargo-xwin", + "host": "x86_64-unknown-linux-musl" + }, + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], + "install_cargo_auditable": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" + }, + "packages_install": "if ! command -v cargo-xwin > /dev/null 2>&1; then\n if ! command -v pip3 > /dev/null 2>&1; then\n dnf install --assumeyes python3-pip\n pip3 install --upgrade pip\n fi\n pip3 install cargo-xwin\nfi", + "cache_provider": "github" + }, + { + "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], + "install_cargo_auditable": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" + }, + "cache_provider": "github" + } + ] + }, + "pr_run_mode": "plan" + } + }, + "linkage": [], + "upload_files": [] +} + +================ release.yml ================ +# This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/ +# +# Copyright 2022-2024, axodotdev +# SPDX-License-Identifier: MIT or Apache-2.0 +# +# CI that: +# +# * checks for a Git Tag that looks like a release +# * builds artifacts with dist (archives, installers, hashes) +# * uploads those artifacts to temporary workflow zip +# * on success, uploads the artifacts to a GitHub Release +# +# Note that the GitHub Release will be created with a generated +# title/body based on your changelogs. + +name: Release +permissions: + "contents": "write" + +# This task will run whenever you push a git tag that looks like a version +# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc. +# Various formats will be parsed into a VERSION and an optional PACKAGE_NAME, where +# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION +# must be a Cargo-style SemVer Version (must have at least major.minor.patch). +# +# If PACKAGE_NAME is specified, then the announcement will be for that +# package (erroring out if it doesn't have the given version or isn't dist-able). +# +# If PACKAGE_NAME isn't specified, then the announcement will be for all +# (dist-able) packages in the workspace with that version (this mode is +# intended for workspaces with only one dist-able package, or with all dist-able +# packages versioned/released in lockstep). +# +# If you push multiple tags at once, separate instances of this workflow will +# spin up, creating an independent announcement for each one. However, GitHub +# will hard limit this to 3 tags per commit, as it will assume more tags is a +# mistake. +# +# If there's a prerelease-style suffix to the version, then the release(s) +# will be marked as a prerelease. +on: + pull_request: + push: + tags: + - '**[0-9]+.[0-9]+.[0-9]+*' + +jobs: + # Run 'dist plan' (or host) to determine what tasks we need to do + plan: + runs-on: "ubuntu-20.04" + outputs: + val: ${{ steps.plan.outputs.manifest }} + tag: ${{ !github.event.pull_request && github.ref_name || '' }} + tag-flag: ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }} + publishing: ${{ !github.event.pull_request }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install dist + # we specify bash to get pipefail; it guards against the `curl` command + # failing. otherwise `sh` won't catch that `curl` returned non-0 + shell: bash + run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + - name: Cache dist + uses: actions/upload-artifact@v4 + with: + name: cargo-dist-cache + path: ~/.cargo/bin/dist + # sure would be cool if github gave us proper conditionals... + # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible + # functionality based on whether this is a pull_request, and whether it's from a fork. + # (PRs run on the *source* but secrets are usually on the *target* -- that's *good* + # but also really annoying to build CI around when it needs secrets to work right.) + - id: plan + run: | + dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json + echo "dist ran successfully" + cat plan-dist-manifest.json + echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT" + - name: "Upload dist-manifest.json" + uses: actions/upload-artifact@v4 + with: + name: artifacts-plan-dist-manifest + path: plan-dist-manifest.json + + # Build and packages all the platform-specific things + build-local-artifacts: + name: build-local-artifacts (${{ join(matrix.targets, ', ') }}) + # Let the initial task tell us to not run (currently very blunt) + needs: + - plan + if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }} + strategy: + fail-fast: false + # Target platforms/runners are computed by dist in create-release. + # Each member of the matrix has the following arguments: + # + # - runner: the github runner + # - dist-args: cli flags to pass to dist + # - install-dist: expression to run to install dist on the runner + # + # Typically there will be: + # - 1 "global" task that builds universal installers + # - N "local" tasks that build each platform's binaries and platform-specific installers + matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} + runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json + steps: + - name: enable windows longpaths + run: | + git config --global core.longpaths true + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi + - name: Install dist + run: ${{ matrix.install_dist.run }} + # Get the dist-manifest + - name: Fetch local artifacts + uses: actions/download-artifact@v4 + with: + pattern: artifacts-* + path: target/distrib/ + merge-multiple: true + - name: Install dependencies + run: | + ${{ matrix.packages_install }} + - name: Build artifacts + run: | + # Actually do builds and make zips and whatnot + dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json + echo "dist ran successfully" + - id: cargo-dist + name: Post-build + # We force bash here just because github makes it really hard to get values up + # to "real" actions without writing to env-vars, and writing to env-vars has + # inconsistent syntax between shell and powershell. + shell: bash + run: | + # Parse out what we just built and upload it to scratch storage + echo "paths<> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" + + cp dist-manifest.json "$BUILD_MANIFEST_NAME" + - name: "Upload artifacts" + uses: actions/upload-artifact@v4 + with: + name: artifacts-build-local-${{ join(matrix.targets, '_') }} + path: | + ${{ steps.cargo-dist.outputs.paths }} + ${{ env.BUILD_MANIFEST_NAME }} + + # Build and package all the platform-agnostic(ish) things + build-global-artifacts: + needs: + - plan + - build-local-artifacts + runs-on: "ubuntu-20.04" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install cached dist + uses: actions/download-artifact@v4 + with: + name: cargo-dist-cache + path: ~/.cargo/bin/ + - run: chmod +x ~/.cargo/bin/dist + # Get all the local artifacts for the global tasks to use (for e.g. checksums) + - name: Fetch local artifacts + uses: actions/download-artifact@v4 + with: + pattern: artifacts-* + path: target/distrib/ + merge-multiple: true + - id: cargo-dist + shell: bash + run: | + dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json + echo "dist ran successfully" + + # Parse out what we just built and upload it to scratch storage + echo "paths<> "$GITHUB_OUTPUT" + jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" + + cp dist-manifest.json "$BUILD_MANIFEST_NAME" + - name: "Upload artifacts" + uses: actions/upload-artifact@v4 + with: + name: artifacts-build-global + path: | + ${{ steps.cargo-dist.outputs.paths }} + ${{ env.BUILD_MANIFEST_NAME }} + # Determines if we should publish/announce + host: + needs: + - plan + - build-local-artifacts + - build-global-artifacts + # Only run if we're "publishing", and only if local and global didn't fail (skipped is fine) + if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + runs-on: "ubuntu-20.04" + outputs: + val: ${{ steps.host.outputs.manifest }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install cached dist + uses: actions/download-artifact@v4 + with: + name: cargo-dist-cache + path: ~/.cargo/bin/ + - run: chmod +x ~/.cargo/bin/dist + # Fetch artifacts from scratch-storage + - name: Fetch artifacts + uses: actions/download-artifact@v4 + with: + pattern: artifacts-* + path: target/distrib/ + merge-multiple: true + - id: host + shell: bash + run: | + dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json + echo "artifacts uploaded and released successfully" + cat dist-manifest.json + echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT" + - name: "Upload dist-manifest.json" + uses: actions/upload-artifact@v4 + with: + # Overwrite the previous copy + name: artifacts-dist-manifest + path: dist-manifest.json + # Create a GitHub Release while uploading all files to it + - name: "Download GitHub Artifacts" + uses: actions/download-artifact@v4 + with: + pattern: artifacts-* + path: artifacts + merge-multiple: true + - name: Cleanup + run: | + # Remove the granular manifests + rm -f artifacts/*-dist-manifest.json + - name: Create GitHub Release + env: + PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}" + ANNOUNCEMENT_TITLE: "${{ fromJson(steps.host.outputs.manifest).announcement_title }}" + ANNOUNCEMENT_BODY: "${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}" + RELEASE_COMMIT: "${{ github.sha }}" + run: | + # Write and read notes from a file to avoid quoting breaking things + echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt + + gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/* + + announce: + needs: + - plan + - host + # use "always() && ..." to allow us to wait for all publish jobs while + # still allowing individual publish jobs to skip themselves (for prereleases). + # "host" however must run to completion, no skipping allowed! + if: ${{ always() && needs.host.result == 'success' }} + runs-on: "ubuntu-20.04" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive diff --git a/cargo-dist/tests/snapshots/axolotlsay_cross2.snap b/cargo-dist/tests/snapshots/axolotlsay_cross2.snap new file mode 100644 index 00000000..d628e1b8 --- /dev/null +++ b/cargo-dist/tests/snapshots/axolotlsay_cross2.snap @@ -0,0 +1,1658 @@ +--- +source: cargo-dist/tests/gallery/dist/snapshot.rs +expression: self.payload +--- +================ axolotlsay-installer.sh ================ +#!/bin/sh +# shellcheck shell=dash +# +# Licensed under the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +if [ "$KSH_VERSION" = 'Version JM 93t+ 2010-03-05' ]; then + # The version of ksh93 that ships with many illumos systems does not + # support the "local" extension. Print a message rather than fail in + # subtle ways later on: + echo 'this installer does not work with this ksh93 version; please try bash!' >&2 + exit 1 +fi + +set -u + +APP_NAME="axolotlsay" +APP_VERSION="0.2.2" +# Look for GitHub Enterprise-style base URL first +if [ -n "${AXOLOTLSAY_INSTALLER_GHE_BASE_URL:-}" ]; then + INSTALLER_BASE_URL="$AXOLOTLSAY_INSTALLER_GHE_BASE_URL" +else + INSTALLER_BASE_URL="${AXOLOTLSAY_INSTALLER_GITHUB_BASE_URL:-https://github.com}" +fi +if [ -n "${INSTALLER_DOWNLOAD_URL:-}" ]; then + ARTIFACT_DOWNLOAD_URL="$INSTALLER_DOWNLOAD_URL" +else + ARTIFACT_DOWNLOAD_URL="${INSTALLER_BASE_URL}/axodotdev/axolotlsay/releases/download/v0.2.2" +fi +PRINT_VERBOSE=${INSTALLER_PRINT_VERBOSE:-0} +PRINT_QUIET=${INSTALLER_PRINT_QUIET:-0} +if [ -n "${AXOLOTLSAY_NO_MODIFY_PATH:-}" ]; then + NO_MODIFY_PATH="$AXOLOTLSAY_NO_MODIFY_PATH" +else + NO_MODIFY_PATH=${INSTALLER_NO_MODIFY_PATH:-0} +fi +if [ "${AXOLOTLSAY_DISABLE_UPDATE:-0}" = "1" ]; then + INSTALL_UPDATER=0 +else + INSTALL_UPDATER=1 +fi +UNMANAGED_INSTALL="${AXOLOTLSAY_UNMANAGED_INSTALL:-}" +if [ -n "${UNMANAGED_INSTALL}" ]; then + NO_MODIFY_PATH=1 + INSTALL_UPDATER=0 +fi + +read -r RECEIPT <&2 + say_verbose " from $_url" 1>&2 + say_verbose " to $_file" 1>&2 + + ensure mkdir -p "$_dir" + + if ! downloader "$_url" "$_file"; then + say "failed to download $_url" + say "this may be a standard network error, but it may also indicate" + say "that $APP_NAME's release process is not working. When in doubt" + say "please feel free to open an issue!" + exit 1 + fi + + if [ -n "${_checksum_style:-}" ]; then + verify_checksum "$_file" "$_checksum_style" "$_checksum_value" + else + say "no checksums to verify" + fi + + # ...and then the updater, if it exists + if [ -n "$_updater_name" ] && [ "$INSTALL_UPDATER" = "1" ]; then + local _updater_url="$ARTIFACT_DOWNLOAD_URL/$_updater_name" + # This renames the artifact while doing the download, removing the + # target triple and leaving just the appname-update format + local _updater_file="$_dir/$APP_NAME-update" + + if ! downloader "$_updater_url" "$_updater_file"; then + say "failed to download $_updater_url" + say "this may be a standard network error, but it may also indicate" + say "that $APP_NAME's release process is not working. When in doubt" + say "please feel free to open an issue!" + exit 1 + fi + + # Add the updater to the list of binaries to install + _bins="$_bins $APP_NAME-update" + fi + + # unpack the archive + case "$_zip_ext" in + ".zip") + ensure unzip -q "$_file" -d "$_dir" + ;; + + ".tar."*) + ensure tar xf "$_file" --strip-components 1 -C "$_dir" + ;; + *) + err "unknown archive format: $_zip_ext" + ;; + esac + + install "$_dir" "$_bins" "$_libs" "$_staticlibs" "$_arch" "$@" + local _retval=$? + if [ "$_retval" != 0 ]; then + return "$_retval" + fi + + ignore rm -rf "$_dir" + + # Install the install receipt + if [ "$INSTALL_UPDATER" = "1" ]; then + if ! mkdir -p "$RECEIPT_HOME"; then + err "unable to create receipt directory at $RECEIPT_HOME" + else + echo "$RECEIPT" > "$RECEIPT_HOME/$APP_NAME-receipt.json" + # shellcheck disable=SC2320 + local _retval=$? + fi + else + local _retval=0 + fi + + return "$_retval" +} + +# Replaces $HOME with the variable name for display to the user, +# only if $HOME is defined. +replace_home() { + local _str="$1" + + if [ -n "${HOME:-}" ]; then + echo "$_str" | sed "s,$HOME,\$HOME," + else + echo "$_str" + fi +} + +json_binary_aliases() { + local _arch="$1" + + case "$_arch" in + "aarch64-unknown-linux-gnu") + echo '{}' + ;; + *) + echo '{}' + ;; + esac +} + +aliases_for_binary() { + local _bin="$1" + local _arch="$2" + + case "$_arch" in + "aarch64-unknown-linux-gnu") + case "$_bin" in + *) + echo "" + ;; + esac + ;; + *) + echo "" + ;; + esac +} + +select_archive_for_arch() { + local _true_arch="$1" + local _archive + + # try each archive, checking runtime conditions like libc versions + # accepting the first one that matches, as it's the best match + case "$_true_arch" in + "aarch64-unknown-linux-gnu") + _archive="axolotlsay-aarch64-unknown-linux-gnu.tar.gz" + if ! check_glibc "2" "31"; then + _archive="" + fi + if [ -n "$_archive" ]; then + echo "$_archive" + return 0 + fi + ;; + *) + err "there isn't a download for your platform $_true_arch" + ;; + esac + err "no compatible downloads were found for your platform $_true_arch" +} + +check_glibc() { + local _min_glibc_major="$1" + local _min_glibc_series="$2" + + # Parsing version out from line 1 like: + # ldd (Ubuntu GLIBC 2.35-0ubuntu3.1) 2.35 + _local_glibc="$(ldd --version | awk -F' ' '{ if (FNR<=1) print $NF }')" + + if [ "$(echo "${_local_glibc}" | awk -F. '{ print $1 }')" = "$_min_glibc_major" ] && [ "$(echo "${_local_glibc}" | awk -F. '{ print $2 }')" -ge "$_min_glibc_series" ]; then + return 0 + else + say "System glibc version (\`${_local_glibc}') is too old; checking alternatives" >&2 + return 1 + fi +} + +# See discussion of late-bound vs early-bound for why we use single-quotes with env vars +# shellcheck disable=SC2016 +install() { + # This code needs to both compute certain paths for itself to write to, and + # also write them to shell/rc files so that they can look them up to e.g. + # add them to PATH. This requires an active distinction between paths + # and expressions that can compute them. + # + # The distinction lies in when we want env-vars to be evaluated. For instance + # if we determine that we want to install to $HOME/.myapp, which do we add + # to e.g. $HOME/.profile: + # + # * early-bound: export PATH="/home/myuser/.myapp:$PATH" + # * late-bound: export PATH="$HOME/.myapp:$PATH" + # + # In this case most people would prefer the late-bound version, but in other + # cases the early-bound version might be a better idea. In particular when using + # other env-vars than $HOME, they are more likely to be only set temporarily + # for the duration of this install script, so it's more advisable to erase their + # existence with early-bounding. + # + # This distinction is handled by "double-quotes" (early) vs 'single-quotes' (late). + # + # However if we detect that "$SOME_VAR/..." is a subdir of $HOME, we try to rewrite + # it to be '$HOME/...' to get the best of both worlds. + # + # This script has a few different variants, the most complex one being the + # CARGO_HOME version which attempts to install things to Cargo's bin dir, + # potentially setting up a minimal version if the user hasn't ever installed Cargo. + # + # In this case we need to: + # + # * Install to $HOME/.cargo/bin/ + # * Create a shell script at $HOME/.cargo/env that: + # * Checks if $HOME/.cargo/bin/ is on PATH + # * and if not prepends it to PATH + # * Edits $HOME/.profile to run $HOME/.cargo/env (if the line doesn't exist) + # + # To do this we need these 4 values: + + # The actual path we're going to install to + local _install_dir + # The directory C dynamic/static libraries install to + local _lib_install_dir + # The install prefix we write to the receipt. + # For organized install methods like CargoHome, which have + # subdirectories, this is the root without `/bin`. For other + # methods, this is the same as `_install_dir`. + local _receipt_install_dir + # Path to the an shell script that adds install_dir to PATH + local _env_script_path + # Potentially-late-bound version of install_dir to write env_script + local _install_dir_expr + # Potentially-late-bound version of env_script_path to write to rcfiles like $HOME/.profile + local _env_script_path_expr + # Forces the install to occur at this path, not the default + local _force_install_dir + # Which install layout to use - "flat" or "hierarchical" + local _install_layout="unspecified" + + # Check the newer app-specific variable before falling back + # to the older generic one + if [ -n "${AXOLOTLSAY_INSTALL_DIR:-}" ]; then + _force_install_dir="$AXOLOTLSAY_INSTALL_DIR" + _install_layout="cargo-home" + elif [ -n "${CARGO_DIST_FORCE_INSTALL_DIR:-}" ]; then + _force_install_dir="$CARGO_DIST_FORCE_INSTALL_DIR" + _install_layout="cargo-home" + elif [ -n "$UNMANAGED_INSTALL" ]; then + _force_install_dir="$UNMANAGED_INSTALL" + _install_layout="flat" + fi + + # Check if the install layout should be changed from `flat` to `cargo-home` + # for backwards compatible updates of applications that switched layouts. + if [ -n "${_force_install_dir:-}" ]; then + if [ "$_install_layout" = "flat" ]; then + # If the install directory is targeting the Cargo home directory, then + # we assume this application was previously installed that layout + if [ "$_force_install_dir" = "${CARGO_HOME:-${HOME:-}/.cargo}" ]; then + _install_layout="cargo-home" + fi + fi + fi + + # Before actually consulting the configured install strategy, see + # if we're overriding it. + if [ -n "${_force_install_dir:-}" ]; then + case "$_install_layout" in + "hierarchical") + _install_dir="$_force_install_dir/bin" + _lib_install_dir="$_force_install_dir/lib" + _receipt_install_dir="$_force_install_dir" + _env_script_path="$_force_install_dir/env" + _install_dir_expr="$(replace_home "$_force_install_dir/bin")" + _env_script_path_expr="$(replace_home "$_force_install_dir/env")" + ;; + "cargo-home") + _install_dir="$_force_install_dir/bin" + _lib_install_dir="$_force_install_dir/bin" + _receipt_install_dir="$_force_install_dir" + _env_script_path="$_force_install_dir/env" + _install_dir_expr="$(replace_home "$_force_install_dir/bin")" + _env_script_path_expr="$(replace_home "$_force_install_dir/env")" + ;; + "flat") + _install_dir="$_force_install_dir" + _lib_install_dir="$_force_install_dir" + _receipt_install_dir="$_install_dir" + _env_script_path="$_force_install_dir/env" + _install_dir_expr="$(replace_home "$_force_install_dir")" + _env_script_path_expr="$(replace_home "$_force_install_dir/env")" + ;; + *) + err "Unrecognized install layout: $_install_layout" + ;; + esac + fi + if [ -z "${_install_dir:-}" ]; then + _install_layout="cargo-home" + # first try $CARGO_HOME, then fallback to $HOME/.cargo + if [ -n "${CARGO_HOME:-}" ]; then + _receipt_install_dir="$CARGO_HOME" + _install_dir="$CARGO_HOME/bin" + _lib_install_dir="$CARGO_HOME/bin" + _env_script_path="$CARGO_HOME/env" + # Initially make this early-bound to erase the potentially-temporary env-var + _install_dir_expr="$_install_dir" + _env_script_path_expr="$_env_script_path" + # If CARGO_HOME was set but it ended up being the default $HOME-based path, + # then keep things late-bound. Otherwise bake the value for safety. + # This is what rustup does, and accurately reproducing it is useful. + if [ -n "${HOME:-}" ]; then + if [ "$HOME/.cargo/bin" = "$_install_dir" ]; then + _install_dir_expr='$HOME/.cargo/bin' + _env_script_path_expr='$HOME/.cargo/env' + fi + fi + elif [ -n "${HOME:-}" ]; then + _receipt_install_dir="$HOME/.cargo" + _install_dir="$HOME/.cargo/bin" + _lib_install_dir="$HOME/.cargo/bin" + _env_script_path="$HOME/.cargo/env" + _install_dir_expr='$HOME/.cargo/bin' + _env_script_path_expr='$HOME/.cargo/env' + fi + fi + + if [ -z "$_install_dir_expr" ]; then + err "could not find a valid path to install to!" + fi + + # Identical to the sh version, just with a .fish file extension + # We place it down here to wait until it's been assigned in every + # path. + _fish_env_script_path="${_env_script_path}.fish" + _fish_env_script_path_expr="${_env_script_path_expr}.fish" + + # Replace the temporary cargo home with the calculated one + RECEIPT=$(echo "$RECEIPT" | sed "s,AXO_INSTALL_PREFIX,$_receipt_install_dir,") + # Also replace the aliases with the arch-specific one + RECEIPT=$(echo "$RECEIPT" | sed "s'\"binary_aliases\":{}'\"binary_aliases\":$(json_binary_aliases "$_arch")'") + # And replace the install layout + RECEIPT=$(echo "$RECEIPT" | sed "s'\"install_layout\":\"unspecified\"'\"install_layout\":\"$_install_layout\"'") + if [ "$NO_MODIFY_PATH" = "1" ]; then + RECEIPT=$(echo "$RECEIPT" | sed "s'\"modify_path\":true'\"modify_path\":false'") + fi + + say "installing to $_install_dir" + ensure mkdir -p "$_install_dir" + ensure mkdir -p "$_lib_install_dir" + + # copy all the binaries to the install dir + local _src_dir="$1" + local _bins="$2" + local _libs="$3" + local _staticlibs="$4" + local _arch="$5" + for _bin_name in $_bins; do + local _bin="$_src_dir/$_bin_name" + ensure mv "$_bin" "$_install_dir" + # unzip seems to need this chmod + ensure chmod +x "$_install_dir/$_bin_name" + for _dest in $(aliases_for_binary "$_bin_name" "$_arch"); do + ln -sf "$_install_dir/$_bin_name" "$_install_dir/$_dest" + done + say " $_bin_name" + done + # Like the above, but no aliases + for _lib_name in $_libs; do + local _lib="$_src_dir/$_lib_name" + ensure mv "$_lib" "$_lib_install_dir" + # unzip seems to need this chmod + ensure chmod +x "$_lib_install_dir/$_lib_name" + say " $_lib_name" + done + for _lib_name in $_staticlibs; do + local _lib="$_src_dir/$_lib_name" + ensure mv "$_lib" "$_lib_install_dir" + # unzip seems to need this chmod + ensure chmod +x "$_lib_install_dir/$_lib_name" + say " $_lib_name" + done + + say "everything's installed!" + + # Avoid modifying the users PATH if they are managing their PATH manually + case :$PATH: + in *:$_install_dir:*) NO_MODIFY_PATH=1 ;; + *) ;; + esac + + if [ "0" = "$NO_MODIFY_PATH" ]; then + add_install_dir_to_ci_path "$_install_dir" + add_install_dir_to_path "$_install_dir_expr" "$_env_script_path" "$_env_script_path_expr" ".profile" "sh" + exit1=$? + shotgun_install_dir_to_path "$_install_dir_expr" "$_env_script_path" "$_env_script_path_expr" ".profile .bashrc .bash_profile .bash_login" "sh" + exit2=$? + add_install_dir_to_path "$_install_dir_expr" "$_env_script_path" "$_env_script_path_expr" ".zshrc .zshenv" "sh" + exit3=$? + # This path may not exist by default + ensure mkdir -p "$HOME/.config/fish/conf.d" + exit4=$? + add_install_dir_to_path "$_install_dir_expr" "$_fish_env_script_path" "$_fish_env_script_path_expr" ".config/fish/conf.d/$APP_NAME.env.fish" "fish" + exit5=$? + + if [ "${exit1:-0}" = 1 ] || [ "${exit2:-0}" = 1 ] || [ "${exit3:-0}" = 1 ] || [ "${exit4:-0}" = 1 ] || [ "${exit5:-0}" = 1 ]; then + say "" + say "To add $_install_dir_expr to your PATH, either restart your shell or run:" + say "" + say " source $_env_script_path_expr (sh, bash, zsh)" + say " source $_fish_env_script_path_expr (fish)" + fi + fi +} + +print_home_for_script() { + local script="$1" + + local _home + case "$script" in + # zsh has a special ZDOTDIR directory, which if set + # should be considered instead of $HOME + .zsh*) + if [ -n "${ZDOTDIR:-}" ]; then + _home="$ZDOTDIR" + else + _home="$HOME" + fi + ;; + *) + _home="$HOME" + ;; + esac + + echo "$_home" +} + +add_install_dir_to_ci_path() { + # Attempt to do CI-specific rituals to get the install-dir on PATH faster + local _install_dir="$1" + + # If GITHUB_PATH is present, then write install_dir to the file it refs. + # After each GitHub Action, the contents will be added to PATH. + # So if you put a curl | sh for this script in its own "run" step, + # the next step will have this dir on PATH. + # + # Note that GITHUB_PATH will not resolve any variables, so we in fact + # want to write install_dir and not install_dir_expr + if [ -n "${GITHUB_PATH:-}" ]; then + ensure echo "$_install_dir" >> "$GITHUB_PATH" + fi +} + +add_install_dir_to_path() { + # Edit rcfiles ($HOME/.profile) to add install_dir to $PATH + # + # We do this slightly indirectly by creating an "env" shell script which checks if install_dir + # is on $PATH already, and prepends it if not. The actual line we then add to rcfiles + # is to just source that script. This allows us to blast it into lots of different rcfiles and + # have it run multiple times without causing problems. It's also specifically compatible + # with the system rustup uses, so that we don't conflict with it. + local _install_dir_expr="$1" + local _env_script_path="$2" + local _env_script_path_expr="$3" + local _rcfiles="$4" + local _shell="$5" + + if [ -n "${HOME:-}" ]; then + local _target + local _home + + # Find the first file in the array that exists and choose + # that as our target to write to + for _rcfile_relative in $_rcfiles; do + _home="$(print_home_for_script "$_rcfile_relative")" + local _rcfile="$_home/$_rcfile_relative" + + if [ -f "$_rcfile" ]; then + _target="$_rcfile" + break + fi + done + + # If we didn't find anything, pick the first entry in the + # list as the default to create and write to + if [ -z "${_target:-}" ]; then + local _rcfile_relative + _rcfile_relative="$(echo "$_rcfiles" | awk '{ print $1 }')" + _home="$(print_home_for_script "$_rcfile_relative")" + _target="$_home/$_rcfile_relative" + fi + + # `source x` is an alias for `. x`, and the latter is more portable/actually-posix. + # This apparently comes up a lot on freebsd. It's easy enough to always add + # the more robust line to rcfiles, but when telling the user to apply the change + # to their current shell ". x" is pretty easy to misread/miscopy, so we use the + # prettier "source x" line there. Hopefully people with Weird Shells are aware + # this is a thing and know to tweak it (or just restart their shell). + local _robust_line=". \"$_env_script_path_expr\"" + local _pretty_line="source \"$_env_script_path_expr\"" + + # Add the env script if it doesn't already exist + if [ ! -f "$_env_script_path" ]; then + say_verbose "creating $_env_script_path" + if [ "$_shell" = "sh" ]; then + write_env_script_sh "$_install_dir_expr" "$_env_script_path" + else + write_env_script_fish "$_install_dir_expr" "$_env_script_path" + fi + else + say_verbose "$_env_script_path already exists" + fi + + # Check if the line is already in the rcfile + # grep: 0 if matched, 1 if no match, and 2 if an error occurred + # + # Ideally we could use quiet grep (-q), but that makes "match" and "error" + # have the same behaviour, when we want "no match" and "error" to be the same + # (on error we want to create the file, which >> conveniently does) + # + # We search for both kinds of line here just to do the right thing in more cases. + if ! grep -F "$_robust_line" "$_target" > /dev/null 2>/dev/null && \ + ! grep -F "$_pretty_line" "$_target" > /dev/null 2>/dev/null + then + # If the script now exists, add the line to source it to the rcfile + # (This will also create the rcfile if it doesn't exist) + if [ -f "$_env_script_path" ]; then + local _line + # Fish has deprecated `.` as an alias for `source` and + # it will be removed in a later version. + # https://fishshell.com/docs/current/cmds/source.html + # By contrast, `.` is the traditional syntax in sh and + # `source` isn't always supported in all circumstances. + if [ "$_shell" = "fish" ]; then + _line="$_pretty_line" + else + _line="$_robust_line" + fi + say_verbose "adding $_line to $_target" + # prepend an extra newline in case the user's file is missing a trailing one + ensure echo "" >> "$_target" + ensure echo "$_line" >> "$_target" + return 1 + fi + else + say_verbose "$_install_dir already on PATH" + fi + fi +} + +shotgun_install_dir_to_path() { + # Edit rcfiles ($HOME/.profile) to add install_dir to $PATH + # (Shotgun edition - write to all provided files that exist rather than just the first) + local _install_dir_expr="$1" + local _env_script_path="$2" + local _env_script_path_expr="$3" + local _rcfiles="$4" + local _shell="$5" + + if [ -n "${HOME:-}" ]; then + local _found=false + local _home + + for _rcfile_relative in $_rcfiles; do + _home="$(print_home_for_script "$_rcfile_relative")" + local _rcfile_abs="$_home/$_rcfile_relative" + + if [ -f "$_rcfile_abs" ]; then + _found=true + add_install_dir_to_path "$_install_dir_expr" "$_env_script_path" "$_env_script_path_expr" "$_rcfile_relative" "$_shell" + fi + done + + # Fall through to previous "create + write to first file in list" behavior + if [ "$_found" = false ]; then + add_install_dir_to_path "$_install_dir_expr" "$_env_script_path" "$_env_script_path_expr" "$_rcfiles" "$_shell" + fi + fi +} + +write_env_script_sh() { + # write this env script to the given path (this cat/EOF stuff is a "heredoc" string) + local _install_dir_expr="$1" + local _env_script_path="$2" + ensure cat < "$_env_script_path" +#!/bin/sh +# add binaries to PATH if they aren't added yet +# affix colons on either side of \$PATH to simplify matching +case ":\${PATH}:" in + *:"$_install_dir_expr":*) + ;; + *) + # Prepending path in case a system-installed binary needs to be overridden + export PATH="$_install_dir_expr:\$PATH" + ;; +esac +EOF +} + +write_env_script_fish() { + # write this env script to the given path (this cat/EOF stuff is a "heredoc" string) + local _install_dir_expr="$1" + local _env_script_path="$2" + ensure cat < "$_env_script_path" +if not contains "$_install_dir_expr" \$PATH + # Prepending path in case a system-installed binary needs to be overridden + set -x PATH "$_install_dir_expr" \$PATH +end +EOF +} + +check_proc() { + # Check for /proc by looking for the /proc/self/exe link + # This is only run on Linux + if ! test -L /proc/self/exe ; then + err "fatal: Unable to find /proc/self/exe. Is /proc mounted? Installation cannot proceed without /proc." + fi +} + +get_bitness() { + need_cmd head + # Architecture detection without dependencies beyond coreutils. + # ELF files start out "\x7fELF", and the following byte is + # 0x01 for 32-bit and + # 0x02 for 64-bit. + # The printf builtin on some shells like dash only supports octal + # escape sequences, so we use those. + local _current_exe_head + _current_exe_head=$(head -c 5 /proc/self/exe ) + if [ "$_current_exe_head" = "$(printf '\177ELF\001')" ]; then + echo 32 + elif [ "$_current_exe_head" = "$(printf '\177ELF\002')" ]; then + echo 64 + else + err "unknown platform bitness" + fi +} + +is_host_amd64_elf() { + need_cmd head + need_cmd tail + # ELF e_machine detection without dependencies beyond coreutils. + # Two-byte field at offset 0x12 indicates the CPU, + # but we're interested in it being 0x3E to indicate amd64, or not that. + local _current_exe_machine + _current_exe_machine=$(head -c 19 /proc/self/exe | tail -c 1) + [ "$_current_exe_machine" = "$(printf '\076')" ] +} + +get_endianness() { + local cputype=$1 + local suffix_eb=$2 + local suffix_el=$3 + + # detect endianness without od/hexdump, like get_bitness() does. + need_cmd head + need_cmd tail + + local _current_exe_endianness + _current_exe_endianness="$(head -c 6 /proc/self/exe | tail -c 1)" + if [ "$_current_exe_endianness" = "$(printf '\001')" ]; then + echo "${cputype}${suffix_el}" + elif [ "$_current_exe_endianness" = "$(printf '\002')" ]; then + echo "${cputype}${suffix_eb}" + else + err "unknown platform endianness" + fi +} + +get_architecture() { + local _ostype + local _cputype + _ostype="$(uname -s)" + _cputype="$(uname -m)" + local _clibtype="gnu" + local _local_glibc + + if [ "$_ostype" = Linux ]; then + if [ "$(uname -o)" = Android ]; then + _ostype=Android + fi + if ldd --version 2>&1 | grep -q 'musl'; then + _clibtype="musl-dynamic" + else + # Assume all other linuxes are glibc (even if wrong, static libc fallback will apply) + _clibtype="gnu" + fi + fi + + if [ "$_ostype" = Darwin ] && [ "$_cputype" = i386 ]; then + # Darwin `uname -m` lies + if sysctl hw.optional.x86_64 | grep -q ': 1'; then + _cputype=x86_64 + fi + fi + + if [ "$_ostype" = Darwin ] && [ "$_cputype" = x86_64 ]; then + # Rosetta on aarch64 + if [ "$(sysctl -n hw.optional.arm64 2>/dev/null)" = "1" ]; then + _cputype=aarch64 + fi + fi + + if [ "$_ostype" = SunOS ]; then + # Both Solaris and illumos presently announce as "SunOS" in "uname -s" + # so use "uname -o" to disambiguate. We use the full path to the + # system uname in case the user has coreutils uname first in PATH, + # which has historically sometimes printed the wrong value here. + if [ "$(/usr/bin/uname -o)" = illumos ]; then + _ostype=illumos + fi + + # illumos systems have multi-arch userlands, and "uname -m" reports the + # machine hardware name; e.g., "i86pc" on both 32- and 64-bit x86 + # systems. Check for the native (widest) instruction set on the + # running kernel: + if [ "$_cputype" = i86pc ]; then + _cputype="$(isainfo -n)" + fi + fi + + case "$_ostype" in + + Android) + _ostype=linux-android + ;; + + Linux) + check_proc + _ostype=unknown-linux-$_clibtype + _bitness=$(get_bitness) + ;; + + FreeBSD) + _ostype=unknown-freebsd + ;; + + NetBSD) + _ostype=unknown-netbsd + ;; + + DragonFly) + _ostype=unknown-dragonfly + ;; + + Darwin) + _ostype=apple-darwin + ;; + + illumos) + _ostype=unknown-illumos + ;; + + MINGW* | MSYS* | CYGWIN* | Windows_NT) + _ostype=pc-windows-gnu + ;; + + *) + err "unrecognized OS type: $_ostype" + ;; + + esac + + case "$_cputype" in + + i386 | i486 | i686 | i786 | x86) + _cputype=i686 + ;; + + xscale | arm) + _cputype=arm + if [ "$_ostype" = "linux-android" ]; then + _ostype=linux-androideabi + fi + ;; + + armv6l) + _cputype=arm + if [ "$_ostype" = "linux-android" ]; then + _ostype=linux-androideabi + else + _ostype="${_ostype}eabihf" + fi + ;; + + armv7l | armv8l) + _cputype=armv7 + if [ "$_ostype" = "linux-android" ]; then + _ostype=linux-androideabi + else + _ostype="${_ostype}eabihf" + fi + ;; + + aarch64 | arm64) + _cputype=aarch64 + ;; + + x86_64 | x86-64 | x64 | amd64) + _cputype=x86_64 + ;; + + mips) + _cputype=$(get_endianness mips '' el) + ;; + + mips64) + if [ "$_bitness" -eq 64 ]; then + # only n64 ABI is supported for now + _ostype="${_ostype}abi64" + _cputype=$(get_endianness mips64 '' el) + fi + ;; + + ppc) + _cputype=powerpc + ;; + + ppc64) + _cputype=powerpc64 + ;; + + ppc64le) + _cputype=powerpc64le + ;; + + s390x) + _cputype=s390x + ;; + riscv64) + _cputype=riscv64gc + ;; + loongarch64) + _cputype=loongarch64 + ;; + *) + err "unknown CPU type: $_cputype" + + esac + + # Detect 64-bit linux with 32-bit userland + if [ "${_ostype}" = unknown-linux-gnu ] && [ "${_bitness}" -eq 32 ]; then + case $_cputype in + x86_64) + # 32-bit executable for amd64 = x32 + if is_host_amd64_elf; then { + err "x32 linux unsupported" + }; else + _cputype=i686 + fi + ;; + mips64) + _cputype=$(get_endianness mips '' el) + ;; + powerpc64) + _cputype=powerpc + ;; + aarch64) + _cputype=armv7 + if [ "$_ostype" = "linux-android" ]; then + _ostype=linux-androideabi + else + _ostype="${_ostype}eabihf" + fi + ;; + riscv64gc) + err "riscv64 with 32-bit userland unsupported" + ;; + esac + fi + + # treat armv7 systems without neon as plain arm + if [ "$_ostype" = "unknown-linux-gnueabihf" ] && [ "$_cputype" = armv7 ]; then + if ensure grep '^Features' /proc/cpuinfo | grep -q -v neon; then + # At least one processor does not have NEON. + _cputype=arm + fi + fi + + _arch="${_cputype}-${_ostype}" + + RETVAL="$_arch" +} + +say() { + if [ "0" = "$PRINT_QUIET" ]; then + echo "$1" + fi +} + +say_verbose() { + if [ "1" = "$PRINT_VERBOSE" ]; then + echo "$1" + fi +} + +err() { + if [ "0" = "$PRINT_QUIET" ]; then + local red + local reset + red=$(tput setaf 1 2>/dev/null || echo '') + reset=$(tput sgr0 2>/dev/null || echo '') + say "${red}ERROR${reset}: $1" >&2 + fi + exit 1 +} + +need_cmd() { + if ! check_cmd "$1" + then err "need '$1' (command not found)" + fi +} + +check_cmd() { + command -v "$1" > /dev/null 2>&1 + return $? +} + +assert_nz() { + if [ -z "$1" ]; then err "assert_nz $2"; fi +} + +# Run a command that should never fail. If the command fails execution +# will immediately terminate with an error showing the failing +# command. +ensure() { + if ! "$@"; then err "command failed: $*"; fi +} + +# This is just for indicating that commands' results are being +# intentionally ignored. Usually, because it's being executed +# as part of error handling. +ignore() { + "$@" +} + +# This wraps curl or wget. Try curl first, if not installed, +# use wget instead. +downloader() { + if check_cmd curl + then _dld=curl + elif check_cmd wget + then _dld=wget + else _dld='curl or wget' # to be used in error message of need_cmd + fi + + if [ "$1" = --check ] + then need_cmd "$_dld" + elif [ "$_dld" = curl ] + then curl -sSfL "$1" -o "$2" + elif [ "$_dld" = wget ] + then wget "$1" -O "$2" + else err "Unknown downloader" # should not reach here + fi +} + +verify_checksum() { + local _file="$1" + local _checksum_style="$2" + local _checksum_value="$3" + local _calculated_checksum + + if [ -z "$_checksum_value" ]; then + return 0 + fi + case "$_checksum_style" in + sha256) + if ! check_cmd sha256sum; then + say "skipping sha256 checksum verification (it requires the 'sha256sum' command)" + return 0 + fi + _calculated_checksum="$(sha256sum -b "$_file" | awk '{printf $1}')" + ;; + sha512) + if ! check_cmd sha512sum; then + say "skipping sha512 checksum verification (it requires the 'sha512sum' command)" + return 0 + fi + _calculated_checksum="$(sha512sum -b "$_file" | awk '{printf $1}')" + ;; + sha3-256) + if ! check_cmd openssl; then + say "skipping sha3-256 checksum verification (it requires the 'openssl' command)" + return 0 + fi + _calculated_checksum="$(openssl dgst -sha3-256 "$_file" | awk '{printf $NF}')" + ;; + sha3-512) + if ! check_cmd openssl; then + say "skipping sha3-512 checksum verification (it requires the 'openssl' command)" + return 0 + fi + _calculated_checksum="$(openssl dgst -sha3-512 "$_file" | awk '{printf $NF}')" + ;; + blake2s) + if ! check_cmd b2sum; then + say "skipping blake2s checksum verification (it requires the 'b2sum' command)" + return 0 + fi + # Test if we have official b2sum with blake2s support + local _well_known_blake2s_checksum="93314a61f470985a40f8da62df10ba0546dc5216e1d45847bf1dbaa42a0e97af" + local _test_blake2s + _test_blake2s="$(printf "can do blake2s" | b2sum -a blake2s | awk '{printf $1}')" || _test_blake2s="" + + if [ "X$_test_blake2s" = "X$_well_known_blake2s_checksum" ]; then + _calculated_checksum="$(b2sum -a blake2s "$_file" | awk '{printf $1}')" || _calculated_checksum="" + else + say "skipping blake2s checksum verification (installed b2sum doesn't support blake2s)" + return 0 + fi + ;; + blake2b) + if ! check_cmd b2sum; then + say "skipping blake2b checksum verification (it requires the 'b2sum' command)" + return 0 + fi + _calculated_checksum="$(b2sum "$_file" | awk '{printf $1}')" + ;; + false) + ;; + *) + say "skipping unknown checksum style: $_checksum_style" + return 0 + ;; + esac + + if [ "$_calculated_checksum" != "$_checksum_value" ]; then + err "checksum mismatch + want: $_checksum_value + got: $_calculated_checksum" + fi +} + +download_binary_and_run_installer "$@" || exit 1 + +================ sha256.sum ================ +CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.gz + + +================ dist-manifest.json ================ +{ + "dist_version": "CENSORED", + "announcement_tag": "v0.2.2", + "announcement_tag_is_implicit": true, + "announcement_is_prerelease": false, + "announcement_title": "Version 0.2.2", + "announcement_changelog": "```text\n +----------------------------------+\n | now with arm64 linux binaries!!! |\n +----------------------------------+\n /\n≽(◕ ᴗ ◕)≼\n```", + "announcement_github_body": "## Release Notes\n\n```text\n +----------------------------------+\n | now with arm64 linux binaries!!! |\n +----------------------------------+\n /\n≽(◕ ᴗ ◕)≼\n```\n\n## Install axolotlsay 0.2.2\n\n### Install prebuilt binaries via shell script\n\n```sh\ncurl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-installer.sh | sh\n```\n\n## Download axolotlsay 0.2.2\n\n| File | Platform | Checksum |\n|--------|----------|----------|\n| [axolotlsay-aarch64-unknown-linux-gnu.tar.gz](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-aarch64-unknown-linux-gnu.tar.gz) | ARM64 Linux | [checksum](https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-aarch64-unknown-linux-gnu.tar.gz.sha256) |\n\n", + "releases": [ + { + "app_name": "axolotlsay", + "app_version": "0.2.2", + "env": { + "install_dir_env_var": "AXOLOTLSAY_INSTALL_DIR", + "unmanaged_dir_env_var": "AXOLOTLSAY_UNMANAGED_INSTALL", + "disable_update_env_var": "AXOLOTLSAY_DISABLE_UPDATE", + "no_modify_path_env_var": "AXOLOTLSAY_NO_MODIFY_PATH", + "github_base_url_env_var": "AXOLOTLSAY_INSTALLER_GITHUB_BASE_URL", + "ghe_base_url_env_var": "AXOLOTLSAY_INSTALLER_GHE_BASE_URL" + }, + "display_name": "axolotlsay", + "display": true, + "artifacts": [ + "source.tar.gz", + "source.tar.gz.sha256", + "axolotlsay-installer.sh", + "sha256.sum", + "axolotlsay-aarch64-unknown-linux-gnu.tar.gz", + "axolotlsay-aarch64-unknown-linux-gnu.tar.gz.sha256" + ], + "hosting": { + "github": { + "artifact_base_url": "https://github.com", + "artifact_download_path": "/axodotdev/axolotlsay/releases/download/v0.2.2", + "owner": "axodotdev", + "repo": "axolotlsay" + } + } + } + ], + "artifacts": { + "axolotlsay-aarch64-unknown-linux-gnu.tar.gz": { + "name": "axolotlsay-aarch64-unknown-linux-gnu.tar.gz", + "kind": "executable-zip", + "target_triples": [ + "aarch64-unknown-linux-gnu" + ], + "assets": [ + { + "name": "CHANGELOG.md", + "path": "CHANGELOG.md", + "kind": "changelog" + }, + { + "name": "LICENSE-APACHE", + "path": "LICENSE-APACHE", + "kind": "license" + }, + { + "name": "LICENSE-MIT", + "path": "LICENSE-MIT", + "kind": "license" + }, + { + "name": "README.md", + "path": "README.md", + "kind": "readme" + }, + { + "id": "axolotlsay-aarch64-unknown-linux-gnu-exe-axolotlsay", + "name": "axolotlsay", + "path": "axolotlsay", + "kind": "executable" + } + ], + "checksum": "axolotlsay-aarch64-unknown-linux-gnu.tar.gz.sha256" + }, + "axolotlsay-aarch64-unknown-linux-gnu.tar.gz.sha256": { + "name": "axolotlsay-aarch64-unknown-linux-gnu.tar.gz.sha256", + "kind": "checksum", + "target_triples": [ + "aarch64-unknown-linux-gnu" + ] + }, + "axolotlsay-installer.sh": { + "name": "axolotlsay-installer.sh", + "kind": "installer", + "target_triples": [ + "aarch64-unknown-linux-gnu" + ], + "install_hint": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/axolotlsay/releases/download/v0.2.2/axolotlsay-installer.sh | sh", + "description": "Install prebuilt binaries via shell script" + }, + "sha256.sum": { + "name": "sha256.sum", + "kind": "unified-checksum" + }, + "source.tar.gz": { + "name": "source.tar.gz", + "kind": "source-tarball", + "checksum": "source.tar.gz.sha256" + }, + "source.tar.gz.sha256": { + "name": "source.tar.gz.sha256", + "kind": "checksum" + } + }, + "systems": { + "plan:all:": { + "id": "plan:all:", + "cargo_version_line": "CENSORED" + "build_environment": "indeterminate" + } + }, + "publish_prereleases": false, + "force_latest": false, + "ci": { + "github": { + "artifacts_matrix": { + "include": [ + { + "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", + "container": { + "image": "quay.io/pypa/manylinux_2_28_x86_64", + "host": "aarch64-unknown-linux-gnu" + }, + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-unknown-linux-gnu", + "targets": [ + "aarch64-unknown-linux-gnu" + ], + "install_cargo_auditable": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" + }, + "cache_provider": "github" + } + ] + }, + "pr_run_mode": "plan" + } + }, + "linkage": [], + "upload_files": [] +} + +================ release.yml ================ +# This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/ +# +# Copyright 2022-2024, axodotdev +# SPDX-License-Identifier: MIT or Apache-2.0 +# +# CI that: +# +# * checks for a Git Tag that looks like a release +# * builds artifacts with dist (archives, installers, hashes) +# * uploads those artifacts to temporary workflow zip +# * on success, uploads the artifacts to a GitHub Release +# +# Note that the GitHub Release will be created with a generated +# title/body based on your changelogs. + +name: Release +permissions: + "contents": "write" + +# This task will run whenever you push a git tag that looks like a version +# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc. +# Various formats will be parsed into a VERSION and an optional PACKAGE_NAME, where +# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION +# must be a Cargo-style SemVer Version (must have at least major.minor.patch). +# +# If PACKAGE_NAME is specified, then the announcement will be for that +# package (erroring out if it doesn't have the given version or isn't dist-able). +# +# If PACKAGE_NAME isn't specified, then the announcement will be for all +# (dist-able) packages in the workspace with that version (this mode is +# intended for workspaces with only one dist-able package, or with all dist-able +# packages versioned/released in lockstep). +# +# If you push multiple tags at once, separate instances of this workflow will +# spin up, creating an independent announcement for each one. However, GitHub +# will hard limit this to 3 tags per commit, as it will assume more tags is a +# mistake. +# +# If there's a prerelease-style suffix to the version, then the release(s) +# will be marked as a prerelease. +on: + pull_request: + push: + tags: + - '**[0-9]+.[0-9]+.[0-9]+*' + +jobs: + # Run 'dist plan' (or host) to determine what tasks we need to do + plan: + runs-on: "ubuntu-20.04" + outputs: + val: ${{ steps.plan.outputs.manifest }} + tag: ${{ !github.event.pull_request && github.ref_name || '' }} + tag-flag: ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }} + publishing: ${{ !github.event.pull_request }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install dist + # we specify bash to get pipefail; it guards against the `curl` command + # failing. otherwise `sh` won't catch that `curl` returned non-0 + shell: bash + run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + - name: Cache dist + uses: actions/upload-artifact@v4 + with: + name: cargo-dist-cache + path: ~/.cargo/bin/dist + # sure would be cool if github gave us proper conditionals... + # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible + # functionality based on whether this is a pull_request, and whether it's from a fork. + # (PRs run on the *source* but secrets are usually on the *target* -- that's *good* + # but also really annoying to build CI around when it needs secrets to work right.) + - id: plan + run: | + dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json + echo "dist ran successfully" + cat plan-dist-manifest.json + echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT" + - name: "Upload dist-manifest.json" + uses: actions/upload-artifact@v4 + with: + name: artifacts-plan-dist-manifest + path: plan-dist-manifest.json + + # Build and packages all the platform-specific things + build-local-artifacts: + name: build-local-artifacts (${{ join(matrix.targets, ', ') }}) + # Let the initial task tell us to not run (currently very blunt) + needs: + - plan + if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }} + strategy: + fail-fast: false + # Target platforms/runners are computed by dist in create-release. + # Each member of the matrix has the following arguments: + # + # - runner: the github runner + # - dist-args: cli flags to pass to dist + # - install-dist: expression to run to install dist on the runner + # + # Typically there will be: + # - 1 "global" task that builds universal installers + # - N "local" tasks that build each platform's binaries and platform-specific installers + matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} + runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json + steps: + - name: enable windows longpaths + run: | + git config --global core.longpaths true + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi + - name: Install dist + run: ${{ matrix.install_dist.run }} + # Get the dist-manifest + - name: Fetch local artifacts + uses: actions/download-artifact@v4 + with: + pattern: artifacts-* + path: target/distrib/ + merge-multiple: true + - name: Install dependencies + run: | + ${{ matrix.packages_install }} + - name: Build artifacts + run: | + # Actually do builds and make zips and whatnot + dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json + echo "dist ran successfully" + - id: cargo-dist + name: Post-build + # We force bash here just because github makes it really hard to get values up + # to "real" actions without writing to env-vars, and writing to env-vars has + # inconsistent syntax between shell and powershell. + shell: bash + run: | + # Parse out what we just built and upload it to scratch storage + echo "paths<> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" + + cp dist-manifest.json "$BUILD_MANIFEST_NAME" + - name: "Upload artifacts" + uses: actions/upload-artifact@v4 + with: + name: artifacts-build-local-${{ join(matrix.targets, '_') }} + path: | + ${{ steps.cargo-dist.outputs.paths }} + ${{ env.BUILD_MANIFEST_NAME }} + + # Build and package all the platform-agnostic(ish) things + build-global-artifacts: + needs: + - plan + - build-local-artifacts + runs-on: "ubuntu-20.04" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install cached dist + uses: actions/download-artifact@v4 + with: + name: cargo-dist-cache + path: ~/.cargo/bin/ + - run: chmod +x ~/.cargo/bin/dist + # Get all the local artifacts for the global tasks to use (for e.g. checksums) + - name: Fetch local artifacts + uses: actions/download-artifact@v4 + with: + pattern: artifacts-* + path: target/distrib/ + merge-multiple: true + - id: cargo-dist + shell: bash + run: | + dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json + echo "dist ran successfully" + + # Parse out what we just built and upload it to scratch storage + echo "paths<> "$GITHUB_OUTPUT" + jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" + + cp dist-manifest.json "$BUILD_MANIFEST_NAME" + - name: "Upload artifacts" + uses: actions/upload-artifact@v4 + with: + name: artifacts-build-global + path: | + ${{ steps.cargo-dist.outputs.paths }} + ${{ env.BUILD_MANIFEST_NAME }} + # Determines if we should publish/announce + host: + needs: + - plan + - build-local-artifacts + - build-global-artifacts + # Only run if we're "publishing", and only if local and global didn't fail (skipped is fine) + if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + runs-on: "ubuntu-20.04" + outputs: + val: ${{ steps.host.outputs.manifest }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install cached dist + uses: actions/download-artifact@v4 + with: + name: cargo-dist-cache + path: ~/.cargo/bin/ + - run: chmod +x ~/.cargo/bin/dist + # Fetch artifacts from scratch-storage + - name: Fetch artifacts + uses: actions/download-artifact@v4 + with: + pattern: artifacts-* + path: target/distrib/ + merge-multiple: true + - id: host + shell: bash + run: | + dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json + echo "artifacts uploaded and released successfully" + cat dist-manifest.json + echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT" + - name: "Upload dist-manifest.json" + uses: actions/upload-artifact@v4 + with: + # Overwrite the previous copy + name: artifacts-dist-manifest + path: dist-manifest.json + # Create a GitHub Release while uploading all files to it + - name: "Download GitHub Artifacts" + uses: actions/download-artifact@v4 + with: + pattern: artifacts-* + path: artifacts + merge-multiple: true + - name: Cleanup + run: | + # Remove the granular manifests + rm -f artifacts/*-dist-manifest.json + - name: Create GitHub Release + env: + PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}" + ANNOUNCEMENT_TITLE: "${{ fromJson(steps.host.outputs.manifest).announcement_title }}" + ANNOUNCEMENT_BODY: "${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}" + RELEASE_COMMIT: "${{ github.sha }}" + run: | + # Write and read notes from a file to avoid quoting breaking things + echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt + + gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/* + + announce: + needs: + - plan + - host + # use "always() && ..." to allow us to wait for all publish jobs while + # still allowing individual publish jobs to skip themselves (for prereleases). + # "host" however must run to completion, no skipping allowed! + if: ${{ always() && needs.host.result == 'success' }} + runs-on: "ubuntu-20.04" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive diff --git a/cargo-dist/tests/snapshots/axolotlsay_custom_formula.snap b/cargo-dist/tests/snapshots/axolotlsay_custom_formula.snap index a0df4a09..b8e937ce 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_custom_formula.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_custom_formula.snap @@ -1,7 +1,6 @@ --- source: cargo-dist/tests/gallery/dist/snapshot.rs expression: self.payload -snapshot_kind: text --- ================ axolotl-brew.rb ================ class AxolotlBrew < Formula @@ -332,67 +331,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -500,6 +503,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -510,6 +514,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - uses: swatinem/rust-cache@v2 with: key: ${{ join(matrix.targets, '-') }} @@ -540,7 +551,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_custom_github_runners.snap b/cargo-dist/tests/snapshots/axolotlsay_custom_github_runners.snap index 60571b53..606608db 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_custom_github_runners.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_custom_github_runners.snap @@ -1,7 +1,6 @@ --- source: cargo-dist/tests/gallery/dist/snapshot.rs expression: self.payload -snapshot_kind: text --- ================ sha256.sum ================ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.gz @@ -254,69 +253,73 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "buildjet-8vcpu-ubuntu-2204-arm", + "host": "aarch64-unknown-linux-gnu", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-unknown-linux-gnu", "targets": [ "aarch64-unknown-linux-gnu" ], - "runner": "buildjet-8vcpu-ubuntu-2204-arm", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-unknown-linux-gnu", "cache_provider": "buildjet" }, { + "runner": "buildjet-8vcpu-ubuntu-2204-arm", + "host": "aarch64-unknown-linux-gnu", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-unknown-linux-musl", "targets": [ "aarch64-unknown-linux-musl" ], - "runner": "buildjet-8vcpu-ubuntu-2204-arm", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-unknown-linux-musl", - "packages_install": "sudo apt-get update && sudo apt-get install musl-tools", + "packages_install": "sudo apt-get update\nsudo apt-get install musl-tools", "cache_provider": "buildjet" }, { + "runner": "buildjet-8vcpu-ubuntu-2204", + "host": "x86_64-unknown-linux-gnu", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "targets": [ "x86_64-unknown-linux-gnu" ], - "runner": "buildjet-8vcpu-ubuntu-2204", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "buildjet" }, { - "targets": [ - "x86_64-unknown-linux-musl" - ], "runner": "buildjet-8vcpu-ubuntu-2204", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-musl", + "targets": [ + "x86_64-unknown-linux-musl" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-musl", - "packages_install": "sudo apt-get update && sudo apt-get install musl-tools", + "packages_install": "sudo apt-get update\nsudo apt-get install musl-tools", "cache_provider": "buildjet" } ] @@ -438,6 +441,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -448,6 +452,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -474,7 +485,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap b/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap index 9fc80400..1a4137dd 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap @@ -3779,67 +3779,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) axolotlsay-n "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -3961,6 +3965,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3971,6 +3976,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -3997,7 +4009,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_dispatch.snap b/cargo-dist/tests/snapshots/axolotlsay_dispatch.snap index 3f5550e1..5e6298a2 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_dispatch.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_dispatch.snap @@ -1,7 +1,6 @@ --- source: cargo-dist/tests/gallery/dist/snapshot.rs expression: self.payload -snapshot_kind: text --- ================ sha256.sum ================ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.gz @@ -254,67 +253,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -440,6 +443,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -450,6 +454,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -476,7 +487,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_dispatch_abyss.snap b/cargo-dist/tests/snapshots/axolotlsay_dispatch_abyss.snap index 7b0940bd..636d5d09 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_dispatch_abyss.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_dispatch_abyss.snap @@ -1,7 +1,6 @@ --- source: cargo-dist/tests/gallery/dist/snapshot.rs expression: self.payload -snapshot_kind: text --- ================ sha256.sum ================ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.gz @@ -262,67 +261,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -450,6 +453,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -460,6 +464,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -486,7 +497,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_dispatch_abyss_only.snap b/cargo-dist/tests/snapshots/axolotlsay_dispatch_abyss_only.snap index 3e8eb4da..4afce986 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_dispatch_abyss_only.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_dispatch_abyss_only.snap @@ -1,7 +1,6 @@ --- source: cargo-dist/tests/gallery/dist/snapshot.rs expression: self.payload -snapshot_kind: text --- ================ sha256.sum ================ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.gz @@ -255,67 +254,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -439,6 +442,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -449,6 +453,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -475,7 +486,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_dist_url_override.snap b/cargo-dist/tests/snapshots/axolotlsay_dist_url_override.snap index 1c578843..db87e6df 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_dist_url_override.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_dist_url_override.snap @@ -2125,67 +2125,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://dl.bearcove.cloud/dump/dist-cross/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://dl.bearcove.cloud/dump/dist-cross/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://dl.bearcove.cloud/dump/dist-cross/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://dl.bearcove.cloud/dump/dist-cross/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://dl.bearcove.cloud/dump/dist-cross/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://dl.bearcove.cloud/dump/dist-cross/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -2307,6 +2311,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -2317,6 +2322,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -2343,7 +2355,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap index 40bc9444..b46288ff 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap @@ -3713,67 +3713,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -3895,6 +3899,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3905,6 +3910,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -3931,7 +3943,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_generic_workspace_basic.snap b/cargo-dist/tests/snapshots/axolotlsay_generic_workspace_basic.snap index 24b60e88..0960e995 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_generic_workspace_basic.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_generic_workspace_basic.snap @@ -4342,67 +4342,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -4524,6 +4528,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -4534,6 +4539,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - uses: swatinem/rust-cache@v2 with: key: ${{ join(matrix.targets, '-') }} @@ -4564,7 +4576,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_homebrew_linux_only.snap b/cargo-dist/tests/snapshots/axolotlsay_homebrew_linux_only.snap index 6d58b56c..b57977e7 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_homebrew_linux_only.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_homebrew_linux_only.snap @@ -1,7 +1,6 @@ --- source: cargo-dist/tests/gallery/dist/snapshot.rs expression: self.payload -snapshot_kind: text --- ================ axolotlsay.rb ================ class Axolotlsay < Formula @@ -177,19 +176,20 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -311,6 +311,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -321,6 +322,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -347,7 +355,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_homebrew_macos_x86_64_only.snap b/cargo-dist/tests/snapshots/axolotlsay_homebrew_macos_x86_64_only.snap index a123e683..5fd6a3d3 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_homebrew_macos_x86_64_only.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_homebrew_macos_x86_64_only.snap @@ -1,7 +1,6 @@ --- source: cargo-dist/tests/gallery/dist/snapshot.rs expression: self.payload -snapshot_kind: text --- ================ axolotlsay.rb ================ class Axolotlsay < Formula @@ -180,19 +179,20 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { - "targets": [ - "x86_64-apple-darwin" - ], "runner": "macos-13", + "host": "x86_64-apple-darwin", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", + "targets": [ + "x86_64-apple-darwin" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" } ] @@ -314,6 +314,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -324,6 +325,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -350,7 +358,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap b/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap index edbe9ea6..43a6d56e 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap @@ -3791,69 +3791,73 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "packages_install": "cat << EOF >Brewfile\ncask \"homebrew/cask/macfuse\"\nbrew \"libcue\"\nEOF\n\nbrew bundle install", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "packages_install": "cat << EOF >Brewfile\ncask \"homebrew/cask/macfuse\"\nbrew \"libcue\"\nEOF\n\nbrew bundle install", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -3975,6 +3979,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3985,6 +3990,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -4011,7 +4023,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_musl.snap b/cargo-dist/tests/snapshots/axolotlsay_musl.snap index d640923b..c44d6438 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_musl.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_musl.snap @@ -3090,68 +3090,72 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { + "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "targets": [ "x86_64-unknown-linux-gnu" ], - "runner": "ubuntu-20.04", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-musl" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-musl", + "targets": [ + "x86_64-unknown-linux-musl" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-musl", - "packages_install": "sudo apt-get update && sudo apt-get install musl-tools", + "packages_install": "sudo apt-get update\nsudo apt-get install musl-tools", "cache_provider": "github" } ] @@ -3273,6 +3277,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3283,6 +3288,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -3309,7 +3321,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap b/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap index f778a184..7c5b4b22 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap @@ -3025,52 +3025,55 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-musl" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-musl", + "targets": [ + "x86_64-unknown-linux-musl" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-musl", - "packages_install": "sudo apt-get update && sudo apt-get install musl-tools", + "packages_install": "sudo apt-get update\nsudo apt-get install musl-tools", "cache_provider": "github" } ] @@ -3192,6 +3195,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3202,6 +3206,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -3228,7 +3239,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap index b3c667d7..31ec54be 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap @@ -3713,67 +3713,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -3895,6 +3899,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3905,6 +3910,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - uses: swatinem/rust-cache@v2 with: key: ${{ join(matrix.targets, '-') }} @@ -3935,7 +3947,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_no_locals.snap b/cargo-dist/tests/snapshots/axolotlsay_no_locals.snap index fb3f70e6..489ab137 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_no_locals.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_no_locals.snap @@ -254,67 +254,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] diff --git a/cargo-dist/tests/snapshots/axolotlsay_no_locals_but_custom.snap b/cargo-dist/tests/snapshots/axolotlsay_no_locals_but_custom.snap index 964bde3f..4795eba4 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_no_locals_but_custom.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_no_locals_but_custom.snap @@ -254,67 +254,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] diff --git a/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap b/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap index 7fd5a3d6..964cdbd3 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap @@ -3829,67 +3829,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -4011,6 +4015,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -4021,6 +4026,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -4047,7 +4059,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign.snap b/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign.snap index 85620b0e..627ac0f7 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign.snap @@ -2203,67 +2203,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -2385,6 +2389,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -2399,6 +2404,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -2425,7 +2437,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign_prod.snap b/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign_prod.snap index 85620b0e..627ac0f7 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign_prod.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign_prod.snap @@ -2203,67 +2203,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -2385,6 +2389,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -2399,6 +2404,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -2425,7 +2437,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_tag_namespace.snap b/cargo-dist/tests/snapshots/axolotlsay_tag_namespace.snap index 10ef2404..92300f69 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_tag_namespace.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_tag_namespace.snap @@ -1,7 +1,6 @@ --- source: cargo-dist/tests/gallery/dist/snapshot.rs expression: self.payload -snapshot_kind: text --- ================ sha256.sum ================ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.gz @@ -254,67 +253,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -436,6 +439,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -446,6 +450,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -472,7 +483,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap index c1d8584c..dd700b4b 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap @@ -3831,67 +3831,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -4013,6 +4017,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -4023,6 +4028,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -4049,7 +4061,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap index f189e2b3..ea37f428 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap @@ -3713,67 +3713,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -3895,6 +3899,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3905,6 +3910,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -3931,7 +3943,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap index c6a805af..e7df1dcd 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap @@ -3713,67 +3713,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -3895,6 +3899,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3905,6 +3910,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -3931,7 +3943,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap index 10461e87..dd03e80b 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap @@ -3713,67 +3713,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -3895,6 +3899,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3905,6 +3910,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -3931,7 +3943,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap index 362089c8..ee401fb5 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap @@ -3713,67 +3713,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -3905,6 +3909,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3915,6 +3920,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - uses: swatinem/rust-cache@v2 with: key: ${{ join(matrix.targets, '-') }} @@ -3945,7 +3957,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap index 2d32cad9..d9dd7794 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap @@ -3713,67 +3713,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] @@ -3895,6 +3899,7 @@ jobs: # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} + container: ${{ matrix.container && matrix.container.image || null }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json @@ -3905,6 +3910,13 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed + if: ${{ matrix.container }} + run: | + if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + fi - name: Install dist run: ${{ matrix.install_dist.run }} # Get the dist-manifest @@ -3931,7 +3943,7 @@ jobs: run: | # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" + dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" cp dist-manifest.json "$BUILD_MANIFEST_NAME" diff --git a/cargo-dist/tests/snapshots/install_path_cargo_home.snap b/cargo-dist/tests/snapshots/install_path_cargo_home.snap index 7538d8c0..d2357b16 100644 --- a/cargo-dist/tests/snapshots/install_path_cargo_home.snap +++ b/cargo-dist/tests/snapshots/install_path_cargo_home.snap @@ -2203,67 +2203,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] diff --git a/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap b/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap index 2e8a149b..90ecbf07 100644 --- a/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap +++ b/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap @@ -2179,67 +2179,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir.snap b/cargo-dist/tests/snapshots/install_path_env_subdir.snap index 9f36b273..f1b03ddc 100644 --- a/cargo-dist/tests/snapshots/install_path_env_subdir.snap +++ b/cargo-dist/tests/snapshots/install_path_env_subdir.snap @@ -2179,67 +2179,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap b/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap index a1e90f45..8a392422 100644 --- a/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap +++ b/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap @@ -2179,67 +2179,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap b/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap index d4c86e57..a4d48e0b 100644 --- a/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap +++ b/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap @@ -2179,67 +2179,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] diff --git a/cargo-dist/tests/snapshots/install_path_fallback_no_env_var_set.snap b/cargo-dist/tests/snapshots/install_path_fallback_no_env_var_set.snap index 341ee53c..0cdcbdfe 100644 --- a/cargo-dist/tests/snapshots/install_path_fallback_no_env_var_set.snap +++ b/cargo-dist/tests/snapshots/install_path_fallback_no_env_var_set.snap @@ -2202,67 +2202,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap index c2b8f0b8..a7e95eed 100644 --- a/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap +++ b/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap @@ -2179,67 +2179,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap index c02bb998..e5665143 100644 --- a/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap +++ b/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap @@ -2179,67 +2179,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap index 678049a7..7bcaaa79 100644 --- a/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap +++ b/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap @@ -2179,67 +2179,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap index 274f8fa7..6c33ff89 100644 --- a/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap +++ b/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap @@ -2179,67 +2179,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] diff --git a/cargo-dist/tests/snapshots/install_path_no_fallback_taken.snap b/cargo-dist/tests/snapshots/install_path_no_fallback_taken.snap index 7d78741e..9daa8fcf 100644 --- a/cargo-dist/tests/snapshots/install_path_no_fallback_taken.snap +++ b/cargo-dist/tests/snapshots/install_path_no_fallback_taken.snap @@ -2202,67 +2202,71 @@ CENSORED (see https://github.com/axodotdev/cargo-dist/issues/1477) source.tar.g "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "targets": [ "x86_64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-gnu" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", + "targets": [ + "x86_64-unknown-linux-gnu" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" } ] diff --git a/cargo-dist/tests/snapshots/manifest.snap b/cargo-dist/tests/snapshots/manifest.snap index 522efece..3e48886f 100644 --- a/cargo-dist/tests/snapshots/manifest.snap +++ b/cargo-dist/tests/snapshots/manifest.snap @@ -522,117 +522,124 @@ stdout: "artifacts_matrix": { "include": [ { + "runner": "macos-13", + "host": "x86_64-apple-darwin", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v1.0.0-FAKEVERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "targets": [ "aarch64-apple-darwin" ], - "runner": "macos-13", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v1.0.0-FAKEVERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-apple-darwin", "cache_provider": "github" }, { + "runner": "buildjet-8vcpu-ubuntu-2204-arm", + "host": "aarch64-unknown-linux-gnu", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v1.0.0-FAKEVERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-unknown-linux-gnu", "targets": [ "aarch64-unknown-linux-gnu" ], - "runner": "buildjet-8vcpu-ubuntu-2204-arm", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v1.0.0-FAKEVERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-unknown-linux-gnu", "cache_provider": "buildjet" }, { + "runner": "buildjet-8vcpu-ubuntu-2204-arm", + "host": "aarch64-unknown-linux-gnu", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v1.0.0-FAKEVERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=aarch64-unknown-linux-musl", "targets": [ "aarch64-unknown-linux-musl" ], - "runner": "buildjet-8vcpu-ubuntu-2204-arm", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v1.0.0-FAKEVERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=aarch64-unknown-linux-musl", - "packages_install": "sudo apt-get update && sudo apt-get install musl-tools", + "packages_install": "sudo apt-get update\nsudo apt-get install musl-tools", "cache_provider": "buildjet" }, { - "targets": [ - "x86_64-apple-darwin" - ], "runner": "macos-13", + "host": "x86_64-apple-darwin", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v1.0.0-FAKEVERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-apple-darwin", + "targets": [ + "x86_64-apple-darwin" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-apple-darwin", "cache_provider": "github" }, { - "targets": [ - "x86_64-pc-windows-msvc" - ], "runner": "windows-2019", + "host": "x86_64-pc-windows-msvc", "install_dist": { "shell": "pwsh", "run": "irm https://github.com/axodotdev/cargo-dist/releases/download/v1.0.0-FAKEVERSION/cargo-dist-installer.ps1 | iex" }, + "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", + "targets": [ + "x86_64-pc-windows-msvc" + ], "install_cargo_auditable": { "shell": "pwsh", "run": "powershell -c \"irm https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.ps1 | iex\"" }, - "dist_args": "--artifacts=local --target=x86_64-pc-windows-msvc", "cache_provider": "github" }, { + "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", + "install_dist": { + "shell": "sh", + "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v1.0.0-FAKEVERSION/cargo-dist-installer.sh | sh" + }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "targets": [ "x86_64-unknown-linux-gnu" ], - "runner": "ubuntu-20.04", - "install_dist": { - "shell": "sh", - "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v1.0.0-FAKEVERSION/cargo-dist-installer.sh | sh" - }, "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-gnu", "cache_provider": "github" }, { - "targets": [ - "x86_64-unknown-linux-musl" - ], "runner": "ubuntu-20.04", + "host": "x86_64-unknown-linux-gnu", "install_dist": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v1.0.0-FAKEVERSION/cargo-dist-installer.sh | sh" }, + "dist_args": "--artifacts=local --target=x86_64-unknown-linux-musl", + "targets": [ + "x86_64-unknown-linux-musl" + ], "install_cargo_auditable": { "shell": "sh", "run": "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-secure-code/cargo-auditable/releases/latest/download/cargo-auditable-installer.sh | sh" }, - "dist_args": "--artifacts=local --target=x86_64-unknown-linux-musl", - "packages_install": "sudo apt-get update && sudo apt-get install musl-tools", + "packages_install": "sudo apt-get update\nsudo apt-get install musl-tools", "cache_provider": "github" } ]