-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: test_macos | ||
on: | ||
push: {} | ||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- runs-on: ubuntu-latest | ||
target: x86_64-unknown-linux-musl | ||
image-platform: linux/amd64 | ||
|
||
# Cross-compiles from Intel Mac to arm64 | ||
# We can compile natively for arm64 using macos-14 runner, | ||
# but M1 processors of macos-14 runner don't support docker. | ||
# See: https://github.com/marketplace/actions/setup-docker-on-macos#arm64-processors-m1-m2-m3-series-used-on-macos-14-images-are-unsupported | ||
# See: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | ||
- runs-on: macos-12 | ||
target: aarch64-apple-darwin | ||
image-platform: linux/arm/v8 | ||
name: Build | ||
runs-on: ${{ matrix.runs-on }} | ||
steps: | ||
- name: Setup variables | ||
run: | | ||
TAG=v0.0.0 | ||
VERSION=${TAG#v} | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
echo "IMAGE=ghcr.io/kamu-data/engine-datafusion:$VERSION" >> $GITHUB_ENV | ||
- name: Install docker (macOS) | ||
if: contains(matrix.runs-on, 'macos-') | ||
# See: https://blog.netnerds.net/2022/11/docker-macos-github-actions/ | ||
run: | | ||
brew install docker docker-buildx | ||
# colima start | ||
- name: Install musl (linux) | ||
if: contains(matrix.target, '-musl') | ||
# See: https://blog.urth.org/2023/03/05/cross-compiling-rust-projects-in-github-actions/ | ||
run: | | ||
sudo apt-get update --yes | ||
sudo apt-get install --yes musl-tools | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
target: ${{ matrix.target }} | ||
override: true | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build binary | ||
run: | | ||
# cargo build --release --target ${{ matrix.target }} | ||
- name: Build image | ||
run: | | ||
docker build \ | ||
--platform ${{ matrix.image-platform }} \ | ||
--build-arg target_arch=${{ matrix.target }} \ | ||
--build-arg version=${{ env.VERSION }} \ | ||
-t ${{ env.IMAGE }} \ | ||
-f image/Dockerfile \ | ||
. |