Skip to content

Commit 599f946

Browse files
authored
Update qt6_crossbuild.yml
1 parent 8f5c2cc commit 599f946

File tree

1 file changed

+118
-64
lines changed

1 file changed

+118
-64
lines changed

.github/workflows/qt6_crossbuild.yml

+118-64
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
name: cmake ninja crossbuild package release
1+
name: qt6 crossbuild package release
22

33
on:
44
workflow_dispatch:
55
inputs:
66
skip_rerun:
77
description: "Skip rerun?"
88
required: true
9-
default: true
109
type: boolean
1110
retries:
12-
description: "Number of rerun retries"
11+
description: 'Number of rerun retries'
1312
required: true
14-
default: "1"
13+
default: '5'
1514
type: choice
16-
options: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
15+
options: [ "1", "2", "3", "4", "5", "6", "7", "8", "9" ]
1716

1817
concurrency:
1918
group: ${{ github.workflow }}-${{ github.ref }}
@@ -26,12 +25,11 @@ jobs:
2625
build:
2726
runs-on: ubuntu-latest
2827
outputs:
29-
cmake_version: ${{ steps.version_info.outputs.cmake_version }}
30-
ninja_version: ${{ steps.version_info.outputs.ninja_version }}
28+
qt_version: ${{ steps.version_info.outputs.qt_version }}
3129
strategy:
3230
fail-fast: false
3331
matrix:
34-
name: [cmake-swizzin]
32+
name: [qt6-swizzin]
3533
os_id: [debian, ubuntu]
3634
os_codename: [bullseye, bookworm, focal, jammy, noble]
3735
arch: [amd64, armhf, arm64]
@@ -47,10 +45,12 @@ jobs:
4745
- os_id: ubuntu
4846
os_codename: bookworm
4947

48+
5049
name: ${{ matrix.os_id }}:${{ matrix.os_codename }} ${{ matrix.name }} ${{ matrix.arch }}
5150

5251
env:
5352
opt_dir_name: "opt/local"
53+
qt_short_version: "6.5"
5454
cxx_standard: "17"
5555
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
5656

@@ -62,18 +62,24 @@ jobs:
6262
- name: Host - phased updates
6363
run: printf '%s\n' 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates
6464

65+
# Bootstrap Ubuntu Lunar repo so that we can install specific app we may need, like binfmt and qemu-user-static
66+
- name: Host - set up lunar repo -t lunar
67+
run: |
68+
printf '%b\n' 'Package: *\nPin: release n=lunar\nPin-Priority: 50' | sudo tee /etc/apt/preferences
69+
printf '%s\n' 'deb http://archive.ubuntu.com/ubuntu/ lunar main universe restricted' | sudo tee /etc/apt/sources.list.d/lunar.list
70+
6571
- name: Host - update
6672
run: sudo apt-get update
6773

68-
- name: Host - upgrade
69-
run: sudo apt-get -y upgrade
74+
# - name: Host - upgrade
75+
# run: sudo apt-get -y upgrade
7076

71-
# No action or other method to bootstrap binfmt-support and qemu-user-static on the host runner
72-
- name: Host - set up qemu-user-static binfmt-support
73-
run: sudo apt install libpipeline1 qemu-user-static binfmt-support
77+
# No action or other method to bootstrap binfmt. Install from lunar and we get the latest versions and full docker support
78+
- name: Host - set up qemu-user-static binfmt-support from lunar
79+
run: sudo apt install -t lunar libpipeline1 qemu-user-static binfmt-support
7480

7581
# Why are we doing it like this and not using a container setup? That's how you're supposed to do it, right?
76-
# qemu-user-static and binfmt-support are not part of the runner images https://github.com/actions/runner-images?tab=readme-ov-file#available-images
82+
# qemu-user-static and binfmt-support are not part of the runner images https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
7783
# We would need to modify the runner to install these before the container starts. Which you cannot do as there is no way to bootstrap the host.
7884
# So we install them on the host then create/pull a custom docker image that we use to build the multiarch targets.
7985
# We are always on the host runner but can use any docker image we need with the access the qemu emulation when required.
@@ -88,77 +94,126 @@ jobs:
8894
- name: Host - Create docker multiarch ${{ matrix.arch }} container
8995
run: docker run --name multiarch -it -d -u 1001 -v ${{ github.workspace }}:/home/github ghcr.io/userdocs/dcb:${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.arch }}
9096

