Skip to content

Commit c165f20

Browse files
authored
fix: Combine multiarch build for Cube, split multiarch for Cube Store (cube-js#3859)
1 parent 0e907a0 commit c165f20

File tree

3 files changed

+41
-47
lines changed

3 files changed

+41
-47
lines changed

.github/workflows/publish.yml

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,12 @@ jobs:
170170
name: Debian docker image
171171
runs-on: ${{ matrix.os }}
172172
strategy:
173+
fail-fast: false
173174
matrix:
174-
target:
175-
- x86_64-unknown-linux-gnu
176-
- aarch64-unknown-linux-gnu
177175
include:
178176
- os: ubuntu-20.04
179177
target: x86_64-unknown-linux-gnu
180-
platforms: linux/amd64
181-
avx: 1
182-
- os: self-hosted
183-
target: aarch64-unknown-linux-gnu
184-
platforms: linux/arm64
185-
avx: 0
178+
platforms: linux/amd64,linux/arm64
186179
timeout-minutes: 30
187180
steps:
188181
- name: Check out the repo
@@ -220,6 +213,8 @@ jobs:
220213
with:
221214
username: ${{ secrets.DOCKERHUB_USERNAME }}
222215
password: ${{ secrets.DOCKERHUB_TOKEN }}
216+
- name: Set up QEMU
217+
uses: docker/setup-qemu-action@v1
223218
- name: Set up Docker Buildx
224219
uses: docker/setup-buildx-action@v1
225220
with:
@@ -242,7 +237,6 @@ jobs:
242237
org.opencontainers.image.revision=${{ github.sha }}
243238
org.opencontainers.image.licenses=${{ fromJson(steps.repo.outputs.result).license.spdx_id }}
244239
build-args: |
245-
WITH_AVX2=${{ matrix.avx }}
246240
IMAGE_VERSION=${{ steps.prep.outputs.version }}
247241
248242
docker-alpine:
@@ -319,23 +313,28 @@ jobs:
319313
name: Cube Store Docker
320314
runs-on: ${{ matrix.os }}
321315
strategy:
316+
fail-fast: false
322317
matrix:
323-
target:
324-
- x86_64-unknown-linux-gnu
325-
- aarch64-unknown-linux-gnu
326318
include:
327319
- os: ubuntu-20.04
328320
target: x86_64-unknown-linux-gnu
329321
platforms: linux/amd64
330-
avx: 0
331-
- os: ubuntu-20.04
332-
target: x86_64-unknown-linux-gnu
333-
platforms: linux/amd64
334-
avx: 1
322+
build-args: WITH_AVX2=1
323+
postfix: ""
324+
tag: "latest"
335325
- os: self-hosted
336326
target: aarch64-unknown-linux-gnu
337327
platforms: linux/arm64
338-
avx: 0
328+
build-args: WITH_AVX2=0
329+
postfix: "-arm64v8"
330+
tag: "arm64v8"
331+
# Non AVX build
332+
- os: ubuntu-20.04
333+
target: x86_64-unknown-linux-gnu
334+
platforms: linux/amd64
335+
build-args: WITH_AVX2=0
336+
postfix: "-non-avx"
337+
tag: "non-avx"
339338
timeout-minutes: 60
340339
steps:
341340
- name: Check out the repo
@@ -361,22 +360,15 @@ jobs:
361360
elif [[ $GITHUB_REF == refs/tags/* ]]; then
362361
VERSION=${GITHUB_REF#refs/tags/}
363362
fi
364-
if [ ${{ matrix.avx }} == 1 ]; then
365-
TAGS="${DOCKER_IMAGE}:${VERSION}"
366-
elif [ ${{ matrix.avx }} == 0 ]; then
367-
TAGS="${DOCKER_IMAGE}:${VERSION}-non-avx"
368-
fi
363+
364+
TAGS="${DOCKER_IMAGE}:${VERSION}${{ matrix.postfix }}"
365+
369366
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
370367
MINOR=${VERSION%.*}
371368
MAJOR=${MINOR%.*}
372-
if [ ${{ matrix.avx }} == 1 ]; then
373-
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest"
374-
elif [ ${{ matrix.avx }} == 0 ]; then
375-
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR}-non-avx,${DOCKER_IMAGE}:${MAJOR}-non-avx,${DOCKER_IMAGE}:non-avx"
376-
fi
377-
elif [ "${{ github.event_name }}" = "push" && ${{ matrix.avx }} == 0 ]; then
378-
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}-non-avx"
369+
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR}${{ matrix.postfix }},${DOCKER_IMAGE}:${MAJOR}${{ matrix.postfix }},${DOCKER_IMAGE}:${{ matrix.tag }}"
379370
fi
371+
380372
echo ::set-output name=version::${VERSION}
381373
echo ::set-output name=tags::${TAGS}
382374
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
@@ -393,17 +385,16 @@ jobs:
393385
uses: actions/cache@v2
394386
with:
395387
path: /tmp/.buildx-cache
396-
key: ${{ runner.os }}-${{ matrix.target }}-buildx-${{ matrix.avx }}-${{ github.sha }}
388+
key: ${{ runner.os }}-${{ matrix.target }}-buildx-${{ matrix.tag }}-${{ github.sha }}
397389
restore-keys: |
398-
${{ runner.os }}-${{ matrix.target }}-buildx-${{ matrix.avx }}-
390+
${{ runner.os }}-${{ matrix.target }}-buildx-${{ matrix.tag }}-
399391
- name: Push to Docker Hub
400392
uses: docker/build-push-action@v2
401393
with:
402394
context: ./rust/cubestore/
403395
file: ./rust/cubestore/Dockerfile
404396
platforms: ${{ matrix.platforms }}
405-
build-args: |
406-
WITH_AVX2=${{ matrix.avx }}
397+
build-args: ${{ matrix.build-args }}
407398
push: true
408399
tags: ${{ steps.prep.outputs.tags }}
409400
cache-from: type=local,src=/tmp/.buildx-cache

.github/workflows/rust-cubestore-master.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ jobs:
7171
- os: ubuntu-20.04
7272
target: x86_64-unknown-linux-gnu
7373
platforms: linux/amd64
74-
avx: 1
74+
build-args: WITH_AVX2=1
75+
postfix: ""
7576
- os: self-hosted
7677
target: aarch64-unknown-linux-gnu
7778
platforms: linux/arm64
78-
avx: 0
79+
build-args: WITH_AVX2=0
80+
postfix: "-arm64v8"
7981
timeout-minutes: 60
8082
steps:
8183
- name: Check out the repo
@@ -93,7 +95,8 @@ jobs:
9395
GITHUB_SHA: ${{ github.sha }}
9496
run: |
9597
DOCKER_IMAGE=cubejs/cubestore
96-
VERSION=dev
98+
VERSION=dev${{ matrix.postfix }}
99+
97100
if [ "${{ github.event_name }}" = "schedule" ]; then
98101
VERSION=nightly
99102
elif [[ $GITHUB_REF == refs/tags/* ]]; then
@@ -106,14 +109,17 @@ jobs:
106109
elif [[ $GITHUB_REF == refs/pull/* ]]; then
107110
VERSION=pr-${{ github.event.number }}
108111
fi
112+
109113
TAGS="${DOCKER_IMAGE}:${VERSION}"
114+
110115
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
111116
MINOR=${VERSION%.*}
112117
MAJOR=${MINOR%.*}
113118
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest"
114119
elif [ "${{ github.event_name }}" = "push" ]; then
115120
TAGS="$TAGS,${DOCKER_IMAGE}:build-1${GITHUB_RUN_NUMBER}"
116121
fi
122+
117123
echo ::set-output name=version::${VERSION}
118124
echo ::set-output name=tags::${TAGS}
119125
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
@@ -139,8 +145,7 @@ jobs:
139145
context: ./rust/cubestore
140146
file: ./rust/cubestore/Dockerfile
141147
platforms: ${{ matrix.platforms }}
142-
build-args: |
143-
WITH_AVX2=${{ matrix.avx }}
148+
build-args: ${{ matrix.build-args }}
144149
push: true
145150
tags: ${{ steps.prep.outputs.tags }}
146151
cache-from: type=local,src=/tmp/.buildx-cache

.github/workflows/rust-cubestore.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,17 @@ jobs:
6161
name: Build only :latest image
6262
runs-on: ${{ matrix.os }}
6363
strategy:
64+
fail-fast: false
6465
matrix:
65-
target:
66-
- x86_64-unknown-linux-gnu
67-
- aarch64-unknown-linux-gnu
6866
include:
6967
- os: ubuntu-20.04
7068
target: x86_64-unknown-linux-gnu
7169
platforms: linux/amd64
72-
avx: 1
70+
build-args: WITH_AVX2=1
7371
- os: self-hosted
7472
target: aarch64-unknown-linux-gnu
7573
platforms: linux/arm64
76-
avx: 0
74+
build-args: WITH_AVX2=0
7775
timeout-minutes: 60
7876
if: github.ref != 'refs/heads/master'
7977
steps:
@@ -96,11 +94,11 @@ jobs:
9694
context: ./rust/cubestore/
9795
file: ./rust/cubestore/Dockerfile
9896
platforms: ${{ matrix.platforms }}
99-
build-args: |
100-
WITH_AVX2=${{ matrix.avx }}
97+
build-args: ${{ matrix.build-args }}
10198
push: false
10299
cache-from: type=local,src=/tmp/.buildx-cache
103100
cache-to: type=local,dest=/tmp/.buildx-cache
101+
104102
cross:
105103
runs-on: ${{ matrix.os }}
106104
timeout-minutes: 90

0 commit comments

Comments
 (0)