Skip to content

Commit

Permalink
Build for M1 on CI (software-mansion#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
wkozyra95 committed Oct 3, 2023
1 parent ce7f957 commit 9e321f9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/package_for_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
name: video_compositor_linux_x86_64.tar.gz
path: video_compositor_linux_x86_64.tar.gz

macos:
macos_x86_64:
runs-on: macos-latest
steps:
- name: 🛠 Install system dependencies
Expand All @@ -44,3 +44,23 @@ jobs:
with:
name: video_compositor_darwin_x86_64.tar.gz
path: video_compositor_darwin_x86_64.tar.gz

macos-aarch64:
runs-on: macos-latest-xlarge
steps:
- name: 🛠 Install system dependencies
run: brew install ffmpeg

- name: 🔧 Install the rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: 📥 Checkout repo
uses: actions/checkout@v3

- name: 📦 Package
run: cargo run --bin package_for_release

- uses: actions/upload-artifact@v3
with:
name: video_compositor_darwin_aarch64.tar.gz
path: video_compositor_darwin_aarch64.tar.gz
2 changes: 2 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ cd "$ROOT_DIR/release_tmp"

gh run download "$WORKFLOW_RUN_ID" -n video_compositor_linux_x86_64.tar.gz
gh run download "$WORKFLOW_RUN_ID" -n video_compositor_darwin_x86_64.tar.gz
gh run download "$WORKFLOW_RUN_ID" -n video_compositor_darwin_aarch64.tar.gz
gh release create "$RELEASE_TAG"
gh release upload "$RELEASE_TAG" video_compositor_linux_x86_64.tar.gz
gh release upload "$RELEASE_TAG" video_compositor_darwin_x86_64.tar.gz
gh release upload "$RELEASE_TAG" video_compositor_darwin_aarch64.tar.gz

rm -rf "$ROOT_DIR/release_tmp"
18 changes: 0 additions & 18 deletions src/bin/package_for_release/bundle_macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,6 @@ pub fn bundle_macos_app() -> Result<()> {
bundle_app(INTEL_MAC_TARGET, INTEL_OUTPUT_FILE)?;
} else if cfg!(target_arch = "aarch64") {
bundle_app(ARM_MAC_TARGET, ARM_OUTPUT_FILE)?;
// We do not have CI with M1 yet, so this will be built locally for now.
let release_tag = env::var("RELEASE_TAG")?;
let root_dir_str = env!("CARGO_MANIFEST_DIR");
let root_dir: PathBuf = root_dir_str.into();
let upload_path = root_dir.join(ARM_OUTPUT_FILE);
let exit_code = Command::new("gh")
.args([
"release",
"upload",
&release_tag,
&upload_path.display().to_string(),
])
.spawn()?
.wait()?
.code();
if exit_code != Some(0) {
return Err(anyhow!("Command gh failed with exit code {:?}", exit_code));
}
} else {
panic!("Unknown architecture")
}
Expand Down

0 comments on commit 9e321f9

Please sign in to comment.