Skip to content

Commit a47b2d5

Browse files
authored
Merge pull request #62 from OpenVoxProject/unified_build
refactor: update build workflows to use new matrix structure and streamline version handling
2 parents 0c23da7 + c8eee07 commit a47b2d5

5 files changed

Lines changed: 66 additions & 95 deletions

File tree

.github/workflows/build_container.yml

Lines changed: 27 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -16,71 +16,29 @@ jobs:
1616
setup-matrix:
1717
runs-on: ubuntu-latest
1818
outputs:
19-
matrix: ${{ steps.set-matrix.outputs.matrix }}
19+
build_matrix: ${{ steps.set-build-matrix.outputs.build_matrix }}
20+
tag_matrix: ${{ steps.set-tag-matrix.outputs.tag_matrix }}
2021
steps:
2122
- name: Source checkout
2223
uses: actions/checkout@v5
2324

2425
- name: 'Setup yq'
2526
uses: dcarbone/install-yq-action@v1.3.1
2627

27-
- id: set-matrix
28-
run: echo "matrix=$(yq -o json build_versions.yaml | jq -c)" >> $GITHUB_OUTPUT
28+
- id: set-build-matrix
29+
run: echo "build_matrix=$(bash matrix.sh build)" >> $GITHUB_OUTPUT
2930

30-
build-X86-container:
31-
runs-on: ubuntu-24.04
32-
permissions:
33-
contents: read
34-
packages: write
35-
needs: setup-matrix
36-
strategy:
37-
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
38-
steps:
39-
- id: server_version
40-
run: echo "server_version=${{ matrix.server_version }}" | cut -d- -f1 >> $GITHUB_OUTPUT
41-
42-
- id: db_version
43-
run: echo "db_version=${{ matrix.db_version }}" | cut -d- -f1 >> $GITHUB_OUTPUT
44-
45-
- name: Build OpenVox Server ${{ matrix.release }} container
46-
uses: voxpupuli/gha-build-and-publish-a-container@v2
47-
with:
48-
registry_password: ${{ secrets.GITHUB_TOKEN }}
49-
build_args: |
50-
OPENVOX_RELEASE=${{ matrix.release }}
51-
OPENVOXSERVER_VERSION=${{ matrix.server_version }}
52-
OPENVOXDB_VERSION=${{ matrix.db_version }}
53-
R10K_VERSION=${{ matrix.r10k_version }}
54-
RUGGED_VERSION=${{ matrix.rugged_version }}
55-
build_arch: linux/amd64
56-
build_context: openvoxserver
57-
buildfile: openvoxserver/Containerfile
58-
tags: |
59-
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64
60-
61-
- name: Build Alpine OpenVox Server ${{ matrix.release }} container
62-
uses: voxpupuli/gha-build-and-publish-a-container@v2
63-
with:
64-
registry_password: ${{ secrets.GITHUB_TOKEN }}
65-
build_args: |
66-
OPENVOX_RELEASE=${{ matrix.release }}
67-
OPENVOXSERVER_VERSION=${{ steps.server_version.outputs.server_version }}
68-
OPENVOXDB_VERSION=${{ steps.db_version.outputs.db_version }}
69-
R10K_VERSION=${{ matrix.r10k_version }}
70-
build_arch: linux/amd64
71-
build_context: openvoxserver
72-
buildfile: openvoxserver/Containerfile.alpine
73-
tags: |
74-
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64-alpine
31+
- id: set-tag-matrix
32+
run: echo "tag_matrix=$(bash matrix.sh tag)" >> $GITHUB_OUTPUT
7533

