Skip to content

Commit c92468f

Browse files
committed
ci: use the same workflow logic for test and release
1 parent 5cc387b commit c92468f

File tree

3 files changed

+88
-27
lines changed

3 files changed

+88
-27
lines changed

.ci/Dockerfile.amzn2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG FROM=ghcr.io/emqx/emqx-builder/5.1-3:1.14.5-25.3.2-1-amzn2
1+
ARG FROM=ghcr.io/emqx/emqx-builder/5.5-5:1.18.3-27.3.4.2-1-amzn2
22
FROM ${FROM}
33

44
RUN alternatives --set python /usr/bin/python2 && \

.github/workflows/eunit.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
jobs:
99
mac:
10+
name: macOS (${{ matrix.os }} ${{ matrix.otp }})
1011
strategy:
1112
fail-fast: false
1213
matrix:
@@ -32,17 +33,21 @@ jobs:
3233
- run: rebar3 eunit
3334

3435
linux:
35-
runs-on: ubuntu-latest
36-
36+
name: linux (${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.builder.otp }})
3737
strategy:
3838
fail-fast: false
3939
matrix:
40-
builder:
41-
- "5.5-5:1.18.3-27.3.4.2-1"
4240
os:
4341
- ubuntu24.04
42+
arch:
43+
- amd64
44+
- arm64
45+
builder:
46+
- vsn: "5.5-5:1.18.3-27.3.4.2-1"
47+
otp: "27.3.4.2-1"
4448

45-
container: ghcr.io/emqx/emqx-builder/${{ matrix.builder }}-${{ matrix.os }}
49+
runs-on: ubuntu-24.04${{ matrix.arch == 'arm64' && '-arm' || '' }}
50+
container: ghcr.io/emqx/emqx-builder/${{ matrix.builder.vsn }}-${{ matrix.os }}
4651

4752
steps:
4853
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

.github/workflows/release.yaml

Lines changed: 77 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@ on:
1919

