Skip to content

Commit da45de1

Browse files
committed
wip
1 parent 3f3b3aa commit da45de1

File tree

4 files changed

+137
-8
lines changed

4 files changed

+137
-8
lines changed

.github/workflows/build.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name: build
22
on:
3-
push:
4-
paths-ignore:
5-
- "image/**"
6-
- "**.md"
73
workflow_dispatch: {} # manual trigger
84
env:
95
RUST_LOG: "debug"

.github/workflows/release_test.yaml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: release_test
2+
on:
3+
push: {}
4+
env:
5+
REGISTRY_IMAGE: ghcr.io/kamu-data/engine-datafusion
6+
jobs:
7+
build:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
include:
12+
- runs-on: ubuntu-latest
13+
target: x86_64-unknown-linux-musl
14+
platform: linux/amd64
15+
qemu: false
16+
- runs-on: ubuntu-latest
17+
target: aarch64-unknown-linux-musl
18+
platform: linux/arm64
19+
qemu: true
20+
name: Build
21+
runs-on: ${{ matrix.runs-on }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
# Collects metadata about build for image labels
26+
- name: Docker meta
27+
id: meta
28+
uses: docker/metadata-action@v5
29+
with:
30+
images: ${{ env.REGISTRY_IMAGE }}
31+
# TODOOOOOOOOOOO
32+
tags: |
33+
# use custom value instead of git tag
34+
type=semver,pattern={{version}},value=v0.7.2
35+
36+
- name: Set up QEMU
37+
if: matrix.qemu
38+
uses: docker/setup-qemu-action@v3
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
43+
- uses: actions-rs/toolchain@v1
44+
with:
45+
target: ${{ matrix.target }}
46+
override: true
47+
48+
- name: Install cross
49+
run: cargo install cross --locked
50+
51+
- name: Build binary
52+
run: |
53+
# make build TARGET_ARCH=${{ matrix.target }}
54+
55+
- name: Log in to GitHub Container Registry
56+
uses: docker/login-action@v3
57+
with:
58+
registry: ghcr.io
59+
username: ${{ github.actor }}
60+
password: ${{ secrets.GITHUB_TOKEN }}
61+
62+
# See: https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
63+
- name: Build and push by digest
64+
id: build
65+
uses: docker/build-push-action@v5
66+
with:
67+
context: .
68+
file: image/Dockerfile
69+
platforms: ${{ matrix.platform }}
70+
# TODOOOOOOOOOOOOOOOOO
71+
build-args: |
72+
target_arch=${{ matrix.target }}
73+
version=0.7.2
74+
labels: ${{ steps.meta.outputs.labels }}
75+
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
76+
77+
- name: Export digest
78+
run: |
79+
mkdir -p /tmp/digests
80+
digest="${{ steps.build.outputs.digest }}"
81+
touch "/tmp/digests/${digest#sha256:}"
82+
83+
- name: Prepare upload digest
84+
run: |
85+
platform=${{ matrix.platform }}
86+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
87+
88+
- name: Upload digest
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: digests-${{ env.PLATFORM_PAIR }}
92+
path: /tmp/digests/*
93+
if-no-files-found: error
94+
retention-days: 1
95+
96+
merge:
97+
runs-on: ubuntu-latest
98+
needs:
99+
- build
100+
steps:
101+
- name: Download digests
102+
uses: actions/download-artifact@v4
103+
with:
104+
path: /tmp/digests
105+
pattern: digests-*
106+
merge-multiple: true
107+
108+
- name: Set up Docker Buildx
109+
uses: docker/setup-buildx-action@v3
110+
111+
- name: Docker meta
112+
id: meta
113+
uses: docker/metadata-action@v5
114+
with:
115+
images: ${{ env.REGISTRY_IMAGE }}
116+
117+
- name: Log in to GitHub Container Registry
118+
uses: docker/login-action@v3
119+
with:
120+
registry: ghcr.io
121+
username: ${{ github.actor }}
122+
password: ${{ secrets.GITHUB_TOKEN }}
123+
124+
- name: Create manifest list and push
125+
working-directory: /tmp/digests
126+
run: |
127+
docker buildx imagetools create --dry-run $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
128+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
129+
130+
- name: Inspect image
131+
run: |
132+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
TARGET_ARCH = x86_64-unknown-linux-musl
2-
IMAGE_PLATFORM = linux/amd64
2+
PLATFORM = linux/amd64
33
CRATE_VERSION = $(shell cargo metadata --format-version 1 | jq -r '.packages[] | select( .name == "kamu-engine-datafusion") | .version')
44
IMAGE_TAG = $(CRATE_VERSION)
55
IMAGE = ghcr.io/kamu-data/engine-datafusion:$(IMAGE_TAG)
@@ -35,12 +35,13 @@ build:
3535

3636
.PHONY: image
3737
image:
38-
docker build \
39-
--platform $(IMAGE_PLATFORM) \
38+
docker buildx build \
39+
--platform $(PLATFORM) \
4040
--build-arg target_arch=$(TARGET_ARCH) \
4141
--build-arg version=$(CRATE_VERSION) \
4242
-t $(IMAGE) \
4343
-f image/Dockerfile \
44+
--load \
4445
.
4546

4647

image/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN apk add --no-cache tini
1515

1616

1717
# Engine
18-
COPY target/${target_arch}/release/kamu-engine-datafusion /opt/engine/bin/kamu-engine-datafusion
18+
# COPY target/${target_arch}/release/kamu-engine-datafusion /opt/engine/bin/kamu-engine-datafusion
1919

2020

2121
ENV RUST_BACKTRACE=1

0 commit comments

Comments
 (0)