Skip to content

Commit 7121fd8

Browse files
committed
test: self-sign previous release binaries for arm64 macOS
1 parent 6061eb6 commit 7121fd8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/get_previous_releases.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,34 @@ def download_binary(tag, args) -> int:
152152
return ret
153153

154154
Path(tarball).unlink()
155+
156+
if tag >= "v23" and platform == "arm64-apple-darwin":
157+
# Starting with v23 there are arm64 binaries for ARM (e.g. M1, M2) macs, but they have to be signed to run
158+
binary_path = f'{os.getcwd()}/{tag}/bin/'
159+
160+
for arm_binary in os.listdir(binary_path):
161+
# Is it already signed?
162+
ret = subprocess.run(
163+
['codesign', '-v', binary_path + arm_binary],
164+
stderr=subprocess.DEVNULL, # Suppress expected stderr output
165+
).returncode
166+
if ret == 1:
167+
# Have to self-sign the binary
168+
ret = subprocess.run(
169+
['codesign', '-s', '-', binary_path + arm_binary]
170+
).returncode
171+
if ret != 0:
172+
print(f"Failed to self-sign {tag} {arm_binary} arm64 binary")
173+
return 1
174+
175+
# Confirm success
176+
ret = subprocess.run(
177+
['codesign', '-v', binary_path + arm_binary]
178+
).returncode
179+
if ret != 0:
180+
print(f"Failed to verify the self-signed {tag} {arm_binary} arm64 binary")
181+
return 1
182+
155183
return 0
156184

157185

0 commit comments

Comments
 (0)