Skip to content

Commit 4cc6d6a

Browse files
osiewiczConradIrwinprobably-neb
authored
ci: Notarize in parallel (different flavor) (#41392)
Release Notes: - N/A --------- Co-authored-by: Conrad Irwin <[email protected]> Co-authored-by: Ben Kunkle <[email protected]> Co-authored-by: Conrad Irwin <[email protected]>
1 parent b9eafb8 commit 4cc6d6a

File tree

7 files changed

+198
-138
lines changed

7 files changed

+198
-138
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,11 @@ jobs:
563563
env:
564564
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
565565

566-
- name: Create macOS app bundle
567-
run: script/bundle-mac
566+
- name: Create macOS app bundle (aarch64)
567+
run: script/bundle-mac aarch64-apple-darwin
568+
569+
- name: Create macOS app bundle (x64)
570+
run: script/bundle-mac x86_64-apple-darwin
568571

569572
- name: Rename binaries
570573
run: |

.github/workflows/release_nightly.yml

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
Remove-Item -Recurse -Path "./../.cargo" -Force -ErrorAction SilentlyContinue
9797
shell: pwsh
9898
timeout-minutes: 60
99-
bundle_mac_nightly:
99+
bundle_mac_nightly_x86_64:
100100
needs:
101101
- check_style
102102
- run_tests_mac
@@ -131,11 +131,53 @@ jobs:
131131
echo "Publishing version: ${version} on release channel nightly"
132132
echo "nightly" > crates/zed/RELEASE_CHANNEL
133133
shell: bash -euxo pipefail {0}
134-
- name: ./script/bundle-mac
135-
run: ./script/bundle-mac
134+
- name: run_bundling::bundle_mac
135+
run: ./script/bundle-mac x86_64-apple-darwin
136136
shell: bash -euxo pipefail {0}
137137
- name: release_nightly::upload_zed_nightly
138-
run: script/upload-nightly macos
138+
run: script/upload-nightly macos x86_64
139+
shell: bash -euxo pipefail {0}
140+
timeout-minutes: 60
141+
bundle_mac_nightly_aarch64:
142+
needs:
143+
- check_style
144+
- run_tests_mac
145+
if: github.repository_owner == 'zed-industries'
146+
runs-on: self-mini-macos
147+
env:
148+
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
149+
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
150+
APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }}
151+
APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
152+
APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
153+
steps:
154+
- name: steps::checkout_repo
155+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
156+
with:
157+
clean: false
158+
- name: steps::setup_node
159+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
160+
with:
161+
node-version: '20'
162+
- name: steps::setup_sentry
163+
uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b
164+
with:
165+
token: ${{ secrets.SENTRY_AUTH_TOKEN }}
166+
- name: steps::clear_target_dir_if_large
167+
run: ./script/clear-target-dir-if-larger-than 300
168+
shell: bash -euxo pipefail {0}
169+
- name: release_nightly::set_release_channel_to_nightly
170+
run: |
171+
set -eu
172+
version=$(git rev-parse --short HEAD)
173+
echo "Publishing version: ${version} on release channel nightly"
174+
echo "nightly" > crates/zed/RELEASE_CHANNEL
175+
shell: bash -euxo pipefail {0}
176+
- name: run_bundling::bundle_mac
177+
run: ./script/bundle-mac aarch64-apple-darwin
178+
shell: bash -euxo pipefail {0}
179+
- name: release_nightly::upload_zed_nightly
180+
run: script/upload-nightly macos aarch64
139181
shell: bash -euxo pipefail {0}
140182
timeout-minutes: 60
141183
bundle_linux_nightly_x86_64:
@@ -176,7 +218,7 @@ jobs:
176218
run: ./script/bundle-linux
177219
shell: bash -euxo pipefail {0}
178220
- name: release_nightly::upload_zed_nightly
179-
run: script/upload-nightly linux-targz
221+
run: script/upload-nightly linux-targz x86_64
180222
shell: bash -euxo pipefail {0}
181223
timeout-minutes: 60
182224
bundle_linux_nightly_aarch64:
@@ -214,7 +256,7 @@ jobs:
214256
run: ./script/bundle-linux
215257
shell: bash -euxo pipefail {0}
216258
- name: release_nightly::upload_zed_nightly
217-
run: script/upload-nightly linux-targz
259+
run: script/upload-nightly linux-targz aarch64
218260
shell: bash -euxo pipefail {0}
219261
timeout-minutes: 60
220262
bundle_windows_nightly_x86_64:
@@ -372,7 +414,8 @@ jobs:
372414
continue-on-error: true
373415
update_nightly_tag:
374416
needs:
375-
- bundle_mac_nightly
417+
- bundle_mac_nightly_x86_64
418+
- bundle_mac_nightly_aarch64
376419
- bundle_linux_nightly_x86_64
377420
- bundle_linux_nightly_aarch64
378421
- bundle_windows_nightly_x86_64