91-
- name: Host - cmake set cmake_github_tag
92-
run: printf '%s\n' "cmake_github_tag=$(git ls-remote -q -t --refs https://github.com/Kitware/CMake.git | awk '{sub("refs/tags/", "");sub("(.*)-rc(.*)", ""); print $2 }' | awk '!/^$/' | sort -rV | head -n 1)" >> $GITHUB_ENV
97+
- name: Docker - cmake and ninja download and install
98+
run: |
99+
docker exec multiarch curl -sNL "https://github.com/swizzin/cmake_crossbuild/releases/latest/download/${{ matrix.os_id }}-${{ matrix.os_codename }}-cmake-swizzin-${{ matrix.arch }}.deb" -o ${{ matrix.os_id }}-${{ matrix.os_codename }}-cmake-swizzin-${{ matrix.arch }}.deb
100+
docker exec multiarch sudo dpkg -i ${{ matrix.os_id }}-${{ matrix.os_codename }}-cmake-swizzin-${{ matrix.arch }}.deb
101+
102+
- name: Docker - zlib-ng download and install
103+
run: |
104+
docker exec multiarch curl -sNL "https://github.com/userdocs/zlib-ng-crossbuild/releases/latest/download/${{ matrix.os_id }}-${{ matrix.os_codename }}-zlib-ng-${{ matrix.arch }}.deb" -o ${{ matrix.os_id }}-${{ matrix.os_codename }}-zlib-ng-${{ matrix.arch }}.deb
105+
docker exec multiarch sudo dpkg -i ${{ matrix.os_id }}-${{ matrix.os_codename }}-zlib-ng-${{ matrix.arch }}.deb
93106
94-
- name: Host - ninja set ninja_github_tag
95-
run: printf '%s\n' "ninja_github_tag=$(git ls-remote -q -t --refs https://github.com/ninja-build/ninja.git | awk '/v/{sub("refs/tags/", ""); print $2 }' | awk '!/^$/' | sort -rV | head -n 1)" >> $GITHUB_ENV
107+
- name: Docker - openssl download and install
108+
run: |
109+
docker exec multiarch curl -sNL "https://github.com/userdocs/openssl-crossbuild/releases/latest/download/${{ matrix.os_id }}-${{ matrix.os_codename }}-openssl-${{ matrix.arch }}.deb" -o ${{ matrix.os_id }}-${{ matrix.os_codename }}-openssl-${{ matrix.arch }}.deb
110+
docker exec multiarch sudo dpkg -i ${{ matrix.os_id }}-${{ matrix.os_codename }}-openssl-${{ matrix.arch }}.deb
96111
97-
- name: Host - Git clone cmake
98-
run: git clone --single-branch --branch ${{ env.cmake_github_tag }} --shallow-submodules --recurse-submodules --depth 1 https://github.com/Kitware/CMake.git cmake
112+
- name: Host - qt get latest release info and create env and urls
113+
id: version_info
114+
run: |
115+
qt_version="$(git ls-remote -q -t --refs https://github.com/qt/qtbase.git | awk '/'"${qt_short_version}"'/{sub("refs/tags/v", "");sub("(.*)(-[^0-9].*)(.*)", ""); print $2 }' | awk '!/^$/' | sort -rV | head -n 1)"
99116
100-
- name: Docker - Configure cmake
101-
run: docker exec -w /home/github/cmake multiarch ./configure --parallel=$(nproc) --no-system-libs --enable-ccache --prefix=/home/github/build/${{ env.opt_dir_name}}
117+
read -ra qt_version_short_array <<< "${qt_version//\./ }"
118+
qt_short_version="${qt_version_short_array[0]}.${qt_version_short_array[1]}"
102119
103-
- name: Docker - Make build cmake
104-
run: docker exec -w /home/github/cmake multiarch make -j $(nproc)
120+
printf '%s\n' "qt_qtbase_url=https://download.qt.io/official_releases/qt/${qt_short_version}/${qt_version}/submodules/qtbase-everywhere-src-${qt_version}.tar.xz" >> $GITHUB_ENV
121+
printf '%s\n' "qt_qttools_url=https://download.qt.io/official_releases/qt/${qt_short_version}/${qt_version}/submodules/qttools-everywhere-src-${qt_version}.tar.xz" >> $GITHUB_ENV
105122
106-
- name: Docker - Make install cmake
107-
run: docker exec -w /home/github/cmake multiarch make install
123+
printf '%s\n' "qt_short_version=${qt_short_version}" >> $GITHUB_ENV
124+
printf '%s\n' "qt_version=${qt_version}" >> $GITHUB_ENV
125+
printf '%s\n' "qt_version=${qt_version}" >> $GITHUB_OUTPUT
108126
109-
- name: Host - Git clone ninja
110-
run: git clone --single-branch --branch ${{ env.ninja_github_tag }} --shallow-submodules --recurse-submodules --depth 1 https://github.com/ninja-build/ninja.git ninja
127+
- name: Host - qt qtbase - curl
128+
run: curl -sNL ${{ env.qt_qtbase_url }} -o qtbase.tar.xz && tar xf qtbase.tar.xz
111129

