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
10 changes: 8 additions & 2 deletions .github/workflows/release.yml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -78,15 +78,19 @@ jobs:
# For these target platforms # For these target platforms
include: include:
- os: ubuntu-20.04 - os: ubuntu-20.04
targets: x86_64-unknown-linux-gnu
dist-args: --artifacts=global 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 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 - 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 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 - os: ubuntu-20.04
targets: x86_64-unknown-linux-gnu
dist-args: --artifacts=local --target=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 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 - os: windows-2019
targets: x86_64-pc-windows-msvc
dist-args: --artifacts=local --target=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 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: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust - 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 - name: Install cargo-dist
run: ${{ matrix.install-dist }} run: ${{ matrix.install-dist }}
- name: Run cargo-dist - name: Run cargo-dist
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ci = ["github"]
# The installers to generate for each app # The installers to generate for each app
installers = ["shell", "powershell"] installers = ["shell", "powershell"]
# Target platforms to build apps for (Rust target-triple syntax) # 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 # The profile that 'cargo dist' will build with
[profile.dist] [profile.dist]
Expand Down
1 change: 1 addition & 0 deletions RELEASES.md
Original file line number Original file line 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 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) * 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). * --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
23 changes: 20 additions & 3 deletions cargo-dist/src/ci.rs
Original file line number Original file line 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 // 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 // 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 { if needs_global_build {
push_github_artifacts_matrix_entry( push_github_artifacts_matrix_entry(
&mut artifacts_matrix, &mut artifacts_matrix,
GITHUB_LINUX_RUNNER, GITHUB_LINUX_RUNNER,
&[&"x86_64-unknown-linux-gnu".to_owned()],
"--artifacts=global", "--artifacts=global",
&install_dist_sh, &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 = let install_dist =
install_dist_for_github_runner(runner, &install_dist_sh, &install_dist_ps1); install_dist_for_github_runner(runner, &install_dist_sh, &install_dist_ps1);
let mut dist_args = String::from("--artifacts=local"); let mut dist_args = String::from("--artifacts=local");
for target in targets { for target in &targets {
write!(dist_args, " --target={target}").unwrap(); 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 // 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( fn push_github_artifacts_matrix_entry(
matrix: &mut String, matrix: &mut String,
runner: &str, runner: &str,
targets: &[&TargetTriple],
dist_args: &str, dist_args: &str,
install_dist: &str, install_dist: &str,
) { ) {
use std::fmt::Write; use std::fmt::Write;


const MATRIX_ENTRY_TEMPLATE: &str = r###" const MATRIX_ENTRY_TEMPLATE: &str = r###"
- os: {{{{GITHUB_RUNNER}}}} - os: {{{{GITHUB_RUNNER}}}}
targets: {{{{TARGETS}}}}
dist-args: {{{{DIST_ARGS}}}} dist-args: {{{{DIST_ARGS}}}}
install-dist: {{{{INSTALL_DIST}}}}"###; install-dist: {{{{INSTALL_DIST}}}}"###;


let entry = MATRIX_ENTRY_TEMPLATE let entry = MATRIX_ENTRY_TEMPLATE
.replace("{{{{GITHUB_RUNNER}}}}", runner) .replace("{{{{GITHUB_RUNNER}}}}", runner)
.replace(
"{{{{TARGETS}}}}",
&targets
.iter()
.map(AsRef::as_ref)
.collect::<Vec<&str>>()
.join(" "),
)
.replace("{{{{DIST_ARGS}}}}", dist_args) .replace("{{{{DIST_ARGS}}}}", dist_args)
.replace("{{{{INSTALL_DIST}}}}", install_dist); .replace("{{{{INSTALL_DIST}}}}", install_dist);


Expand Down
4 changes: 3 additions & 1 deletion cargo-dist/src/ci.yml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust - name: Install Rust
run: {{{{INSTALL_RUST}}}} run: |
{{{{INSTALL_RUST}}}}
rustup target add ${{ matrix.targets }}
- name: Install cargo-dist - name: Install cargo-dist
run: ${{ matrix.install-dist }} run: ${{ matrix.install-dist }}
- name: Run cargo-dist - name: Run cargo-dist
Expand Down
2 changes: 1 addition & 1 deletion cargo-dist/src/main.rs
Original file line number Original file line 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-unknown-linux-gnu".to_owned(),
"x86_64-apple-darwin".to_owned(), "x86_64-apple-darwin".to_owned(),
"x86_64-pc-windows-msvc".to_owned(), "x86_64-pc-windows-msvc".to_owned(),
"aarch64-apple-darwin".to_owned(),
// cross-compiles not yet supported // cross-compiles not yet supported
// "aarch64-gnu-unknown-linux".to_owned(), // "aarch64-gnu-unknown-linux".to_owned(),
// "aarch64-pc-windows-msvc".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 Original file line Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ stdout:
"name": "cargo-dist-v1.0.0-FAKEVERSION-installer.sh", "name": "cargo-dist-v1.0.0-FAKEVERSION-installer.sh",
"kind": "installer", "kind": "installer",
"target_triples": [ "target_triples": [
"aarch64-apple-darwin",
"x86_64-apple-darwin", "x86_64-apple-darwin",
"x86_64-unknown-linux-gnu" "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", "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" "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", "name": "cargo-dist-v1.0.0-FAKEVERSION-x86_64-apple-darwin.tar.xz",
"kind": "executable-zip", "kind": "executable-zip",
Expand Down