2020
jobs:
2121
mac:
22+
name: macOS (${{ matrix.os }} ${{ matrix.otp }})
2223
strategy:
2324
fail-fast: false
2425
matrix:
26+
os:
27+
- macos-13
28+
- macos-14
29+
- macos-15
2530
otp:
2631
- "26.2.5.14-1"
2732
- "27.3.4.2-1"
2833
rebar3:
2934
- "3.22.0"
30-
os:
31-
- macos-13
32-
- macos-14
33-
- macos-15
3435
runs-on: ${{ matrix.os }}
3536
steps:
3637
- uses: emqx/macos-erlang@f744c98139c0db83a10619587d4bae4fc49765a8 # v1.0.0
@@ -58,17 +59,10 @@ jobs:
5859
_packages/*.tar.gz.sha256
5960
6061
linux:
62+
name: linux (${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.builder.otp }})
6163
strategy:
6264
fail-fast: false
6365
matrix:
64-
builder:
65-
- vsn: "5.5-5:1.15.7-26.2.5.14-1"
66-
otp: "26.2.5.14-1"
67-
- vsn: "5.5-5:1.18.3-27.3.4.2-1"
68-
otp: "27.3.4.2-1"
69-
arch:
70-
- amd64
71-
- arm64
7266
os:
7367
- ubuntu24.04
7468
- ubuntu22.04
@@ -82,10 +76,17 @@ jobs:
8276
- el8
8377
- el9
8478
- alpine3.15.1
79+
arch:
80+
- amd64
81+
- arm64
82+
builder:
83+
- vsn: "5.5-5:1.15.7-26.2.5.14-1"
84+
otp: "26.2.5.14-1"
85+
- vsn: "5.5-5:1.18.3-27.3.4.2-1"
86+
otp: "27.3.4.2-1"
8587

86-
runs-on: ubuntu-latest
87-
env:
88-
IMAGE: ghcr.io/emqx/emqx-builder/${{ matrix.builder.vsn }}-${{ matrix.os }}
88+
runs-on: ubuntu-24.04${{ matrix.arch == 'arm64' && '-arm' || '' }}
89+
container: ghcr.io/emqx/emqx-builder/${{ matrix.builder.vsn }}-${{ matrix.os }}
8990

9091
steps:
9192
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -94,21 +95,75 @@ jobs:
9495
fetch-depth: 0
9596
ref: ${{ github.event.inputs.build_from }} # when input is not given, the event tag is used
9697

97-
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
98-
- uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
98+
- run: git config --global --add safe.directory $GITHUB_WORKSPACE
99+
100+
- name: build release
101+
env:
102+
BUILD_RELEASE: 1
103+
CI_RELEASE_VERSION: ${{ github.event.inputs.release_as }}
104+
run: ./build.sh
105+
106+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
107+
with:
108+
name: packages-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.builder.otp }}
109+
path: |
110+
_packages/*.tar.gz
111+
_packages/*.tar.gz.sha256
112+
113+
linux-old:
114+
# el7 does not work when using 'container' due to old nodejs version
115+
# same with amzn2, plus it needs even more handholding
116+
name: linux (${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.builder.otp }})
117+
strategy:
118+
fail-fast: false
119+
matrix:
120+
os:
121+
- amzn2
122+
- el7
123+
arch:
124+
- amd64
125+
- arm64
126+
builder:
127+
- vsn: "5.5-5:1.15.7-26.2.5.14-1"
128+
otp: "26.2.5.14-1"
129+
- vsn: "5.5-5:1.18.3-27.3.4.2-1"
130+
otp: "27.3.4.2-1"
131+
132+
runs-on: ubuntu-24.04${{ matrix.arch == 'arm64' && '-arm' || '' }}
133+
134+
steps:
135+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
99136
with:
100-
platforms: ${{ matrix.arch }}
137+
submodules: recursive
138+
fetch-depth: 0
139+
ref: ${{ github.event.inputs.build_from }} # when input is not given, the event tag is used
101140

102141
- name: build release
103142
if: matrix.os == 'amzn2'
143+
env:
144+
CI_RELEASE_VERSION: ${{ github.event.inputs.release_as }}
145+
CONTAINER: ghcr.io/emqx/emqx-builder/${{ matrix.builder.vsn }}-${{ matrix.os }}
104146
run: |
105-
docker build --platform=linux/${{ matrix.arch }} --build-arg FROM=$IMAGE -t emqx-builder:amzn2 -f .ci/Dockerfile.amzn2 .
106-
docker run -i --rm --user 1001 -v $(pwd):/wd --workdir /wd --platform=linux/${{ matrix.arch }} -e BUILD_RELEASE=1 -e CI_RELEASE_VERSION=${{ github.event.inputs.release_as }} emqx-builder:amzn2 bash -euc './build.sh'
147+
docker build --build-arg FROM=$CONTAINER -t emqx-builder:amzn2 -f .ci/Dockerfile.amzn2 .
148+
docker run -t --rm --user 1001 \
149+
-v $(pwd):/wd \
150+
--workdir /wd \
151+
-e BUILD_RELEASE=1 \
152+
-e CI_RELEASE_VERSION=$CI_RELEASE_VERSION \
153+
emqx-builder:amzn2 bash -euc './build.sh'
107154
108155
- name: build release
109156
if: matrix.os != 'amzn2'
157+
env:
158+
CI_RELEASE_VERSION: ${{ github.event.inputs.release_as }}
159+
CONTAINER: ghcr.io/emqx/emqx-builder/${{ matrix.builder.vsn }}-${{ matrix.os }}
110160
run: |
111-
docker run -i --rm --user 1001 -v $(pwd):/wd --workdir /wd --platform=linux/${{ matrix.arch }} -e BUILD_RELEASE=1 -e CI_RELEASE_VERSION=${{ github.event.inputs.release_as }} $IMAGE bash -euc './build.sh'
161+
docker run -t --rm --user 1001 \
162+
-v $(pwd):/wd \
163+
--workdir /wd \
164+
-e BUILD_RELEASE=1 \
165+
-e CI_RELEASE_VERSION=$CI_RELEASE_VERSION \
166+
$CONTAINER bash -euc './build.sh'
112167
113168
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
114169
with:
@@ -122,6 +177,7 @@ jobs:
122177
needs:
123178
- mac
124179
- linux
180+
- linux-old
125181
if: startsWith(github.ref, 'refs/tags/') || inputs.release_as
126182
steps:
127183
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0

0 commit comments

Comments
 (0)