112-
- name: Docker - Configure ninja
130+
- name: Docker - qt qtbase - cmake configure
113131
run: >
114-
docker exec -w /home/github/ninja multiarch /home/github/build/${{ env.opt_dir_name }}/bin/cmake -B build
132+
docker exec -w /home/github/qtbase-everywhere-src-${{ env.qt_version }} multiarch cmake -Wno-dev -Wno-deprecated -G Ninja -B build
115133
-D CMAKE_BUILD_TYPE="release"
134+
-D CMAKE_CXX_FLAGS="-lstdc++fs"
135+
-D CMAKE_EXE_LINKER_FLAGS="-lstdc++fs"
136+
-D QT_FEATURE_optimize_full=on
137+
-D FEATURE_glib=OFF
138+
-D QT_FEATURE_gui=off -D QT_FEATURE_openssl_linked=on -D QT_FEATURE_dbus=off
139+
-D QT_FEATURE_system_pcre2=off -D QT_FEATURE_widgets=off
140+
-D FEATURE_androiddeployqt=OFF -D FEATURE_animation=OFF
141+
-D QT_FEATURE_testlib=off -D QT_BUILD_EXAMPLES=off -D QT_BUILD_TESTS=off
142+
-D QT_BUILD_EXAMPLES_BY_DEFAULT=OFF -D QT_BUILD_TESTS_BY_DEFAULT=OFF
143+
-D QT_FEATURE_gui=OFF -D QT_FEATURE_widgets=OFF -D QT_FEATURE_dbus=OFF -D QT_FEATURE_openssl_linked=on
144+
-D QT_FEATURE_system_pcre2=off -D QT_FEATURE_system_harfbuzz=off -D QT_FEATURE_system_freetype=off
116145
-D CMAKE_CXX_STANDARD="${{ env.cxx_standard }}"
146+
-D CMAKE_PREFIX_PATH="/${{ env.opt_dir_name }}"
117147
-D CMAKE_INSTALL_PREFIX="/home/github/build/${{ env.opt_dir_name }}"
148+
continue-on-error: true
118149

119-
- name: Docker - Build ninja
120-
run: docker exec -w /home/github/ninja multiarch /home/github/build/${{ env.opt_dir_name }}/bin/cmake --build build -j"$(nproc)"
150+
- name: Archive logs
151+
if: failure()
152+
uses: actions/upload-artifact@v3
153+
with:
154+
name: ${{ matrix.arch }}-${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.name }}-cmake-logs
155+
path: qtbase-everywhere-src-${{ env.qt_version }}/build/
121156

122-
- name: Docker - Install ninja
123-
run: docker exec -w /home/github/ninja multiarch /home/github/build/${{ env.opt_dir_name }}/bin/cmake --install build
157+
- name: Docker - qt qtbase - cmake build
158+
run: docker exec -w /home/github/qtbase-everywhere-src-${{ env.qt_version }} multiarch cmake --build build
124159

