Skip to content

Commit

Permalink
feat(ci): publish ARM macOS builds (vectordotdev#22140)
Browse files Browse the repository at this point in the history
* 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 <jesse.szwedko@datadoghq.com>

* Update .github/workflows/publish.yml

Co-authored-by: Jesse Szwedko <jesse.szwedko@datadoghq.com>

---------

Co-authored-by: Jesse Szwedko <jesse.szwedko@datadoghq.com>
  • Loading branch information
2 people authored and titaneric committed Jan 9, 2025
1 parent 1aabcee commit 350e141
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 23 deletions.
66 changes: 53 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,32 @@ jobs:
name: vector-${{ env.VECTOR_VERSION }}-arm-unknown-linux-musleabi
path: target/artifacts/vector*

build-x86_64-apple-darwin-packages:
name: Build Vector for x86_64-apple-darwin (.tar.gz)
runs-on: macos-latest-large
build-apple-darwin-packages:
name: Build Vector for ${{ matrix.architecture }}-apple-darwin (.tar.gz)
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
needs: generate-publish-metadata
env:
VECTOR_VERSION: ${{ needs.generate-publish-metadata.outputs.vector_version }}
VECTOR_BUILD_DESC: ${{ needs.generate-publish-metadata.outputs.vector_build_desc }}
CHANNEL: ${{ needs.generate-publish-metadata.outputs.vector_release_channel }}
strategy:
matrix:
include:
# Refer to https://docs.github.com/en/actions/using-github-hosted-runners/using-larger-runners/about-larger-runners#about-macos-larger-runners.
- architecture: x86_64
runner: macos-latest-large
- architecture: arm64
runner: macos-latest-xlarge
steps:
- name: Verify Runner Architecture
run: |
ARCH=$(uname -m)
echo "Detected architecture: $ARCH"
if [ "$ARCH" != "${{ matrix.architecture }}" ]; then
echo "Error: Expected ${{ matrix.architecture }} architecture, but got $ARCH!"
exit 1
fi
- name: Checkout Vector
uses: actions/checkout@v4
with:
Expand All @@ -284,17 +300,18 @@ jobs:
run: bash scripts/environment/bootstrap-macos.sh
- name: Build Vector
env:
TARGET: "x86_64-apple-darwin"
TARGET: "${{ matrix.architecture }}-apple-darwin"
NATIVE_BUILD: true
run: |
export PATH="$HOME/.cargo/bin:$PATH"
make package
- name: Stage package artifacts for publish
uses: actions/upload-artifact@v4
with:
name: vector-${{ env.VECTOR_VERSION }}-x86_64-apple-darwin
name: vector-${{ env.VECTOR_VERSION }}-${{ matrix.architecture }}-apple-darwin
path: target/artifacts/vector*


build-x86_64-pc-windows-msvc-packages:
name: Build Vector for x86_64-pc-windows-msvc (.zip)
runs-on: release-builder-windows-2022
Expand Down Expand Up @@ -443,26 +460,34 @@ jobs:
macos-verify:
name: Verify macOS Package
runs-on: macos-latest-large
runs-on: ${{ matrix.runner }}
timeout-minutes: 5
needs:
- generate-publish-metadata
- build-x86_64-apple-darwin-packages
- build-apple-darwin-packages
env:
VECTOR_VERSION: ${{ needs.generate-publish-metadata.outputs.vector_version }}
strategy:
matrix:
include:
- target: x86_64-apple-darwin
runner: macos-latest-large
- target: arm64-apple-darwin
runner: macos-latest-xlarge
steps:
- name: Checkout Vector
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
- name: Download staged package artifacts (x86_64-apple-darwin)
- name: Download staged package artifacts (${{ matrix.target }})
uses: actions/download-artifact@v4
with:
name: vector-${{ env.VECTOR_VERSION }}-x86_64-apple-darwin
name: vector-${{ env.VECTOR_VERSION }}-${{ matrix.target }}
path: target/artifacts
- name: Verify macOS package
run: |
tar -xvf target/artifacts/vector-${{ env.VECTOR_VERSION }}-x86_64-apple-darwin.tar.gz && vector-x86_64-apple-darwin/bin/vector --version
tar -xvf target/artifacts/vector-${{ env.VECTOR_VERSION }}-${{ matrix.target }}.tar.gz \
&& vector-${{ matrix.target }}/bin/vector --version
publish-docker:
name: Publish to Docker
Expand Down Expand Up @@ -563,7 +588,7 @@ jobs:
- build-x86_64-unknown-linux-musl-packages
- build-aarch64-unknown-linux-musl-packages
- build-aarch64-unknown-linux-gnu-packages
- build-x86_64-apple-darwin-packages
- build-apple-darwin-packages
- build-x86_64-pc-windows-msvc-packages
- build-armv7-unknown-linux-musleabihf-packages
- build-armv7-unknown-linux-gnueabihf-packages
Expand Down Expand Up @@ -605,6 +630,11 @@ jobs:
with:
name: vector-${{ env.VECTOR_VERSION }}-x86_64-apple-darwin
path: target/artifacts
- name: Download staged package artifacts (arm64-apple-darwin)
uses: actions/download-artifact@v4
with:
name: vector-${{ env.VECTOR_VERSION }}-arm64-apple-darwin
path: target/artifacts
- name: Download staged package artifacts (x86_64-pc-windows-msvc)
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -648,7 +678,7 @@ jobs:
- build-x86_64-unknown-linux-musl-packages
- build-aarch64-unknown-linux-musl-packages
- build-aarch64-unknown-linux-gnu-packages
- build-x86_64-apple-darwin-packages
- build-apple-darwin-packages
- build-x86_64-pc-windows-msvc-packages
- build-armv7-unknown-linux-gnueabihf-packages
- build-armv7-unknown-linux-musleabihf-packages
Expand Down Expand Up @@ -690,6 +720,11 @@ jobs:
with:
name: vector-${{ env.VECTOR_VERSION }}-x86_64-apple-darwin
path: target/artifacts
- name: Download staged package artifacts (arm64-apple-darwin)
uses: actions/download-artifact@v4
with:
name: vector-${{ env.VECTOR_VERSION }}-arm64-apple-darwin
path: target/artifacts
- name: Download staged package artifacts (x86_64-pc-windows-msvc)
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -756,7 +791,7 @@ jobs:
- build-x86_64-unknown-linux-musl-packages
- build-aarch64-unknown-linux-musl-packages
- build-aarch64-unknown-linux-gnu-packages
- build-x86_64-apple-darwin-packages
- build-apple-darwin-packages
- build-x86_64-pc-windows-msvc-packages
- build-armv7-unknown-linux-gnueabihf-packages
- build-armv7-unknown-linux-musleabihf-packages
Expand Down Expand Up @@ -794,6 +829,11 @@ jobs:
with:
name: vector-${{ env.VECTOR_VERSION }}-x86_64-apple-darwin
path: target/artifacts
- name: Download staged package artifacts (arm64-apple-darwin)
uses: actions/download-artifact@v4
with:
name: vector-${{ env.VECTOR_VERSION }}-arm64-apple-darwin
path: target/artifacts
- name: Download staged package artifacts (x86_64-pc-windows-msvc)
uses: actions/download-artifact@v4
with:
Expand Down
13 changes: 3 additions & 10 deletions distribution/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,15 @@ install_from_archive() {
x86_64-apple-darwin)
_archive_arch=$_arch
;;
aarch64-apple-darwin)
_archive_arch="arm64-apple-darwin"
;;
x86_64-*linux*-gnu)
_archive_arch="x86_64-unknown-linux-gnu"
;;
x86_64-*linux*-musl)
_archive_arch="x86_64-unknown-linux-musl"
;;
aarch64-apple-darwin)
# This if statement can be removed when Vector publishes aarch64-apple-darwin builds
if /usr/bin/pgrep oahd >/dev/null 2>&1; then
echo "Rosetta is installed, installing x86_64-apple-darwin archive"
_archive_arch="x86_64-apple-darwin"
else
echo "Builds for Apple Silicon are not published today, please install Rosetta"
err "unsupported arch: $_arch"
fi
;;
aarch64-*linux*)
_archive_arch="aarch64-unknown-linux-musl"
;;
Expand Down

0 comments on commit 350e141

Please sign in to comment.