76-
build-ARM-container:
77-
runs-on: ubuntu-24.04-arm
34+
build-and-push-container:
35+
runs-on: ${{ matrix.runner }}
7836
permissions:
7937
contents: read
8038
packages: write
8139
needs: setup-matrix
8240
strategy:
83-
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
41+
matrix: ${{ fromJson(needs.setup-matrix.outputs.build_matrix) }}
8442
steps:
8543
- id: server_version
8644
run: echo "server_version=${{ matrix.server_version }}" | cut -d- -f1 >> $GITHUB_OUTPUT
@@ -98,11 +56,11 @@ jobs:
9856
OPENVOXDB_VERSION=${{ matrix.db_version }}
9957
R10K_VERSION=${{ matrix.r10k_version }}
10058
RUGGED_VERSION=${{ matrix.rugged_version }}
101-
build_arch: linux/arm64
59+
build_arch: linux/${{ matrix.platform }}
10260
build_context: openvoxserver
10361
buildfile: openvoxserver/Containerfile
10462
tags: |
105-
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64
63+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-${{ matrix.platform }}
10664
10765
- name: Build Alpine OpenVox Server ${{ matrix.release }} container
10866
uses: voxpupuli/gha-build-and-publish-a-container@v2
@@ -113,11 +71,11 @@ jobs:
11371
OPENVOXSERVER_VERSION=${{ steps.server_version.outputs.server_version }}
11472
OPENVOXDB_VERSION=${{ steps.db_version.outputs.db_version }}
11573
R10K_VERSION=${{ matrix.r10k_version }}
116-
build_arch: linux/arm64
74+
build_arch: linux/${{ matrix.platform }}
11775
build_context: openvoxserver
11876
buildfile: openvoxserver/Containerfile.alpine
11977
tags: |
120-
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64-alpine
78+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-${{ matrix.platform }}-alpine
12179
12280
create-multi-arch-manifests:
12381
runs-on: ubuntu-latest
@@ -126,10 +84,9 @@ jobs:
12684
packages: write
12785
needs:
12886
- setup-matrix
129-
- build-X86-container
130-
- build-ARM-container
87+
- build-and-push-container
13188
strategy:
132-
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
89+
matrix: ${{ fromJson(needs.setup-matrix.outputs.tag_matrix) }}
13390
steps:
13491
- name: Log in to the ghcr.io registry
13592
uses: docker/login-action@v3
@@ -155,56 +112,56 @@ jobs:
155112
run: |
156113
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxserver:${{ steps.server_version.outputs.server_version }}-${{ github.ref_name }} \
157114
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64 \
158-
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64
115+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-amd64
159116
160117
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }} \
161118
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64 \
162-
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64
119+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-amd64
163120
164121
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxserver:latest \
165122
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-arm64 \
166-
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-x86_64
123+
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-amd64
167124
168125
# on docker.io we use the voxpupuli namespace because new organizations are not free anymore
169126
#
170127
docker buildx imagetools create -t docker.io/voxpupuli/openvoxserver:${{ steps.server_version.outputs.server_version }}-${{ github.ref_name }} \
171128
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64 \
172-
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64
129+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-amd64
173130
174131
docker buildx imagetools create -t docker.io/voxpupuli/openvoxserver:${{ matrix.release }} \
175132
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64 \
176-
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64
133+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-amd64
177134
178135
docker buildx imagetools create -t docker.io/voxpupuli/openvoxserver:latest \
179136
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-arm64 \
180-
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-x86_64
137+
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-amd64
181138
182139
- name: Create Alpine multi arch manifests
183140
run: |
184141
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxserver:${{ steps.server_version.outputs.server_version }}-${{ github.ref_name }}-alpine-beta \
185142
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64-alpine \
186-
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64-alpine
143+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-amd64-alpine
187144
188145
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-alpine-beta \
189146
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64-alpine \
190-
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64-alpine
147+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-amd64-alpine
191148
192149
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxserver:latest-alpine-beta \
193150
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-arm64-alpine \
194-
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-x86_64-alpine
151+
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-amd64-alpine
195152
196153
# on docker.io we use the voxpupuli namespace because new organizations are not free anymore
197154
docker buildx imagetools create -t docker.io/voxpupuli/openvoxserver:${{ steps.server_version.outputs.server_version }}-${{ github.ref_name }}-alpine-beta \
198155
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64-alpine \
199-
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64-alpine
156+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-amd64-alpine
200157
201158
docker buildx imagetools create -t docker.io/voxpupuli/openvoxserver:${{ matrix.release }}-alpine-beta \
202159
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64-alpine \
203-
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64-alpine
160+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-amd64-alpine
204161
205162
docker buildx imagetools create -t docker.io/voxpupuli/openvoxserver:latest-alpine-beta \
206163
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-arm64-alpine \
207-
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-x86_64-alpine
164+
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-amd64-alpine
208165
209166
update-dockerhub-description:
210167
runs-on: ubuntu-latest

.github/workflows/ci.yaml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: CI🚦
2+
name: 🚦 CI
33

44
on:
55
pull_request:
@@ -14,35 +14,27 @@ jobs:
1414
setup-matrix:
1515
runs-on: ubuntu-latest
1616
outputs:
17-
matrix: ${{ steps.set-matrix.outputs.matrix }}
17+
build_matrix: ${{ steps.set-build-matrix.outputs.build_matrix }}
1818
steps:
1919
- name: Source checkout
2020
uses: actions/checkout@v5
2121

2222
- name: 'Setup yq'
2323
uses: dcarbone/install-yq-action@v1.3.1
2424

