Skip to content

Commit c7eb693

Browse files
prontjszwedko
authored andcommitted
feat(ci): publish ARM macOS builds (vectordotdev#22140)
* feat(ci): publish ARM macOS builds * typo * rename build job to build-apple-darwin-packages * add comments and link to large runners * add pre-condition for early exit * simplify verification step * small tweaks * add arm64-apple-darwin branches to various jobs (this begs for refactoring) * update distribution/install.sh * Update .github/workflows/publish.yml Co-authored-by: Jesse Szwedko <[email protected]> * Update .github/workflows/publish.yml Co-authored-by: Jesse Szwedko <[email protected]> --------- Co-authored-by: Jesse Szwedko <[email protected]>
1 parent fe4a79f commit c7eb693

File tree

2 files changed

+56
-23
lines changed

2 files changed

+56
-23
lines changed

.github/workflows/publish.yml

Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -266,16 +266,32 @@ jobs:
266266
name: vector-${{ env.VECTOR_VERSION }}-arm-unknown-linux-musleabi
267267
path: target/artifacts/vector*
268268

269-
build-x86_64-apple-darwin-packages:
270-
name: Build Vector for x86_64-apple-darwin (.tar.gz)
271-
runs-on: macos-latest-large
269+
build-apple-darwin-packages:
270+
name: Build Vector for ${{ matrix.architecture }}-apple-darwin (.tar.gz)
271+
runs-on: ${{ matrix.runner }}
272272
timeout-minutes: 90
273273
needs: generate-publish-metadata
274274
env:
275275
VECTOR_VERSION: ${{ needs.generate-publish-metadata.outputs.vector_version }}
276276
VECTOR_BUILD_DESC: ${{ needs.generate-publish-metadata.outputs.vector_build_desc }}
277277
CHANNEL: ${{ needs.generate-publish-metadata.outputs.vector_release_channel }}
278+
strategy:
279+
matrix:
280+
include:
281+
# Refer to https://docs.github.com/en/actions/using-github-hosted-runners/using-larger-runners/about-larger-runners#about-macos-larger-runners.
282+
- architecture: x86_64
283+
runner: macos-latest-large
284+
- architecture: arm64
285+
runner: macos-latest-xlarge
278286
steps:
287+
- name: Verify Runner Architecture
288+
run: |
289+
ARCH=$(uname -m)
290+
echo "Detected architecture: $ARCH"
291+
if [ "$ARCH" != "${{ matrix.architecture }}" ]; then
292+
echo "Error: Expected ${{ matrix.architecture }} architecture, but got $ARCH!"
293+
exit 1
294+
fi
279295
- name: Checkout Vector
280296
uses: actions/checkout@v4
281297
with:
@@ -284,17 +300,18 @@ jobs:
284300
run: bash scripts/environment/bootstrap-macos.sh
285301
- name: Build Vector
286302
env:
287-
TARGET: "x86_64-apple-darwin"
303+
TARGET: "${{ matrix.architecture }}-apple-darwin"
288304
NATIVE_BUILD: true
289305
run: |
290306
export PATH="$HOME/.cargo/bin:$PATH"
291307
make package
292308
- name: Stage package artifacts for publish
293309
uses: actions/upload-artifact@v4
294310
with:
295-
name: vector-${{ env.VECTOR_VERSION }}-x86_64-apple-darwin
311+
name: vector-${{ env.VECTOR_VERSION }}-${{ matrix.architecture }}-apple-darwin
296312
path: target/artifacts/vector*
297313

314+
298315
build-x86_64-pc-windows-msvc-packages:
299316
name: Build Vector for x86_64-pc-windows-msvc (.zip)
300317
runs-on: release-builder-windows-2022
@@ -443,26 +460,34 @@ jobs:
443460
444461
macos-verify:
445462
name: Verify macOS Package
446-
runs-on: macos-latest-large
463+
runs-on: ${{ matrix.runner }}
447464
timeout-minutes: 5
448465
needs:
449466
- generate-publish-metadata
450-
- build-x86_64-apple-darwin-packages
467+
- build-apple-darwin-packages
451468
env:
452469
VECTOR_VERSION: ${{ needs.generate-publish-metadata.outputs.vector_version }}
470+
strategy:
471+
matrix:
472+
include:
473+
- target: x86_64-apple-darwin
474+
runner: macos-latest-large
475+
- target: arm64-apple-darwin
476+
runner: macos-latest-xlarge
453477
steps:
454478
- name: Checkout Vector
455479
uses: actions/checkout@v4
456480
with:
457481
ref: ${{ inputs.git_ref }}
458-
- name: Download staged package artifacts (x86_64-apple-darwin)
482+
- name: Download staged package artifacts (${{ matrix.target }})
459483
uses: actions/download-artifact@v4
460484
with:
461-
name: vector-${{ env.VECTOR_VERSION }}-x86_64-apple-darwin
485+
name: vector-${{ env.VECTOR_VERSION }}-${{ matrix.target }}
462486
path: target/artifacts
463487
- name: Verify macOS package
464488
run: |
465-
tar -xvf target/artifacts/vector-${{ env.VECTOR_VERSION }}-x86_64-apple-darwin.tar.gz && vector-x86_64-apple-darwin/bin/vector --version
489+
tar -xvf target/artifacts/vector-${{ env.VECTOR_VERSION }}-${{ matrix.target }}.tar.gz \
490+
&& vector-${{ matrix.target }}/bin/vector --version
466491
467492
publish-docker:
468493
name: Publish to Docker
@@ -563,7 +588,7 @@ jobs:
563588
- build-x86_64-unknown-linux-musl-packages
564589
- build-aarch64-unknown-linux-musl-packages
565590
- build-aarch64-unknown-linux-gnu-packages
566-
- build-x86_64-apple-darwin-packages
591+
- build-apple-darwin-packages
567592
- build-x86_64-pc-windows-msvc-packages
568593
- build-armv7-unknown-linux-musleabihf-packages
569594
- build-armv7-unknown-linux-gnueabihf-packages
@@ -605,6 +630,11 @@ jobs:
605630
with:
606631
name: vector-${{ env.VECTOR_VERSION }}-x86_64-apple-darwin
607632
path: target/artifacts
633+
- name: Download staged package artifacts (arm64-apple-darwin)
634+
uses: actions/download-artifact@v4
635+
with:
636+
name: vector-${{ env.VECTOR_VERSION }}-arm64-apple-darwin
637+
path: target/artifacts
608638
- name: Download staged package artifacts (x86_64-pc-windows-msvc)
609639
uses: actions/download-artifact@v4
610640
with:
@@ -648,7 +678,7 @@ jobs:
648678
- build-x86_64-unknown-linux-musl-packages
649679
- build-aarch64-unknown-linux-musl-packages
650680
- build-aarch64-unknown-linux-gnu-packages
651-
- build-x86_64-apple-darwin-packages
681+
- build-apple-darwin-packages
652682
- build-x86_64-pc-windows-msvc-packages
653683
- build-armv7-unknown-linux-gnueabihf-packages
654684
- build-armv7-unknown-linux-musleabihf-packages
@@ -690,6 +720,11 @@ jobs:
690720
with:
691721
name: vector-${{ env.VECTOR_VERSION }}-x86_64-apple-darwin
692722
path: target/artifacts
723+
- name: Download staged package artifacts (arm64-apple-darwin)
724+
uses: actions/download-artifact@v4
725+
with:
726+
name: vector-${{ env.VECTOR_VERSION }}-arm64-apple-darwin
727+
path: target/artifacts
693728
- name: Download staged package artifacts (x86_64-pc-windows-msvc)
694729
uses: actions/download-artifact@v4
695730
with:
@@ -756,7 +791,7 @@ jobs:
756791
- build-x86_64-unknown-linux-musl-packages
757792
- build-aarch64-unknown-linux-musl-packages
758793
- build-aarch64-unknown-linux-gnu-packages
759-
- build-x86_64-apple-darwin-packages
794+
- build-apple-darwin-packages
760795
- build-x86_64-pc-windows-msvc-packages
761796
- build-armv7-unknown-linux-gnueabihf-packages
762797
- build-armv7-unknown-linux-musleabihf-packages
@@ -794,6 +829,11 @@ jobs:
794829
with:
795830
name: vector-${{ env.VECTOR_VERSION }}-x86_64-apple-darwin
796831
path: target/artifacts
832+
- name: Download staged package artifacts (arm64-apple-darwin)
833+
uses: actions/download-artifact@v4
834+
with:
835+
name: vector-${{ env.VECTOR_VERSION }}-arm64-apple-darwin
836+
path: target/artifacts
797837
- name: Download staged package artifacts (x86_64-pc-windows-msvc)
798838
uses: actions/download-artifact@v4
799839
with:

distribution/install.sh

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,15 @@ install_from_archive() {
147147
x86_64-apple-darwin)
148148
_archive_arch=$_arch
149149
;;
150+
aarch64-apple-darwin)
151+
_archive_arch="arm64-apple-darwin"
152+
;;
150153
x86_64-*linux*-gnu)
151154
_archive_arch="x86_64-unknown-linux-gnu"
152155
;;
153156
x86_64-*linux*-musl)
154157
_archive_arch="x86_64-unknown-linux-musl"
155158
;;
156-
aarch64-apple-darwin)
157-
# This if statement can be removed when Vector publishes aarch64-apple-darwin builds
158-
if /usr/bin/pgrep oahd >/dev/null 2>&1; then
159-
echo "Rosetta is installed, installing x86_64-apple-darwin archive"
160-
_archive_arch="x86_64-apple-darwin"
161-
else
162-
echo "Builds for Apple Silicon are not published today, please install Rosetta"
163-
err "unsupported arch: $_arch"
164-
fi
165-
;;
166159
aarch64-*linux*)
167160
_archive_arch="aarch64-unknown-linux-musl"
168161
;;

0 commit comments

Comments
 (0)