125-
- name: Docker - Test cmake and ninja binaries and set versions
126-
run: |
127-
docker exec -w /home/github multiarch bash -c '/home/github/build/${{ env.opt_dir_name }}/bin/cmake --version 2> /dev/null | awk "NR==1{print \$3}" > cmake.version'
128-
docker exec -w /home/github multiarch bash -c '/home/github/build/${{ env.opt_dir_name }}/bin/ninja --version 2> /dev/null > ninja.version'
160+
- name: Docker - qt qtbase - cmake install
161+
run: docker exec -w /home/github/qtbase-everywhere-src-${{ env.qt_version }} multiarch cmake --install build
129162

130-
- name: Host - Set cmake and ninja versions to variable
131-
id: version_info
132-
run: |
133-
cmake_version="$(<cmake.version)" cmake_version="${cmake_version%%-*}"
134-
printf '%s\n' "cmake_version=${cmake_version}" >> $GITHUB_ENV
163+
- name: Docker - qt qttools - curl
164+
run: curl -sNL ${{ env.qt_qttools_url }} -o qttools.tar.xz && tar xf qttools.tar.xz
135165

136-
ninja_version="$(<ninja.version)" ninja_version="${ninja_version%\.git}"
137-
printf '%s\n' "ninja_version=${ninja_version}" >> $GITHUB_ENV
166+
- name: Docker - qt qttools - cmake configure
167+
run: >
168+
docker exec -w /home/github/qttools-everywhere-src-${{ env.qt_version }} multiarch cmake -Wno-dev -Wno-deprecated -G Ninja -B build
169+
-D CMAKE_BUILD_TYPE="release"
170+
-D CMAKE_CXX_STANDARD="${{ env.cxx_standard }}"
171+
-D CMAKE_PREFIX_PATH="/${{ env.opt_dir_name }}"
172+
-D CMAKE_INSTALL_PREFIX="/home/github/build/${{ env.opt_dir_name }}"
138173
139-
printf '%s\n' "cmake_version=${cmake_version}" >> $GITHUB_OUTPUT
140-
printf '%s\n' "ninja_version=${ninja_version}" >> $GITHUB_OUTPUT
174+
- name: Docker - qt qttools - cmake build
175+
run: docker exec -w /home/github/qttools-everywhere-src-${{ env.qt_version }} multiarch cmake --build build
141176

142-
- name: Host - Set deb dependencies for cmake and ninja
143-
run: printf '%s\n' "cmake-deb-deps=openssl" >> $GITHUB_ENV
177+
- name: Docker - qt qttools - cmake install
178+
run: docker exec -w /home/github/qttools-everywhere-src-${{ env.qt_version }} multiarch cmake --install build
179+
180+
- name: Docker - Set deb dependencies for qt
181+
run: |
182+
icu="$(docker exec multiarch apt-cache search --names-only libicu[0-9]+$ | sort -r | head -n1 | awk '{print $1}')"
183+
double_conversion="$(docker exec multiarch apt-cache search --names-only libdouble-conversion[0-9]$ | sort -r | head -n1 | awk '{print $1}')"
184+
185+
if [[ ${{ matrix.os_codename }} =~ ^(bullseye|jammy)$ ]]; then
186+
md4c_html="$(docker exec multiarch apt-cache search --names-only libmd4c-html0$ | sort -r | head -n1 | awk '{print $1}')"
187+
printf '%s\n' "qt-deb-deps=zlib-ng,openssl,${icu},${double_conversion},${md4c_html}" >> $GITHUB_ENV
188+
else
189+
printf '%s\n' "qt-deb-deps=zlib-ng,openssl,${icu},${double_conversion}" >> $GITHUB_ENV
190+
fi
191+
192+
- name: Docker - ldconfig - create /etc/ld.so.conf.d/qt6.conf
193+
run: |
194+
docker exec -w /home/github/build multiarch mkdir -p DEBIAN
195+
docker exec -w /home/github/build/DEBIAN multiarch bash -c "printf '%b\n' '#!/usr/bin/env bash\nldconfig' > postinst"
196+
docker exec -w /home/github/build/DEBIAN multiarch bash -c "chmod +x postinst"
197+
docker exec -w /home/github/build multiarch mkdir -p etc/ld.so.conf.d
198+
docker exec -w /home/github/build/etc/ld.so.conf.d multiarch bash -c "printf '%s\n' '/${{ env.opt_dir_name }}/lib' > qt6.conf"
144199
145200
- name: Host - Create deb packages
146201
uses: jiro4989/build-deb-action@v3
147202
with:
148203
package: "${{ matrix.name }}"
149204
package_root: build
150-
maintainer: userdocs
205+
maintainer: swizzin
151206
compress_type: gzip
152-
version: "${{ env.cmake_version }}+${{ env.ninja_version }}"
153-
depends: "${{ env.cmake-deb-deps }}"
207+
version: "${{ env.qt_version }}"
208+
depends: "${{ env.qt-deb-deps }}"
154209
arch: "${{ matrix.arch }}"
155210
desc: "${{ matrix.name }}-${{ matrix.arch }} for ${{ matrix.os_id }}-${{ matrix.os_codename }}"
156211

