Skip to content

Commit 464bbe0

Browse files
committed
wip
1 parent 33947fa commit 464bbe0

File tree

4 files changed

+129
-4
lines changed

4 files changed

+129
-4
lines changed

.github/workflows/release.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ jobs:
1111
include:
1212
- runs-on: ubuntu-latest
1313
target: x86_64-unknown-linux-musl
14-
# - runs-on: macos-14
15-
# target: aarch64-apple-darwin
14+
image-arch: linux/amd64
15+
- runs-on: macos-14
16+
target: aarch64-apple-darwin
17+
image-arch: linux/arm/v8
1618
name: Build
1719
runs-on: ${{ matrix.runs-on }}
1820
steps:

.github/workflows/test.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: test_macos
2+
on:
3+
workflow_dispatch: {}
4+
jobs:
5+
build:
6+
strategy:
7+
fail-fast: false
8+
matrix:
9+
include:
10+
- runs-on: ubuntu-latest
11+
target: x86_64-unknown-linux-musl
12+
image-platform: linux/amd64
13+
14+
- runs-on: ubuntu-latest
15+
target: aarch64-unknown-linux-musl
16+
image-platform: linux/arm/v8
17+
18+
# Cross-compiles from Intel Mac to arm64
19+
# We can compile natively for arm64 using macos-14 runner,
20+
# but M1 processors of macos-14 runner don't support docker.
21+
# See: https://github.com/marketplace/actions/setup-docker-on-macos#arm64-processors-m1-m2-m3-series-used-on-macos-14-images-are-unsupported
22+
# See: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
23+
- runs-on: macos-12
24+
target: aarch64-apple-darwin
25+
image-platform: linux/arm/v8
26+
name: Build
27+
runs-on: ${{ matrix.runs-on }}
28+
steps:
29+
- name: Setup variables
30+
run: |
31+
TAG=v0.0.0
32+
VERSION=${TAG#v}
33+
echo "VERSION=$VERSION" >> $GITHUB_ENV
34+
echo "IMAGE=ghcr.io/kamu-data/engine-datafusion:$VERSION" >> $GITHUB_ENV
35+
36+
- name: Install docker (macOS)
37+
if: contains(matrix.runs-on, 'macos-')
38+
# See: https://blog.netnerds.net/2022/11/docker-macos-github-actions/
39+
run: |
40+
brew install docker docker-buildx
41+
42+
mkdir -p ~/.docker/cli-plugins
43+
ln -sfn /usr/local/opt/docker-buildx/bin/docker-buildx ~/.docker/cli-plugins/docker-buildx
44+
45+
colima start
46+
47+
- name: Install musl (linux)
48+
if: contains(matrix.target, '-musl')
49+
# See: https://blog.urth.org/2023/03/05/cross-compiling-rust-projects-in-github-actions/
50+
run: |
51+
sudo apt-get update --yes
52+
sudo apt-get install --yes musl-tools
53+
54+
- uses: actions/checkout@v4
55+
56+
- uses: actions-rs/toolchain@v1
57+
with:
58+
target: ${{ matrix.target }}
59+
override: true
60+
61+
- name: Log in to GitHub Container Registry
62+
uses: docker/login-action@v3
63+
with:
64+
registry: ghcr.io
65+
username: ${{ github.actor }}
66+
password: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Build binary
69+
run: |
70+
# cargo build --release --target ${{ matrix.target }}
71+
72+
- name: Build image
73+
run: |
74+
docker buildx build \
75+
--platform ${{ matrix.image-platform }} \
76+
--build-arg target_arch=${{ matrix.target }} \
77+
--build-arg version=${{ env.VERSION }} \
78+
-t ${{ env.IMAGE }} \
79+
-f image/Dockerfile \
80+
.

.github/workflows/test2.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: test_macos2
2+
on:
3+
push: {}
4+
jobs:
5+
build:
6+
strategy:
7+
fail-fast: false
8+
matrix:
9+
include:
10+
- runs-on: ubuntu-latest
11+
target: x86_64-unknown-linux-musl
12+
image-platform: linux/amd64
13+
- runs-on: ubuntu-latest
14+
target: aarch64-unknown-linux-musl
15+
image-platform: linux/arm/v8
16+
name: Build
17+
runs-on: ${{ matrix.runs-on }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: actions-rs/toolchain@v1
22+
with:
23+
target: ${{ matrix.target }}
24+
override: true
25+
26+
- name: Install cross
27+
run: cargo install cross --locked
28+
29+
- name: Build binary
30+
run: |
31+
make build TARGET_ARCH=${{ matrix.target }}
32+
33+
- name: Build image
34+
run: |
35+
make image PLATFORM=${{ matrix.image-platform }} TARGET_ARCH=${{ matrix.target }}
36+
37+
- name: Log in to GitHub Container Registry
38+
uses: docker/login-action@v3
39+
with:
40+
registry: ghcr.io
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
PLATFORM = linux/amd64
12
TARGET_ARCH = x86_64-unknown-linux-musl
23
ENGINE_VERSION = $(shell cargo metadata --format-version 1 | jq -r '.packages[] | select( .name == "kamu-engine-datafusion") | .version')
34
ENGINE_IMAGE_TAG = $(ENGINE_VERSION)
@@ -27,15 +28,15 @@ test:
2728
# Build
2829
###############################################################################
2930

30-
# Do not use except for local testing - release images are built via CI
3131
.PHONY: build
3232
build:
3333
RUSTFLAGS="" cross build --release --target $(TARGET_ARCH)
3434

3535

3636
.PHONY: image
37-
image: build
37+
image:
3838
docker build \
39+
--platform $(PLATFORM) \
3940
--build-arg target_arch=$(TARGET_ARCH) \
4041
--build-arg version=$(ENGINE_VERSION) \
4142
-t $(ENGINE_IMAGE) \

0 commit comments

Comments
 (0)