Skip to content

Commit 6827cd0

Browse files
committed
chore: run build tests on both arm64 and x86
1 parent eb8c6c3 commit 6827cd0

File tree

3 files changed

+42
-43
lines changed

3 files changed

+42
-43
lines changed

.github/workflows/package.yml renamed to .github/workflows/package-plv8.yml

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ permissions:
1717

1818
jobs:
1919
settings:
20-
runs-on: ubuntu-20.04
20+
runs-on: ubuntu-latest
2121
outputs:
2222
image_tag: ${{ steps.meta.outputs.image_tag }}
2323
steps:
@@ -28,40 +28,17 @@ jobs:
2828
postgresql_major=$(grep -o 'postgresql_major=.*' ansible/Dockerfile | head -1 | cut -d "=" -f 2)
2929
echo "image_tag=${plv8_release}-pg${postgresql_major}" >> $GITHUB_OUTPUT
3030
31-
build_x86:
32-
needs: settings
33-
runs-on: [self-hosted, X64]
34-
timeout-minutes: 180
35-
env:
36-
arch: amd64
37-
outputs:
38-
image_digest: ${{ steps.build.outputs.digest }}
39-
steps:
40-
- run: docker context create builders
41-
- uses: docker/setup-buildx-action@v2
42-
with:
43-
endpoint: builders
44-
- uses: docker/login-action@v2
45-
with:
46-
registry: ghcr.io
47-
username: ${{ github.actor }}
48-
password: ${{ secrets.GITHUB_TOKEN }}
49-
- id: build
50-
uses: docker/build-push-action@v3
51-
with:
52-
push: true
53-
context: "{{defaultContext}}:ansible"
54-
target: plv8-deb
55-
tags: ${{ env.image }}:${{ needs.settings.outputs.image_tag }}_${{ env.arch }}
56-
platforms: linux/${{ env.arch }}
57-
no-cache: true
58-
59-
build_arm:
31+
build_image:
6032
needs: settings
61-
runs-on: [arm-runner]
33+
strategy:
34+
matrix:
35+
include:
36+
- runner: [self-hosted, X64]
37+
arch: amd64
38+
- runner: arm-runner
39+
arch: arm64
40+
runs-on: ${{ matrix.runner }}
6241
timeout-minutes: 180
63-
env:
64-
arch: arm64
6542
outputs:
6643
image_digest: ${{ steps.build.outputs.digest }}
6744
steps:
@@ -80,12 +57,12 @@ jobs:
8057
push: true
8158
context: "{{defaultContext}}:ansible"
8259
target: plv8-deb
83-
tags: ${{ env.image }}:${{ needs.settings.outputs.image_tag }}_${{ env.arch }}
84-
platforms: linux/${{ env.arch }}
60+
tags: ${{ env.image }}:${{ needs.settings.outputs.image_tag }}_${{ matrix.arch }}
61+
platforms: linux/${{ matrix.arch }}
8562
no-cache: true
8663

8764
merge_manifest:
88-
needs: [settings, build_x86, build_arm]
65+
needs: [settings, build_image]
8966
runs-on: ubuntu-latest
9067
steps:
9168
- uses: docker/setup-buildx-action@v2
@@ -97,5 +74,5 @@ jobs:
9774
- name: Merge multi-arch manifests
9875
run: |
9976
docker buildx imagetools create -t ${{ env.image }}:${{ needs.settings.outputs.image_tag }} \
100-
${{ env.image }}@${{ needs.build_x86.outputs.image_digest }} \
101-
${{ env.image }}@${{ needs.build_arm.outputs.image_digest }}
77+
${{ env.image }}:${{ needs.settings.outputs.image_tag }}_amd64 \
78+
${{ env.image }}:${{ needs.settings.outputs.image_tag }}_arm64

.github/workflows/test.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ on:
99

1010
jobs:
1111
build:
12-
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
include:
15+
- runner: [self-hosted, X64]
16+
arch: amd64
17+
- runner: arm-runner
18+
arch: arm64
19+
runs-on: ${{ matrix.runner }}
1320
timeout-minutes: 180
1421
env:
1522
POSTGRES_PORT: 5478
@@ -20,7 +27,11 @@ jobs:
2027
uses: mikefarah/yq@master
2128
with:
2229
cmd: yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join(" ")' 'ansible/vars.yml'
30+
31+
- run: docker context create builders
2332
- uses: docker/setup-buildx-action@v2
33+
with:
34+
endpoint: builders
2435
- uses: docker/build-push-action@v3
2536
with:
2637
push: false
@@ -41,8 +52,14 @@ jobs:
4152
4253
- name: Install dbmate
4354
run: |
44-
curl -fsSL -o /usr/local/bin/dbmate https://github.com/amacneil/dbmate/releases/latest/download/dbmate-linux-amd64
45-
sudo chmod +x /usr/local/bin/dbmate
55+
curl -fsSL -o dbmate https://github.com/amacneil/dbmate/releases/latest/download/dbmate-linux-${{ matrix.arch }}
56+
sudo chmod +x dbmate
57+
sudo mv dbmate /usr/local/bin/
58+
59+
- name: Install psql
60+
run: |
61+
sudo apt update
62+
sudo apt install -y --no-install-recommends postgresql-client
4663
4764
- name: Install pg_prove
4865
run: sudo cpan -T TAP::Parser::SourceHandler::pgTAP

ansible/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ RUN tar -xvf /tmp/plv8.tar.gz -C /tmp && \
364364
rm -rf /tmp/plv8.tar.gz
365365
# Install build dependencies
366366
RUN apt-get update && apt-get install -y --no-install-recommends \
367+
ca-certificates \
367368
pkg-config \
368369
ninja-build \
369370
git \
@@ -592,6 +593,9 @@ RUN --mount=type=cache,source=/ccache,target=/ccache,from=public.ecr.aws/t3w2s2c
592593
# Create debian package
593594
RUN checkinstall -D --install=no --fstrans=no --backup=no --pakdir=/tmp --nodoc
594595

596+
FROM scratch as pgroonga-deb
597+
COPY --from=pgroonga-source /tmp/*.deb /tmp/
598+
595599
FROM base as pgroonga
596600
# Download pre-built packages
597601
ADD "https://packages.groonga.org/debian/groonga-apt-source-latest-bullseye.deb" /tmp/source.deb
@@ -678,7 +682,7 @@ RUN --mount=type=cache,source=/ccache,target=/ccache,from=public.ecr.aws/t3w2s2c
678682
RUN checkinstall -D --install=no --fstrans=no --backup=no --pakdir=/tmp --nodoc
679683

680684
####################
681-
# Build extension packages
685+
# Collect extension packages
682686
####################
683687
FROM scratch as extensions
684688
COPY --from=postgis /tmp/*.deb /tmp/
@@ -749,7 +753,8 @@ HEALTHCHECK --interval=2s --timeout=2s --retries=10 CMD pg_isready -U postgres -
749753
# Update build cache
750754
####################
751755
FROM production as stats
752-
COPY --from=plv8-source /tmp/*.deb /tmp/
756+
COPY --from=plv8-deb /tmp/*.deb /tmp/
757+
COPY --from=pgroonga-deb /tmp/*.deb /tmp/
753758
RUN --mount=type=cache,source=/ccache,target=/ccache,from=public.ecr.aws/t3w2s2c9/postgres-buildcache:docker \
754759
ccache -s && \
755760
cp -r /ccache /tmp

0 commit comments

Comments
 (0)