.github/workflows/run_bundling.yml

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
- labeled
1414
- synchronize
1515
jobs:
16-
bundle_mac:
16+
bundle_mac_x86_64:
1717
if: |-
1818
(github.event.action == 'labeled' && github.event.label.name == 'run-bundling') ||
1919
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'run-bundling'))
@@ -40,19 +40,60 @@ jobs:
4040
- name: steps::clear_target_dir_if_large
4141
run: ./script/clear-target-dir-if-larger-than 300
4242
shell: bash -euxo pipefail {0}
43-
- name: ./script/bundle-mac
44-
run: ./script/bundle-mac
43+
- name: run_bundling::bundle_mac
44+
run: ./script/bundle-mac x86_64-apple-darwin
45+
shell: bash -euxo pipefail {0}
46+
- name: '@actions/upload-artifact Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg'
47+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
48+
with:
49+
name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg
50+
path: target/x86_64-apple-darwin/release/Zed.dmg
51+
- name: '@actions/upload-artifact zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-x86_64.gz'
52+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
53+
with:
54+
name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-x86_64.gz
55+
path: target/zed-remote-server-macos-x86_64.gz
56+
timeout-minutes: 60
57+
bundle_mac_arm64:
58+
if: |-
59+
(github.event.action == 'labeled' && github.event.label.name == 'run-bundling') ||
60+
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'run-bundling'))
61+
runs-on: self-mini-macos
62+
env:
63+
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
64+
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
65+
APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }}
66+
APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
67+
APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
68+
steps:
69+
- name: steps::checkout_repo
70+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
71+
with:
72+
clean: false
73+
- name: steps::setup_node
74+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
75+
with:
76+
node-version: '20'
77+
- name: steps::setup_sentry
78+
uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b
79+
with:
80+
token: ${{ secrets.SENTRY_AUTH_TOKEN }}
81+
- name: steps::clear_target_dir_if_large
82+
run: ./script/clear-target-dir-if-larger-than 300
83+
shell: bash -euxo pipefail {0}
84+
- name: run_bundling::bundle_mac
85+
run: ./script/bundle-mac aarch64-apple-darwin
4586
shell: bash -euxo pipefail {0}
4687
- name: '@actions/upload-artifact Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg'
4788
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
4889
with:
4990
name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg
5091
path: target/aarch64-apple-darwin/release/Zed.dmg
51-
- name: '@actions/upload-artifact Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg'
92+
- name: '@actions/upload-artifact zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-aarch64.gz'
5293
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
5394
with:
54-
name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg
55-
path: target/x86_64-apple-darwin/release/Zed.dmg
95+
name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-aarch64.gz
96+
path: target/zed-remote-server-macos-aarch64.gz
5697
timeout-minutes: 60
5798
bundle_linux_x86_64:
5899
if: |-

script/bundle-mac

Lines changed: 35 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ open_result=false
99
local_arch=false
1010
local_only=false
1111
local_install=false
12-
bundle_name=""
1312
can_code_sign=false
1413

1514
# This must match the team in the provisioning profile.
@@ -19,12 +18,11 @@ APPLE_NOTARIZATION_TEAM="MQ55VZLNZQ"
1918
# Function for displaying help info
2019
help_info() {
2120
echo "
22-
Usage: ${0##*/} [options] [bundle_name]
21+
Usage: ${0##*/} [options] [architecture=host]
2322
Build the application bundle for macOS.
2423
2524
Options:
2625
-d Compile in debug mode
27-
-l Compile for local architecture only.
2826
-o Open dir with the resulting DMG or launch the app itself in local mode.
2927
-i Install the resulting DMG into /Applications in local mode. Noop without -l.
3028
-h Display this help and exit.
@@ -41,12 +39,6 @@ do
4139
build_flag="";
4240
target_dir="debug"
4341
;;
44-
l)
45-
export CARGO_INCREMENTAL=true
46-
export CARGO_BUNDLE_SKIP_BUILD=true
47-
local_arch=true
48-
local_only=true
49-
;;
5042
i) local_install=true;;
5143
h)
5244
help_info
@@ -57,11 +49,6 @@ done
5749

