diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 22efe7fe3..dbba7a617 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -78,15 +78,19 @@ jobs: # For these target platforms include: - os: ubuntu-20.04 + targets: x86_64-unknown-linux-gnu dist-args: --artifacts=global install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.3-prerelease04/cargo-dist-v0.0.3-prerelease04-installer.sh | sh - os: macos-11 - dist-args: --artifacts=local --target=x86_64-apple-darwin + targets: aarch64-apple-darwin x86_64-apple-darwin + dist-args: --artifacts=local --target=aarch64-apple-darwin --target=x86_64-apple-darwin install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.3-prerelease04/cargo-dist-v0.0.3-prerelease04-installer.sh | sh - os: ubuntu-20.04 + targets: x86_64-unknown-linux-gnu dist-args: --artifacts=local --target=x86_64-unknown-linux-gnu install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.3-prerelease04/cargo-dist-v0.0.3-prerelease04-installer.sh | sh - os: windows-2019 + targets: x86_64-pc-windows-msvc dist-args: --artifacts=local --target=x86_64-pc-windows-msvc install-dist: irm https://github.com/axodotdev/cargo-dist/releases/download/v0.0.3-prerelease04/cargo-dist-v0.0.3-prerelease04-installer.ps1 | iex @@ -96,7 +100,9 @@ jobs: steps: - uses: actions/checkout@v3 - name: Install Rust - run: rustup update 1.67.1 --no-self-update && rustup default 1.67.1 + run: | + rustup update 1.67.1 --no-self-update && rustup default 1.67.1 + rustup target add ${{ matrix.targets }} - name: Install cargo-dist run: ${{ matrix.install-dist }} - name: Run cargo-dist @@ -127,4 +133,4 @@ jobs: - uses: actions/checkout@v3 - name: mark release as non-draft run: | - gh release edit ${{ github.ref_name }} --draft=false \ No newline at end of file + gh release edit ${{ github.ref_name }} --draft=false diff --git a/Cargo.toml b/Cargo.toml index fc3c5c243..ed0bc37e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ ci = ["github"] # The installers to generate for each app installers = ["shell", "powershell"] # Target platforms to build apps for (Rust target-triple syntax) -targets = ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc"] +targets = ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-pc-windows-msvc"] # The profile that 'cargo dist' will build with [profile.dist] diff --git a/RELEASES.md b/RELEASES.md index db08e97ff..45c1f9ffc 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -114,6 +114,7 @@ Release notes are now temporarily simplified for reliability: * Installers now properly handle packages that define multiple binaries (installing all of them, just like cargo-install) * Installers now properly know the Github Release they are going to point to (previously they would guess based on the version of the package which was broken in complicated workflows) * --installer=github-shell and --installer=github-powershell have had the "github-" prefix removed. They now generically use the concept of an "artifact download url" which will be configurable in the future (for now it only gets populated if ci=github is set and your workspace has a coherent definition for "repository" in its Cargo.tomls). +* Added aarch64-apple-darwin target support @@ -145,4 +146,4 @@ cargo-dist-schema: This is the first alpha release of cargo-dist with some minimal functionality! -There are also a couple 0.0.1 prereleases that came before this one that exist to define a sort of "bootstrapping history" for the first "real" release's binary builds because I find it vaguely satisfying and you can't stop me. \ No newline at end of file +There are also a couple 0.0.1 prereleases that came before this one that exist to define a sort of "bootstrapping history" for the first "real" release's binary builds because I find it vaguely satisfying and you can't stop me. diff --git a/cargo-dist/src/ci.rs b/cargo-dist/src/ci.rs index 5666722fb..cda8a1bfb 100644 --- a/cargo-dist/src/ci.rs +++ b/cargo-dist/src/ci.rs @@ -75,11 +75,12 @@ fn write_github_ci(f: &mut W, dist: &DistGraph) -> Result<(), // If we have Global Artifacts, we need one task for that. If we've done a Good Job // then these artifacts should be possible to build on *any* platform. Linux is usually - // fast/cheap, so that's a reasonable choice.s + // fast/cheap, so that's a reasonable choice. if needs_global_build { push_github_artifacts_matrix_entry( &mut artifacts_matrix, GITHUB_LINUX_RUNNER, + &[&"x86_64-unknown-linux-gnu".to_owned()], "--artifacts=global", &install_dist_sh, ); @@ -92,10 +93,16 @@ fn write_github_ci(f: &mut W, dist: &DistGraph) -> Result<(), let install_dist = install_dist_for_github_runner(runner, &install_dist_sh, &install_dist_ps1); let mut dist_args = String::from("--artifacts=local"); - for target in targets { + for target in &targets { write!(dist_args, " --target={target}").unwrap(); } - push_github_artifacts_matrix_entry(&mut artifacts_matrix, runner, &dist_args, install_dist); + push_github_artifacts_matrix_entry( + &mut artifacts_matrix, + runner, + &targets, + &dist_args, + install_dist, + ); } // Finally write the final CI script to the Writer @@ -114,6 +121,7 @@ fn write_github_ci(f: &mut W, dist: &DistGraph) -> Result<(), fn push_github_artifacts_matrix_entry( matrix: &mut String, runner: &str, + targets: &[&TargetTriple], dist_args: &str, install_dist: &str, ) { @@ -121,11 +129,20 @@ fn push_github_artifacts_matrix_entry( const MATRIX_ENTRY_TEMPLATE: &str = r###" - os: {{{{GITHUB_RUNNER}}}} + targets: {{{{TARGETS}}}} dist-args: {{{{DIST_ARGS}}}} install-dist: {{{{INSTALL_DIST}}}}"###; let entry = MATRIX_ENTRY_TEMPLATE .replace("{{{{GITHUB_RUNNER}}}}", runner) + .replace( + "{{{{TARGETS}}}}", + &targets + .iter() + .map(AsRef::as_ref) + .collect::>() + .join(" "), + ) .replace("{{{{DIST_ARGS}}}}", dist_args) .replace("{{{{INSTALL_DIST}}}}", install_dist); diff --git a/cargo-dist/src/ci.yml b/cargo-dist/src/ci.yml index e436aaaf1..75e44e4e3 100644 --- a/cargo-dist/src/ci.yml +++ b/cargo-dist/src/ci.yml @@ -84,7 +84,9 @@ jobs: steps: - uses: actions/checkout@v3 - name: Install Rust - run: {{{{INSTALL_RUST}}}} + run: | + {{{{INSTALL_RUST}}}} + rustup target add ${{ matrix.targets }} - name: Install cargo-dist run: ${{ matrix.install-dist }} - name: Run cargo-dist @@ -115,4 +117,4 @@ jobs: - uses: actions/checkout@v3 - name: mark release as non-draft run: | - gh release edit ${{ github.ref_name }} --draft=false \ No newline at end of file + gh release edit ${{ github.ref_name }} --draft=false diff --git a/cargo-dist/src/main.rs b/cargo-dist/src/main.rs index f567d0202..065fff526 100644 --- a/cargo-dist/src/main.rs +++ b/cargo-dist/src/main.rs @@ -304,9 +304,9 @@ fn default_desktop_targets() -> Vec { "x86_64-unknown-linux-gnu".to_owned(), "x86_64-apple-darwin".to_owned(), "x86_64-pc-windows-msvc".to_owned(), + "aarch64-apple-darwin".to_owned(), // cross-compiles not yet supported // "aarch64-gnu-unknown-linux".to_owned(), // "aarch64-pc-windows-msvc".to_owned(), - // "aarch64-apple-darwin".to_owned(), ] } diff --git a/cargo-dist/tests/snapshots/cli_tests__manifest.snap b/cargo-dist/tests/snapshots/cli_tests__manifest.snap index f2b44cdc9..e006d2f37 100644 --- a/cargo-dist/tests/snapshots/cli_tests__manifest.snap +++ b/cargo-dist/tests/snapshots/cli_tests__manifest.snap @@ -19,6 +19,7 @@ stdout: "name": "cargo-dist-v1.0.0-FAKEVERSION-installer.sh", "kind": "installer", "target_triples": [ + "aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu" ], @@ -34,6 +35,40 @@ stdout: "install_hint": "# WARNING: this installer is experimental\nirm https://github.com/axodotdev/cargo-dist/releases/download/v1.0.0-FAKEVERSION/cargo-dist-v1.0.0-FAKEVERSION-installer.ps1 | iex", "description": "Install prebuilt binaries via powershell script" }, + { + "name": "cargo-dist-v1.0.0-FAKEVERSION-aarch64-apple-darwin.tar.xz", + "kind": "executable-zip", + "target_triples": [ + "aarch64-apple-darwin" + ], + "assets": [ + { + "name": "LICENSE-APACHE", + "path": "LICENSE-APACHE", + "kind": "license" + }, + { + "name": "LICENSE-MIT", + "path": "LICENSE-MIT", + "kind": "license" + }, + { + "name": "README.md", + "path": "README.md", + "kind": "readme" + }, + { + "name": "RELEASES.md", + "path": "RELEASES.md", + "kind": "changelog" + }, + { + "name": "cargo-dist", + "path": "cargo-dist", + "kind": "executable" + } + ] + }, { "name": "cargo-dist-v1.0.0-FAKEVERSION-x86_64-apple-darwin.tar.xz", "kind": "executable-zip",