Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: Add aarch64-apple-darwin support #143

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -127,4 +133,4 @@ jobs:
- uses: actions/checkout@v3
- name: mark release as non-draft
run: |
gh release edit ${{ github.ref_name }} --draft=false
gh release edit ${{ github.ref_name }} --draft=false
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand Down Expand Up @@ -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.
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.
23 changes: 20 additions & 3 deletions cargo-dist/src/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ fn write_github_ci<W: std::io::Write>(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,
);
Expand All @@ -92,10 +93,16 @@ fn write_github_ci<W: std::io::Write>(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
Expand All @@ -114,18 +121,28 @@ fn write_github_ci<W: std::io::Write>(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,
) {
use std::fmt::Write;

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::<Vec<&str>>()
.join(" "),
)
.replace("{{{{DIST_ARGS}}}}", dist_args)
.replace("{{{{INSTALL_DIST}}}}", install_dist);

Expand Down
6 changes: 4 additions & 2 deletions cargo-dist/src/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -115,4 +117,4 @@ jobs:
- uses: actions/checkout@v3
- name: mark release as non-draft
run: |
gh release edit ${{ github.ref_name }} --draft=false
gh release edit ${{ github.ref_name }} --draft=false
2 changes: 1 addition & 1 deletion cargo-dist/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ fn default_desktop_targets() -> Vec<String> {
"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(),
]
}
35 changes: 35 additions & 0 deletions cargo-dist/tests/snapshots/cli_tests__manifest.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand All @@ -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",
Expand Down