157212
- name: Host - Remove version from release name and use hyphens
158-
run: mv -f "${{ matrix.name }}_${{ env.cmake_version }}+${{ env.ninja_version }}_${{ matrix.arch }}.deb" "${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.name }}-${{ matrix.arch }}.deb"
213+
run: mv -f "${{ matrix.name }}_${{ env.qt_version }}_${{ matrix.arch }}.deb" "${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.name }}-${{ matrix.arch }}.deb"
159214

160-
- name: Host - upload artifacts
161-
uses: actions/upload-artifact@v4
215+
- name: Host - upload deb packages
216+
uses: actions/upload-artifact@v3
162217
with:
163218
name: "${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.name }}-${{ matrix.arch }}-deb"
164219
path: "${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.name }}-${{ matrix.arch }}.deb"
@@ -170,14 +225,13 @@ jobs:
170225
if: always() && contains(needs.*.result, 'success') && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
171226
env:
172227
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
173-
cmake_version: ${{ needs.build.outputs.cmake_version }}
174-
ninja_version: ${{ needs.build.outputs.ninja_version }}
228+
qt_version: ${{ needs.build.outputs.qt_version }}
175229
steps:
176230
- name: Checkout
177231
uses: actions/checkout@v4
178232

179233
- name: Host - Download artifacts
180-
uses: actions/download-artifact@v4
234+
uses: actions/download-artifact@v3
181235

182236
- name: Host - artifacts organise for release
183237
run: |
@@ -192,9 +246,9 @@ jobs:
192246
prerelease: false
193247
artifacts: releases/*.deb
194248
replacesArtifacts: true
195-
tag: "${{ env.cmake_version }}_${{ env.ninja_version }}"
196-
name: "cmake ${{ env.cmake_version }} ninja ${{ env.ninja_version }}"
197-
body: "cmake and ninja built from github latest release on amd64 arm64 armhf for: Debian Bullseye Bookworm - Ubuntu Focal Jammy Noble"
249+
tag: "${{ env.qt_version }}"
250+
name: "qt ${{ env.qt_version }}"
251+
body: "Built with cmake using v${{ env.qt_version }} from github on amd64 arm64 armhf for Debian Bullseye/Bookworm and Ubuntu Focal/Jammy"
198252
allowUpdates: true
199253

200254
rerun-on-failure:
@@ -205,10 +259,10 @@ jobs:
205259
actions: write
206260
runs-on: ubuntu-latest
207261
env:
208-
GH_TOKEN: "${{ github.TOKEN }}"
262+
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
209263
steps:
210264
- uses: actions/checkout@v4
211265
- name: Trigger rerun workflow on job failures
212266
run: |
213-
inputs_retries="${{ inputs.retries }}"
214-
gh workflow run rerun.yml -f run_id=${{ github.run_id }} -f attempts=${{ github.run_attempt }} -f retries=${inputs_retries:-1}
267+
inputs_value="${{ inputs.retries }}"
268+
gh workflow run rerun.yml -f run_id=${{ github.run_id }} -f attempts=${{ github.run_attempt }} -f retries=${inputs_value:-3}

0 commit comments

Comments
 (0)