Skip to content

Commit 14e1d00

Browse files
Refactor
1 parent d08fb2a commit 14e1d00

File tree

5 files changed

+223
-280
lines changed

5 files changed

+223
-280
lines changed

.github/workflows/package.yml

+27-202
Original file line numberDiff line numberDiff line change
@@ -9,214 +9,39 @@ on:
99
push:
1010
branches: [ master ]
1111

12-
# If pushes to master are made in rapid succession, cancel existing docker builds and use newer commits
13-
concurrency:
14-
group: ${{ github.workflow }}-${{ github.ref_name }}
15-
cancel-in-progress: true
16-
17-
env:
18-
SECRET_DOCKER_CI: ${{ secrets.DOCKER_CI }}
19-
REPOSITORY: hyperion-project
20-
2112
jobs:
2213

23-
#############################
24-
###### Ubuntu & Debian ######
25-
#############################
26-
27-
ubuntu_debian:
14+
ubuntu_debian_fedora:
2815
name: 🐧 ${{ matrix.os.description }} Qt ${{ matrix.qt_version }}
29-
runs-on: ubuntu-22.04
30-
strategy:
31-
fail-fast: false
32-
matrix:
33-
os: [
34-
{ distribution: ubuntu, codename: focal, description: Ubuntu 20.04 (Focal Fossa) },
35-
{ distribution: ubuntu, codename: jammy, description: Ubuntu 22.04 (Jammy Jellyfish) },
36-
{ distribution: ubuntu, codename: noble, description: Ubuntu 24.04 (Noble Numbat) },
37-
{ distribution: ubuntu, codename: oracular, description: Ubuntu 24.10 (Oracular Oriole) },
38-
{ distribution: debian, codename: buster, description: Debian 10.x (Buster) },
39-
{ distribution: debian, codename: bullseye, description: Debian 11.x (Bullseye) },
40-
{ distribution: debian, codename: bookworm, description: Debian 12.x (Bookworm) },
41-
{ distribution: debian, codename: trixie, description: Debian 13.x (Trixie) }
42-
]
43-
qt_version: [ '5', '6' ]
44-
include:
45-
- target_platform: linux/amd64,linux/arm64,linux/arm/v7
46-
exclude:
47-
# qt6 is not available on ubuntu focal and debian buster
48-
- os: { distribution: ubuntu, codename: focal }
49-
qt_version: '6'
50-
- os: { distribution: debian, codename: buster }
51-
qt_version: '6'
52-
53-
steps:
54-
- name: 👀 Checkout
55-
uses: actions/checkout@v4
56-
57-
- name: ✅ Determine current Repository
58-
if: ${{ !startsWith(github.repository, env.REPOSITORY) }}
59-
run: echo "REPOSITORY=$(echo '${{ github.actor }}' | tr '[:upper:]' '[:lower:]')" >> ${GITHUB_ENV}
60-
61-
- name: 🛠️ Set up QEMU
62-
uses: docker/setup-qemu-action@v3
63-
64-
- name: 🐳 Set up Docker Buildx
65-
uses: docker/setup-buildx-action@v3
66-
67-
- name: 🔑 Login to GitHub Container Registry
68-
if: ${{ env.SECRET_DOCKER_CI != null }}
69-
uses: docker/login-action@v3
70-
with:
71-
registry: ghcr.io
72-
username: ${{ github.actor }}
73-
password: ${{ secrets.DOCKER_CI }}
74-
75-
- name: 🐳 Set up Docker metadata
76-
id: docker_metadata
77-
uses: docker/metadata-action@v5
78-
with:
79-
images: ghcr.io/${{ env.REPOSITORY }}/${{ matrix.os.distribution }}
80-
tags: |
81-
type=raw,value=${{ matrix.os.codename }},enable=${{ matrix.qt_version == '5' }}
82-
type=raw,value=${{ matrix.os.codename }}-qt6,enable=${{ matrix.qt_version == '6' }}
83-
labels: |
84-
maintainer=Hyperion Project <[email protected]>
85-
org.opencontainers.image.vendor=Hyperion Project
86-
org.opencontainers.image.title=${{ matrix.os.description }} - QT ${{ matrix.qt_version }}
87-
org.opencontainers.image.description=Compilation environment to build Hyperion for ${{ matrix.os.distribution }} ${{ matrix.os.codename }}
88-
org.opencontainers.image.url=${{ github.server_url }}
89-
org.opencontainers.image.source=${{ github.server_url }}/hyperion.docker-ci
90-
org.opencontainers.image.documentation=https://docs.hyperion-project.org/
91-
org.opencontainers.image.licenses=MIT
92-
93-
- name: 👷 Build and 🚀 Push to GitHub Container/Package Registry
94-
uses: docker/build-push-action@v6
95-
with:
96-
context: .
97-
file: ubuntu_debian
98-
push: true
99-
platforms: ${{ matrix.target_platform }}
100-
provenance: false
101-
tags: ${{ steps.docker_metadata.outputs.tags }}
102-
labels: ${{ steps.docker_metadata.outputs.labels }}
103-
build-args: |
104-
DIST=${{ matrix.os.distribution }}
105-
SUITE=${{ matrix.os.codename }}
106-
QT_VERSION=${{ matrix.qt_version }}
107-
REPOSITORY="${{ github.server_url }}/${{ env.REPOSITORY }}"
108-
109-
debian_armv6:
110-
name: 🐧 ${{ matrix.os.description }} Qt ${{ matrix.qt_version }} (armv6)
111-
needs: [ ubuntu_debian ]
112-
runs-on: ubuntu-22.04
11316
strategy:
11417
fail-fast: false
11518
matrix:
11619
os: [
117-
{ codename: buster, description: Debian 10.x (Buster) },
118-
{ codename: bullseye, description: Debian 11.x (Bullseye) },
119-
{ codename: bookworm, description: Debian 12.x (Bookworm) }
20+
{ distribution: ubuntu, codename: focal, description: Ubuntu 20.04 (Focal Fossa), target_platform: "['amd64', 'arm64', 'armv7']" },
21+
{ distribution: ubuntu, codename: jammy, description: Ubuntu 22.04 (Jammy Jellyfish), target_platform: "['amd64', 'arm64', 'armv7']" },
22+
{ distribution: ubuntu, codename: noble, description: Ubuntu 24.04 (Noble Numbat), target_platform: "['amd64', 'arm64', 'armv7']" },
23+
{ distribution: ubuntu, codename: oracular, description: Ubuntu 24.10 (Oracular Oriole), target_platform: "['amd64', 'arm64', 'armv7']" },
24+
{ distribution: debian, codename: buster, description: Debian 10.x (Buster), target_platform: "['amd64', 'arm64', 'armv6', 'armv7']" },
25+
{ distribution: debian, codename: bullseye, description: Debian 11.x (Bullseye), target_platform: "['amd64', 'arm64', 'armv6', 'armv7']" },
26+
{ distribution: debian, codename: bookworm, description: Debian 12.x (Bookworm), target_platform: "['amd64', 'arm64', 'armv6', 'armv7']" },
27+
{ distribution: debian, codename: trixie, description: Debian 13.x (Trixie), target_platform: "['amd64', 'arm64', 'armv7']" },
28+
{ distribution: fedora, codename: 39, description: Fedora 39, target_platform: "['amd64', 'arm64']" },
29+
{ distribution: fedora, codename: 40, description: Fedora 40, target_platform: "['amd64', 'arm64']" },
30+
{ distribution: fedora, codename: 41, description: Fedora 41, target_platform: "['amd64', 'arm64']" }
12031
]
121-
qt_version: [ '5', '6' ]
32+
qt_version: [ 5, 6 ]
12233
exclude:
123-
# qt6 is not available on debian buster/bullseye
124-
- os: { codename: buster, description: Debian 10.x (Buster) }
125-
qt_version: '6'
126-
- os: { codename: bullseye, description: Debian 11.x (Bullseye) }
127-
qt_version: '6'
128-
129-
steps:
130-
- name: 👀 Checkout
131-
uses: actions/checkout@v4
132-
133-
- name: ✅ Determine current Repository
134-
if: ${{ !startsWith(github.repository, env.REPOSITORY) }}
135-
run: echo "REPOSITORY=$(echo '${{ github.actor }}' | tr '[:upper:]' '[:lower:]')" >> ${GITHUB_ENV}
136-
137-
- name: 🛠️ Set up QEMU
138-
uses: docker/setup-qemu-action@v3
139-
140-
- name: 🐳 Set up Docker Buildx
141-
uses: docker/setup-buildx-action@v3
142-
143-
- name: 👷 Build, 🔀 Combine and 🚀 Push to GitHub Container/Package Registry
144-
run: |
145-
echo ${{ secrets.DOCKER_CI }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
146-
docker buildx build --provenance=false --push --build-arg SUITE=${{ matrix.os.codename }} --build-arg QT_VERSION=${{ matrix.qt_version }} --platform=linux/arm/v6 --tag ghcr.io/${{ env.REPOSITORY }}/debian:${{ env.IMAGE }}-armv6 --file debian-armv6 .
147-
docker buildx imagetools create -t ghcr.io/${{ env.REPOSITORY }}/debian:${{ env.IMAGE }} --append ghcr.io/${{ env.REPOSITORY }}/debian:${{ env.IMAGE }}-armv6
148-
env:
149-
IMAGE: ${{ matrix.qt_version == '6' && format('{0}-qt6', matrix.os.codename) || matrix.os.codename }}
150-
151-
####################
152-
###### Fedora ######
153-
####################
154-
155-
fedora:
156-
name: 🐧 ${{ matrix.description }} ${{ matrix.tag }} Qt ${{ matrix.qt_version }}
157-
runs-on: ubuntu-22.04
158-
strategy:
159-
fail-fast: false
160-
matrix:
161-
tag: [ 39, 40, 41 ]
162-
qt_version: [ '5', '6' ]
163-
include:
164-
- dist: fedora
165-
- description: Fedora
166-
- target_platform: linux/amd64, linux/arm64
167-
168-
steps:
169-
- name: 👀 Checkout
170-
uses: actions/checkout@v4
171-
172-
- name: ✅ Determine current Repository
173-
if: ${{ !startsWith(github.repository, env.REPOSITORY) }}
174-
run: echo "REPOSITORY=$(echo '${{ github.actor }}' | tr '[:upper:]' '[:lower:]')" >> ${GITHUB_ENV}
175-
176-
- name: 🛠️ Set up QEMU
177-
uses: docker/setup-qemu-action@v3
178-
179-
- name: 🐳 Set up Docker Buildx
180-
uses: docker/setup-buildx-action@v3
181-
182-
- name: 🔑 Login to GitHub Container Registry
183-
if: ${{ env.SECRET_DOCKER_CI != null }}
184-
uses: docker/login-action@v3
185-
with:
186-
registry: ghcr.io
187-
username: ${{ github.actor }}
188-
password: ${{ secrets.DOCKER_CI }}
189-
190-
- name: 🐳 Set up Docker metadata
191-
id: docker_metadata
192-
uses: docker/metadata-action@v5
193-
with:
194-
images: ghcr.io/${{ env.REPOSITORY }}/${{ matrix.dist }}
195-
tags: |
196-
type=raw,value=${{ matrix.tag }},enable=${{ matrix.qt_version == '5' }}
197-
type=raw,value=${{ matrix.tag }}-qt6,enable=${{ matrix.qt_version == '6' }}
198-
labels: |
199-
maintainer=Hyperion Project <[email protected]>
200-
org.opencontainers.image.vendor=Hyperion Project
201-
org.opencontainers.image.title=${{ matrix.description }} - QT ${{ matrix.qt_version }}
202-
org.opencontainers.image.description=Compilation environment to build Hyperion for ${{ matrix.description }} ${{ matrix.tag }}
203-
org.opencontainers.image.url=${{ github.server_url }}
204-
org.opencontainers.image.source=${{ github.server_url }}/hyperion.docker-ci
205-
org.opencontainers.image.documentation=https://docs.hyperion-project.org/
206-
org.opencontainers.image.licenses=MIT
207-
208-
- name: 👷 Build and 🚀 Push to GitHub Container/Package Registry
209-
uses: docker/build-push-action@v6
210-
with:
211-
context: .
212-
file: fedora
213-
push: ${{ env.SECRET_DOCKER_CI != null }}
214-
platforms: ${{ matrix.target_platform }}
215-
provenance: false
216-
tags: ${{ steps.docker_metadata.outputs.tags }}
217-
labels: ${{ steps.docker_metadata.outputs.labels }}
218-
build-args: |
219-
DIST=${{ matrix.dist }}
220-
SUITE=${{ matrix.tag }}
221-
QT_VERSION=${{ matrix.qt_version }}
222-
REPOSITORY="${{ github.server_url }}/${{ env.REPOSITORY }}"
34+
# Qt6 is not available on Ubuntu Focal and Debian Buster
35+
# Qt6 on Debian Bullseye (only armv6) is excluded in reusable workflow qt5_6.yml because target_platform is passed as string to reusable workflow
36+
- os: { codename: focal }
37+
qt_version: 6
38+
- os: { codename: buster }
39+
qt_version: 6
40+
41+
uses: ./.github/workflows/qt5_6.yml
42+
secrets: inherit
43+
with:
44+
distribution: ${{ matrix.os.distribution }}
45+
codename: ${{ matrix.os.codename }}
46+
qt_version: ${{ matrix.qt_version }}
47+
target_platform: ${{ matrix.os.target_platform }}

.github/workflows/qt5_6.yml

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: GitHub Packages Qt5/6 Builds
2+
3+
on:
4+
# Reusable from package.yml
5+
workflow_call:
6+
inputs:
7+
distribution:
8+
type: string
9+
default: 'ubuntu'
10+
required: false
11+
codename:
12+
type: string
13+
default: 'focal'
14+
required: false
15+
qt_version:
16+
type: string
17+
default: '5'
18+
required: false
19+
target_platform:
20+
type: string
21+
default: "['amd64']"
22+
required: false
23+
24+
env:
25+
SECRET_DOCKER_CI: ${{ secrets.DOCKER_CI }}
26+
REPOSITORY: hyperion-project
27+
CMAKE_VERSION: 3.31.5
28+
29+
jobs:
30+
31+
build_and_push:
32+
name: 👷 Build ${{ matrix.target_platform }}
33+
runs-on: ${{ matrix.target_platform == 'amd64' && 'ubuntu-22.04' || 'ubuntu-22.04-arm' }}
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
target_platform: ${{ fromJson(inputs.target_platform) }}
38+
target_lookup: [{ 'amd64': 'linux/amd64', 'arm64': 'linux/arm64', 'armv6': 'linux/arm/v6', 'armv7': 'linux/arm/v7' }]
39+
isBullseyeQt6:
40+
- ${{ inputs.distribution == 'debian' && inputs.codename == 'bullseye' && inputs.qt_version == '6' }}
41+
exclude:
42+
- isBullseyeQt6: true
43+
target_platform: 'armv6'
44+
45+
steps:
46+
- name: 👀 Checkout
47+
uses: actions/checkout@v4
48+
49+
- name: ✅ Determine current Repository
50+
if: ${{ !startsWith(github.repository, env.REPOSITORY) }}
51+
run: echo "REPOSITORY=$(echo '${{ github.actor }}' | tr '[:upper:]' '[:lower:]')" >> ${GITHUB_ENV}
52+
53+
- name: 🛠️ Set up QEMU
54+
uses: docker/setup-qemu-action@v3
55+
56+
- name: 🐳 Set up Docker Buildx
57+
uses: docker/setup-buildx-action@v3
58+
59+
- name: 🔑 Login to GitHub Container Registry
60+
if: ${{ env.SECRET_DOCKER_CI != null }}
61+
uses: docker/login-action@v3
62+
with:
63+
registry: ghcr.io
64+
username: ${{ github.actor }}
65+
password: ${{ secrets.DOCKER_CI }}
66+
67+
- name: 🐳 Set up Docker metadata
68+
id: docker_metadata
69+
uses: docker/metadata-action@v5
70+
with:
71+
images: ghcr.io/${{ env.REPOSITORY }}/${{ inputs.distribution }}
72+
tags: type=sha
73+
74+
- name: 👷 Build and 🚀 Push digest to GitHub Container/Package Registry
75+
id: docker_build
76+
uses: docker/build-push-action@v6
77+
with:
78+
context: .
79+
file: ${{ matrix.target_platform == 'armv6' && 'debian-armv6' || inputs.distribution == 'fedora' && 'fedora' || 'ubuntu_debian' }}
80+
platforms: ${{ matrix.target_lookup[format('{0}',matrix.target_platform)] }}
81+
provenance: false
82+
labels: ${{ steps.docker_metadata.outputs.labels }}
83+
annotations: ${{ steps.docker_metadata.outputs.annotations }}
84+
outputs: type=image,name=ghcr.io/${{ env.REPOSITORY }}/${{ inputs.distribution }},push-by-digest=true,name-canonical=true,push=true
85+
build-args: |
86+
DIST=${{ inputs.distribution }}
87+
SUITE=${{ inputs.codename }}
88+
QT_VERSION=${{ inputs.qt_version }}
89+
REPOSITORY="${{ github.server_url }}/${{ env.REPOSITORY }}"
90+
CMAKE_VERSION=${{ env.CMAKE_VERSION }}
91+
92+
- name: ⬇ Export digest
93+
run: |
94+
mkdir -p /tmp/digests
95+
digest="${{ steps.docker_build.outputs.digest }}"
96+
touch "/tmp/digests/${digest#sha256:}"
97+
98+
- name: 📦 Upload digest
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: ${{ inputs.distribution }}-${{ inputs.codename }}-qt${{ inputs.qt_version }}-${{ matrix.target_platform }}
102+
path: /tmp/digests/*
103+
if-no-files-found: error
104+
retention-days: 1
105+
106+
merge:
107+
name: 👷 Merge and 🚀 Push
108+
needs: build_and_push
109+
runs-on: ubuntu-latest
110+
env:
111+
TAG: ${{ inputs.qt_version == '6' && format('{0}-qt6', inputs.codename) || inputs.codename }}
112+
113+
steps:
114+
- name: 💾 Download digests
115+
uses: actions/download-artifact@v4
116+
with:
117+
path: /tmp/digests
118+
pattern: ${{ inputs.distribution }}-${{ inputs.codename }}-qt${{ inputs.qt_version }}-*
119+
merge-multiple: true
120+
121+
- name: ✅ Determine current Repository
122+
if: ${{ !startsWith(github.repository, env.REPOSITORY) }}
123+
run: echo "REPOSITORY=$(echo '${{ github.actor }}' | tr '[:upper:]' '[:lower:]')" >> ${GITHUB_ENV}
124+
125+
- name: 🐳 Set up Docker Buildx
126+
uses: docker/setup-buildx-action@v3
127+
128+
- name: 🔑 Login to GitHub Container Registry
129+
if: ${{ env.SECRET_DOCKER_CI != null }}
130+
uses: docker/login-action@v3
131+
with:
132+
registry: ghcr.io
133+
username: ${{ github.actor }}
134+
password: ${{ secrets.DOCKER_CI }}
135+
136+
- name: 📝 Create manifest list and 🚀 Push to GitHub Container/Package Registry
137+
working-directory: /tmp/digests
138+
run: |
139+
docker buildx imagetools create -t ghcr.io/${{ env.REPOSITORY }}/${{ inputs.distribution }}:${{ env.TAG }} $(printf 'ghcr.io/${{ env.REPOSITORY }}/${{ inputs.distribution }}@sha256:%s ' *)
140+
141+
- name: 👀 Inspect image
142+
run: |
143+
docker buildx imagetools inspect ghcr.io/${{ env.REPOSITORY }}/${{ inputs.distribution }}:${{ env.TAG }}

0 commit comments

Comments
 (0)