25-
- id: set-matrix
26-
run: echo "matrix=$(yq -o json build_versions.yaml | jq -c)" >> $GITHUB_OUTPUT
25+
- id: set-build-matrix
26+
run: echo "build_matrix=$(bash matrix.sh build)" >> $GITHUB_OUTPUT
2727

28-
general_ci:
28+
build_ci_container:
29+
name: Build ${{ matrix.platform }} CI container
30+
runs-on: ${{ matrix.runner }}
2931
permissions:
30-
# required for all workflows
3132
security-events: write
32-
33-
# only required for workflows in private repositories
3433
actions: read
3534
contents: read
36-
uses: voxpupuli/crafty/.github/workflows/general_ci.yaml@main
37-
with:
38-
shellcheck_scan_dir: './openvoxserver'
39-
40-
build_test_container:
41-
name: 'Build test container'
42-
runs-on: ubuntu-latest
4335
needs: setup-matrix
4436
strategy:
45-
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
37+
matrix: ${{ fromJson(needs.setup-matrix.outputs.build_matrix) }}
4638
steps:
4739
- name: Checkout repository
4840
uses: actions/checkout@v5
@@ -72,6 +64,7 @@ jobs:
7264
context: openvoxserver
7365
file: openvoxserver/Containerfile
7466
push: false
67+
platforms: linux/${{ matrix.platform }}
7568
build-args: |
7669
OPENVOX_RELEASE=${{ matrix.release }}
7770
OPENVOXSERVER_VERSION=${{ matrix.server_version }}
@@ -94,8 +87,7 @@ jobs:
9487
9588
tests:
9689
needs:
97-
- general_ci
98-
- build_test_container
90+
- build_ci_container
9991
runs-on: ubuntu-latest
10092
name: Test suite
10193
steps:

.github/workflows/security_scanning.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@ jobs:
1616
setup-matrix:
1717
runs-on: ubuntu-latest
1818
outputs:
19-
matrix: ${{ steps.set-matrix.outputs.matrix }}
19+
build_matrix: ${{ steps.set-build-matrix.outputs.build_matrix }}
2020
steps:
2121
- name: Source checkout
2222
uses: actions/checkout@v5
2323

2424
- name: 'Setup yq'
2525
uses: dcarbone/install-yq-action@v1.3.1
2626

27-
- id: set-matrix
28-
run: echo "matrix=$(yq -o json build_versions.yaml | jq -c)" >> $GITHUB_OUTPUT
27+
- id: set-build-matrix
28+
run: echo "build_matrix=$(bash matrix.sh build)" >> $GITHUB_OUTPUT
2929

3030
scan_ci_container:
31-
name: 'Scan CI container'
32-
runs-on: ubuntu-latest
31+
name: 'Scan ${{ matrix.platform }} CI container'
32+
runs-on: ${{ matrix.runner }}
3333
permissions:
3434
actions: read
3535
contents: read
3636
security-events: write
3737
needs: setup-matrix
3838
strategy:
39-
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
39+
matrix: ${{ fromJson(needs.setup-matrix.outputs.build_matrix) }}
4040
steps:
4141
- name: Checkout repository
4242
uses: actions/checkout@v5
@@ -50,12 +50,13 @@ jobs:
5050
const version = agentVersion.split('-')[0];
5151
core.setOutput('version', version);
5252
53-
- name: Build CI container
53+
- name: Build ${{ matrix.platform }} CI container
5454
uses: docker/build-push-action@v6
5555
with:
5656
tags: 'ci/openvoxserver:${{ steps.extract_version.outputs.version }}'
5757
context: openvoxserver
5858
file: openvoxserver/Containerfile
59+
platforms: linux/${{ matrix.platform }}
5960
push: false
6061
build-args: |
6162
OPENVOX_RELEASE=${{ matrix.release }}

build_platforms.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
platforms:
3+
- platform: amd64
4+
runner: ubuntu-24.04
5+
- platform: arm64
6+
runner: ubuntu-24.04-arm

matrix.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
yq -o=json build_platforms.yaml > build_platforms.json
4+
yq -o=json build_versions.yaml > build_versions.json
5+
6+
if [ "$1" == "build" ]; then
7+
jq -rc --slurp '{ include: [ .[1].include[] as $i | .[0].platforms[] as $p | $i + {"platform": $p.platform, "runner": $p.runner} ] }' build_platforms.json build_versions.json
8+
fi
9+
10+
if [ "$1" == "tag" ]; then
11+
jq -cr '.include |= map({ release: .release, server_version: .server_version, db_version: .db_version })' build_versions.json
12+
fi
13+
14+
rm build_platforms.json
15+
rm build_versions.json

0 commit comments

Comments
 (0)