Merge pull request #30 from zed-industries/bundle

WIP: Create and upload application bundle in CI
This commit is contained in:
Nathan Sobo 2021-05-04 18:02:47 -06:00 committed by GitHub
commit 2ce9f271b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 830 additions and 58 deletions

View File

@ -32,15 +32,24 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
~/.rustup
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Install rust
- name: Install Rust
if: steps.cache.outputs.cache-hit != 'true'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-apple-darwin
profile: minimal
- name: Run tests
run: cargo test --no-fail-fast
- name: Create and upload app bundle
run: script/bundle
- uses: actions/upload-artifact@v2
with:
name: Zed.dmg
path: target/release/Zed.dmg

841
Cargo.lock generated

File diff suppressed because it is too large Load Diff

29
script/bundle Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
set -e
# Build the app bundle for x86_64
pushd zed > /dev/null
cargo bundle --release --target x86_64-apple-darwin
popd > /dev/null
# Build the binary for aarch64 (Apple M1)
cargo build --release --target aarch64-apple-darwin
# Replace the bundle's binary with a "fat binary" that combines the two architecture-specific binaries
lipo -create target/x86_64-apple-darwin/release/Zed target/aarch64-apple-darwin/release/Zed -output target/x86_64-apple-darwin/release/bundle/osx/Zed.app/Contents/MacOS/zed
# Sign the app bundle with an ad-hoc signature so it runs on the M1. We need a real certificate but this works for now.
codesign --force --deep -s - target/x86_64-apple-darwin/release/bundle/osx/Zed.app
# Create a DMG
mkdir -p target/release
hdiutil create -volname Zed -srcfolder target/x86_64-apple-darwin/release/bundle/osx -ov -format UDZO target/release/Zed.dmg
# If -o option is specified, open the target/release directory in Finder to reveal the DMG
while getopts o flag
do
case "${flag}" in
o) open target/release;;
esac
done

View File

@ -1,5 +1,6 @@
[package]
authors = ["Nathan Sobo <nathansobo@gmail.com>"]
description = "The fast, collaborative code editor."
edition = "2018"
name = "zed"
version = "0.1.0"
@ -38,7 +39,13 @@ smallvec = "1.6.1"
smol = "1.2.5"
[dev-dependencies]
cargo-bundle = "0.5.0"
env_logger = "0.8"
serde_json = {version = "1.0.64", features = ["preserve_order"]}
tempdir = "0.3.7"
unindent = "0.1.7"
[package.metadata.bundle]
icon = ["app-icon@2x.png", "app-icon.png"]
identifier = "dev.zed.Zed"
name = "Zed"

BIN
zed/app-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

BIN
zed/app-icon@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 KiB