5850
shift $((OPTIND-1))
5951

60-
if [[ $# -gt 0 ]]; then
61-
if [ "$1" ]; then
62-
bundle_name=$1
63-
fi
64-
fi
6552

6653
# Get release channel
6754
pushd crates/zed
@@ -81,24 +68,31 @@ export CXXFLAGS="-stdlib=libc++"
8168

8269
version_info=$(rustc --version --verbose)
8370
host_line=$(echo "$version_info" | grep host)
84-
local_target_triple=${host_line#*: }
71+
target_triple=${host_line#*: }
72+
if [[ $# -gt 0 && -n "$1" ]]; then
73+
target_triple="$1"
74+
fi
75+
remote_server_arch=""
76+
77+
if [[ "$target_triple" = "x86_64-apple-darwin" ]]; then
78+
remote_server_arch="x86_64"
79+
elif [[ "$target_triple" = "aarch64-apple-darwin" ]]; then
80+
remote_server_arch="aarch64"
81+
else
82+
echo "Unsupported architecture $target_triple"
83+
exit 1
84+
fi
8585

8686
# Generate the licenses first, so they can be baked into the binaries
8787
script/generate-licenses
8888

89-
if [ "$local_arch" = true ]; then
90-
echo "Building for local target only."
91-
cargo build ${build_flag} --package zed --package cli --package remote_server
92-
else
93-
rustup target add aarch64-apple-darwin
94-
rustup target add x86_64-apple-darwin
95-
96-
echo "Compiling zed binaries"
97-
cargo build ${build_flag} --package zed --package cli --target aarch64-apple-darwin --target x86_64-apple-darwin
98-
# Build remote_server in separate invocation to prevent feature unification from other crates
99-
# from influencing dynamic libraries required by it.
100-
cargo build ${build_flag} --package remote_server --target aarch64-apple-darwin --target x86_64-apple-darwin
101-
fi
89+
rustup target add $target_triple
90+
91+
echo "Compiling zed binaries"
92+
cargo build ${build_flag} --package zed --package cli --target $target_triple
93+
# Build remote_server in separate invocation to prevent feature unification from other crates
94+
# from influencing dynamic libraries required by it.
95+
cargo build ${build_flag} --package remote_server --target $target_triple
10296

10397
echo "Creating application bundle"
10498
pushd crates/zed
@@ -108,13 +102,7 @@ sed \
108102
"s/package.metadata.bundle-${channel}/package.metadata.bundle/" \
109103
Cargo.toml
110104

111-
if [ "$local_arch" = true ]; then
112-
app_path=$(cargo bundle ${build_flag} --select-workspace-root | xargs)
113-
else
114-
app_path_x64=$(cargo bundle ${build_flag} --target x86_64-apple-darwin --select-workspace-root | xargs)
115-
app_path_aarch64=$(cargo bundle ${build_flag} --target aarch64-apple-darwin --select-workspace-root | xargs)
116-
app_path=$app_path_x64
117-
fi
105+
app_path=$(cargo bundle ${build_flag} --target $target_triple --select-workspace-root | xargs)
118106

119107
mv Cargo.toml.backup Cargo.toml
120108
popd
@@ -189,26 +177,12 @@ function download_git() {
189177
rm -rf "$tmp_dir"
190178
}
191179

192-
function prepare_binaries() {
193-
local architecture=$1
194-
local app_path=$2
195-
196-
cp target/${architecture}/${target_dir}/zed "${app_path}/Contents/MacOS/zed"
197-
cp target/${architecture}/${target_dir}/cli "${app_path}/Contents/MacOS/cli"
198-
}
199-
200180
function sign_app_binaries() {
201-
local app_path=$1
202-
local architecture=$2
203-
local architecture_dir=$3
204181
rm -rf "${app_path}/Contents/Frameworks"
205182
mkdir -p "${app_path}/Contents/Frameworks"
206-
if [ "$local_arch" = true ]; then
207-
cp -R target/${target_dir}/cli "${app_path}/Contents/MacOS/"
208-
fi
209183

210184
echo "Downloading git binary"
211-
download_git "${architecture}" "${app_path}/Contents/MacOS/git"
185+
download_git "${target_triple}" "${app_path}/Contents/MacOS/git"
212186

213187
# Note: The app identifier for our development builds is the same as the app identifier for nightly.
214188
cp crates/zed/contents/$channel/embedded.provisionprofile "${app_path}/Contents/"
@@ -251,15 +225,7 @@ function sign_app_binaries() {
251225
exit 0
252226
fi
253227

254-
# If bundle_name is not set or empty, use the basename of $app_path
255-
if [ -z "$bundle_name" ]; then
256-
bundle_name=$(basename "$app_path")
257-
else
258-
# If bundle_name doesn't end in .app, append it
259-
if [[ "$bundle_name" != *.app ]]; then
260-
bundle_name="$bundle_name.app"
261-
fi
262-
fi
228+
bundle_name=$(basename "$app_path")
263229

264230
if [ "$local_only" = true ]; then
265231
if [ "$local_install" = true ]; then
@@ -277,7 +243,7 @@ function sign_app_binaries() {
277243
fi
278244
fi
279245
else
280-
dmg_target_directory="target/${architecture_dir}/${target_dir}"
246+
dmg_target_directory="target/${target_triple}/${target_dir}"
281247
dmg_source_directory="${dmg_target_directory}/dmg"
282248
dmg_file_path="${dmg_target_directory}/Zed.dmg"
283249
xcode_bin_dir_path="$(xcode-select -p)/usr/bin"
@@ -325,44 +291,29 @@ function sign_binary() {
325291
/usr/bin/codesign --deep --force --timestamp --options runtime --entitlements crates/zed/resources/zed.entitlements --sign "$IDENTITY" "${binary_path}" -v
326292
fi
327293
}
294+
cp target/${target_triple}/${target_dir}/zed "${app_path}/Contents/MacOS/zed"
295+
cp target/${target_triple}/${target_dir}/cli "${app_path}/Contents/MacOS/cli"
296+
sign_app_binaries
328297

329-
if [ "$local_arch" = true ]; then
330-
sign_app_binaries "$app_path" "$local_target_triple" "$local_target_triple"
331-
332-
sign_binary "target/release/remote_server"
333-
else
334-
# Create universal binary
335-
prepare_binaries "aarch64-apple-darwin" "$app_path_aarch64"
336-
prepare_binaries "x86_64-apple-darwin" "$app_path_x64"
337-
338-
339-
sign_app_binaries "$app_path_x64" "x86_64-apple-darwin" "x86_64-apple-darwin"
340-
sign_app_binaries "$app_path_aarch64" "aarch64-apple-darwin" "aarch64-apple-darwin"
341-
342-
sign_binary "target/x86_64-apple-darwin/release/remote_server"
343-
sign_binary "target/aarch64-apple-darwin/release/remote_server"
344-
gzip -f --stdout --best target/x86_64-apple-darwin/release/remote_server > target/zed-remote-server-macos-x86_64.gz
345-
gzip -f --stdout --best target/aarch64-apple-darwin/release/remote_server > target/zed-remote-server-macos-aarch64.gz
346-
fi
298+
sign_binary "target/$target_triple/release/remote_server"
299+
gzip -f --stdout --best target/$target_triple/release/remote_server > target/zed-remote-server-macos-$remote_server_arch.gz
347300

348301
function upload_debug_info() {
349-
architecture=$1
350302
if [[ -n "${SENTRY_AUTH_TOKEN:-}" ]]; then
351303
echo "Uploading zed debug symbols to sentry..."
352304
# note: this uploads the unstripped binary which is needed because it contains
353305
# .eh_frame data for stack unwinding. see https://github.com/getsentry/symbolic/issues/783
354306
sentry-cli debug-files upload --include-sources --wait -p zed -o zed-dev \
355-
"target/${architecture}/${target_dir}/zed" \
356-
"target/${architecture}/${target_dir}/remote_server" \
357-
"target/${architecture}/${target_dir}/zed.dwarf"
307+
"target/${target_triple}/${target_dir}/zed" \
308+
"target/${target_triple}/${target_dir}/remote_server" \
309+
"target/${target_triple}/${target_dir}/zed.dwarf"
358310
else
359311
echo "missing SENTRY_AUTH_TOKEN. skipping sentry upload."
360312
fi
361313
}
362314

363315
if command -v sentry-cli >/dev/null 2>&1; then
364-
upload_debug_info "aarch64-apple-darwin"
365-
upload_debug_info "x86_64-apple-darwin"
316+
upload_debug_info
366317
else
367318
echo "sentry-cli not found. skipping sentry upload."
368319
echo "install with: 'curl -sL https://sentry.io/get-cli | bash'"

0 commit comments

Comments
 (0)