Add a yamlint workflow #1130
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test | |
on: [ push, pull_request ] | |
permissions: | |
contents: read | |
jobs: | |
linux: | |
runs-on: ubuntu-24.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
qt: | |
- 5 | |
- 5.9.9 | |
- 5.10.1 | |
- 5.11.3 | |
- 5.12.12 | |
- 5.13.2 | |
- 5.14.2 | |
- 5.15.2 | |
- 6 | |
- 6.2.4 | |
- 6.3.2 | |
- 6.4.3 | |
- 6.5.3 | |
- 6.6.3 | |
- 6.7.3 | |
- 6.8.0 | |
env: | |
- { cc: clang, cxx: clang++, coverage: false } | |
- { cc: gcc, cxx: g++, coverage: false } | |
- { cc: gcc, cxx: g++, coverage: true } | |
steps: | |
- name: Upgrade OS | |
run: | | |
sudo apt-mark hold grub-efi-amd64-signed | |
sudo apt update && sudo apt upgrade | |
sudo apt install lcov libfuse2 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '>=3.9' | |
- name: Install Ubuntu's Qt5 | |
if: matrix.qt == 5 | |
run: sudo apt install qtbase5{,-doc}-dev qtconnectivity5-{dev,doc-html} qttools5-dev{,-tools} | |
- name: Install Ubuntu's Qt6 | |
if: matrix.qt == 6 | |
run: > | |
sudo apt install qt6-{base-{dev{,-tools},doc-dev},connectivity-{dev,doc-html},l10n-tools,tools-dev{,-tools}} | |
- name: Install online Qt version | |
if: contains(matrix.qt, '.') # ie if not using Ubuntu's Qt5/Qt6. | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: ${{ matrix.qt }} | |
modules: ${{ startsWith(matrix.qt, '6') && 'qtconnectivity' || '' }} | |
setup-python: false | |
documentation: true | |
doc-archives: >- | |
${{ (startsWith(matrix.qt, '5.10.') || startsWith(matrix.qt, '5.11.')) && 'qt' || | |
(startsWith(matrix.qt, '5') && 'qtcore qtbluetooth' || 'qtcore') }} | |
doc-modules: ${{ startsWith(matrix.qt, '6') && 'qtbluetooth' || '' }} | |
- name: Upload aqtinstall log file | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: aqtinstall-log-linux-${{ matrix.env.cc }}-${{ matrix.qt }}${{ matrix.env.coverage && '-cov' || ''}} | |
path: aqtinstall.log | |
if-no-files-found: error | |
- name: Install linuxdeploy | |
env: | |
BASE_URL: https://github.com/linuxdeploy/linuxdeploy | |
run: | | |
curl --create-dirs --location --output-dir /home/runner/.local/bin --remote-name-all \ | |
"${BASE_URL}/releases/download/continuous/linuxdeploy-x86_64.AppImage" \ | |
"${BASE_URL}-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage" \ | |
"${BASE_URL}-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" | |
chmod a+x /home/runner/.local/bin/linuxdeploy{,-plugin-{appimage,qt}}-x86_64.AppImage | |
- uses: actions/checkout@v4 | |
- name: Build | |
id: build | |
env: | |
CC: ${{ matrix.env.cc }} | |
CXX: ${{ matrix.env.cxx }} | |
PROJECT_BUILD_ID: "${{ github.run_number }}.linux.x86-64.${{ matrix.env.cc }}\ | |
${{ matrix.env.coverage && '-cov' || '' }}.qt-${{ matrix.qt }}" | |
run: | | |
[[ '${{ matrix.qt }}' =~ ^[56]$ ]] || | |
qtInstallDocs="$RUNNER_WORKSPACE/Qt/Docs/Qt-${QT_VERSION:-${{ matrix.qt }}}" | |
cmake -D CMAKE_BUILD_TYPE=Release \ | |
-D ENABLE_COVERAGE=${{ matrix.env.coverage }} \ | |
${qtInstallDocs:+-D "QT_INSTALL_DOCS=$qtInstallDocs"} \ | |
-S "$GITHUB_WORKSPACE" -B "$RUNNER_TEMP" | |
echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" | tee -a "$GITHUB_OUTPUT" | |
{ echo -n 'tap='; [[ '${{ matrix.qt }}' =~ ^5\.1[2-9]|6 ]] && echo true || echo false; } | | |
tee -a "$GITHUB_OUTPUT" | |
cmake --build "$RUNNER_TEMP" | |
"$RUNNER_TEMP/src/cli/dokit" --version | |
- name: Test | |
run: ctest --output-on-failure --test-dir "$RUNNER_TEMP" --verbose | |
- name: Collate test coverage | |
if: matrix.env.coverage | |
run: cmake --build "$RUNNER_TEMP" --target coverage | |
- name: Upload test results | |
if: matrix.env.coverage || fromJSON(steps.build.outputs.tap) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-${{ steps.build.outputs.dokitVersion }} | |
path: | | |
${{ runner.temp }}/coverage.info | |
${{ runner.temp }}/removeHtmlDates.sh | |
${{ runner.temp }}/test/**/*.tap | |
if-no-files-found: error | |
- name: Report parallel coverage to Codacy | |
if: matrix.env.coverage && github.event_name == 'push' && github.actor != 'dependabot[bot]' | |
env: | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
run: > | |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial \ | |
-l CPP -r "${{ runner.temp }}/coverage.info" | |
- name: Report parallel coverage to Coveralls | |
if: matrix.env.coverage && github.event_name == 'push' && github.actor != 'dependabot[bot]' | |
uses: coverallsapp/github-action@v2 | |
with: | |
file: ${{ runner.temp }}/coverage.info | |
format: lcov | |
flag-name: linux-${{ matrix.env.cc }}-${{ matrix.qt }} | |
parallel: true | |
- name: Build AppImage | |
run: cmake --build "$RUNNER_TEMP" --target cli-appimage | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dokit-${{ steps.build.outputs.dokitVersion }} | |
path: | | |
${{ runner.temp }}/src/lib/libQtPokit.so | |
${{ runner.temp }}/src/cli/dokit | |
if-no-files-found: error | |
- name: Upload AppImage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dokit-${{ steps.build.outputs.dokitVersion }}.AppImage | |
path: ${{ runner.temp }}/dokit-${{ steps.build.outputs.dokitVersion }}.AppImage | |
if-no-files-found: error | |
mac: | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
qt: | |
- 5.9.9 | |
- 5.10.1 | |
- 5.11.3 | |
- 5.12.12 | |
- 5.13.2 | |
- 5.14.2 | |
- 5.15.2 | |
- 6.2.4 | |
- 6.3.2 | |
- 6.4.3 | |
- 6.5.3 | |
- 6.6.3 | |
- 6.7.3 | |
- 6.8.0 | |
os: [ 'macos-13', 'macos-14', 'macos-15' ] | |
env: | |
- { cc: clang, cxx: clang++, coverage: false } | |
- { cc: gcc-14, cxx: g++-14, coverage: false } | |
- { cc: gcc-14, cxx: g++-14, coverage: true } | |
exclude: | |
# GitHub's macOS 14+ gcc can only target arm64, but Qt didn't add Apple arm64 support until Qt 6.2, so: | |
# Exclude Qt 5.x (and 6.0, 6.1) with GCC on macOS 14+. Also see the `arch` step below for more details. | |
- { qt: '5.9.9', os: macos-14, env: { cc: gcc-14 } } | |
- { qt: '5.9.9', os: macos-15, env: { cc: gcc-14 } } | |
- { qt: '5.10.1', os: macos-14, env: { cc: gcc-14 } } | |
- { qt: '5.10.1', os: macos-15, env: { cc: gcc-14 } } | |
- { qt: '5.11.3', os: macos-14, env: { cc: gcc-14 } } | |
- { qt: '5.11.3', os: macos-15, env: { cc: gcc-14 } } | |
- { qt: '5.12.12', os: macos-14, env: { cc: gcc-14 } } | |
- { qt: '5.12.12', os: macos-15, env: { cc: gcc-14 } } | |
- { qt: '5.13.2', os: macos-14, env: { cc: gcc-14 } } | |
- { qt: '5.13.2', os: macos-15, env: { cc: gcc-14 } } | |
- { qt: '5.14.2', os: macos-14, env: { cc: gcc-14 } } | |
- { qt: '5.14.2', os: macos-15, env: { cc: gcc-14 } } | |
- { qt: '5.15.2', os: macos-14, env: { cc: gcc-14 } } | |
- { qt: '5.15.2', os: macos-15, env: { cc: gcc-14 } } | |
# Exclude Qt 5.x and 6.2 with Clang on macOS 14+, since these have unit tests that hang on GitHub's runners. | |
- { qt: '5.9.9', os: macos-14, env: { cc: clang } } # \todo Explore these hangs on a local macOS host, | |
- { qt: '5.9.9', os: macos-15, env: { cc: clang } } # \todo because they might not be specific to GitHub. | |
- { qt: '5.10.1', os: macos-14, env: { cc: clang } } | |
- { qt: '5.10.1', os: macos-15, env: { cc: clang } } | |
- { qt: '5.11.3', os: macos-14, env: { cc: clang } } | |
- { qt: '5.11.3', os: macos-15, env: { cc: clang } } | |
- { qt: '5.12.12', os: macos-14, env: { cc: clang } } | |
- { qt: '5.12.12', os: macos-15, env: { cc: clang } } | |
- { qt: '5.13.2', os: macos-14, env: { cc: clang } } | |
- { qt: '5.13.2', os: macos-15, env: { cc: clang } } | |
- { qt: '5.14.2', os: macos-14, env: { cc: clang } } | |
- { qt: '5.14.2', os: macos-15, env: { cc: clang } } | |
- { qt: '5.15.2', os: macos-14, env: { cc: clang } } | |
- { qt: '5.15.2', os: macos-15, env: { cc: clang } } | |
- { qt: '6.2.4', os: macos-14, env: { cc: clang } } | |
- { qt: '6.2.4', os: macos-15, env: { cc: clang } } | |
# Exclude Qt 5.10 with GCC on macOS. See https://bugreports.qt.io/browse/QTBUG-66585 | |
- { qt: '5.10.1', env: { cc: gcc-14 } } | |
# Exclude Qt 6.x with GCC on macOS for now. See https://bugreports.qt.io/browse/QTBUG-107050 | |
- { qt: '6.2.4', env: { cc: gcc-14 } } | |
- { qt: '6.3.2', env: { cc: gcc-14 } } | |
- { qt: '6.4.3', env: { cc: gcc-14 } } | |
- { qt: '6.5.3', env: { cc: gcc-14 } } | |
- { qt: '6.6.3', env: { cc: gcc-14 } } | |
- { qt: '6.7.3', env: { cc: gcc-14 } } | |
- { qt: '6.8.0', env: { cc: gcc-14 } } | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install lcov | |
run: brew install lcov | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: ${{ matrix.qt }} | |
modules: ${{ startsWith(matrix.qt, '6') && 'qtconnectivity' || '' }} | |
documentation: true | |
doc-archives: >- | |
${{ (startsWith(matrix.qt, '5.10.') || startsWith(matrix.qt, '5.11.')) && 'qt' || | |
(startsWith(matrix.qt, '5') && 'qtcore qtbluetooth' || 'qtcore') }} | |
doc-modules: ${{ startsWith(matrix.qt, '6') && 'qtbluetooth' || '' }} | |
- name: Upload aqtinstall log file | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "aqtinstall-log-\ | |
${{ matrix.os }}-${{ matrix.env.cc }}-${{ matrix.qt }}${{ matrix.env.coverage && '-cov' || ''}}" | |
path: aqtinstall.log | |
if-no-files-found: error | |
- name: Choose target architectures | |
id: arch | |
run: | | |
# Qt only supports x86-64 (not arm64) prior to Qt 6.2.0. See https://www.qt.io/blog/qt-on-apple-silicon | |
if [[ '${{ matrix.qt }}' =~ ^(5|6\.[01])\. ]]; then arch=x86_64 | |
# GitHub runners' (homebrew'd) gcc's only support support x86-64 prior to macos-14, and only arm64 after. | |
# Note: if we attempt to use multiple archs, gcc will warn, but continue, resulting in later failures. | |
elif [[ '${{ matrix.env.cc }}' == gcc-* ]]; then | |
if [[ '${{ matrix.os }}' == 'macos-13' ]]; then arch='x86_64'; else arch='arm64'; fi | |
# Otherwise, default to universal binaries, where possible. | |
else arch='arm64;x86_64'; fi | |
tee -a "$GITHUB_ENV" <<< "CMAKE_OSX_ARCHITECTURES=${arch}" | |
tee -a "$GITHUB_OUTPUT" <<< "buildId=${arch//;/-}" | |
- name: Build | |
id: build | |
env: | |
CC: ${{ matrix.env.cc }} | |
CXX: ${{ matrix.env.cxx }} | |
PROJECT_BUILD_ID: "${{ github.run_number }}.${{ matrix.os }}.${{ steps.arch.outputs.buildId }}.\ | |
${{ matrix.env.cc }}${{ matrix.env.coverage && '-cov' || '' }}.qt-${{ matrix.qt }}" | |
run: | | |
cmake -D CMAKE_BUILD_TYPE=Release \ | |
-D CODECOV_GCOV=${{ startsWith(matrix.env.cc, 'gcc') && '/usr/local/bin/gcov-14' || '/usr/bin/gcov'}} \ | |
-D ENABLE_COVERAGE=${{ matrix.env.coverage }} \ | |
-D QT_INSTALL_DOCS="$RUNNER_WORKSPACE/Qt/Docs/Qt-${{ matrix.qt }}" \ | |
-S "$GITHUB_WORKSPACE" -B "$RUNNER_TEMP" | |
echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" | tee -a "$GITHUB_OUTPUT" | |
{ echo -n 'tap='; [[ '${{ matrix.qt }}' =~ ^5\.1[2-9]|6 ]] && echo true || echo false; } | | |
tee -a "$GITHUB_OUTPUT" | |
cmake --build "$RUNNER_TEMP" -- VERBOSE=1 | |
find "$RUNNER_TEMP" -name 'Info.plist' | |
find "$RUNNER_TEMP" -name 'Info.plist' -execdir cat '{}' \; | |
"$RUNNER_TEMP/src/cli/dokit.app/Contents/MacOS/dokit" --version | |
- name: Test | |
run: ctest --output-on-failure --test-dir "$RUNNER_TEMP" --verbose | |
timeout-minutes: 1 | |
- name: Collate test coverage | |
if: matrix.env.coverage | |
run: cmake --build "$RUNNER_TEMP" --target coverage | |
- name: Upload test results | |
if: matrix.env.coverage || fromJSON(steps.build.outputs.tap) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-${{ steps.build.outputs.dokitVersion }} | |
path: | | |
${{ runner.temp }}/coverage.info | |
${{ runner.temp }}/removeHtmlDates.sh | |
${{ runner.temp }}/test/**/*.tap | |
if-no-files-found: error | |
- name: Report parallel coverage to Codacy | |
if: matrix.env.coverage && github.event_name == 'push' && github.actor != 'dependabot[bot]' | |
env: | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
run: > | |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial \ | |
-l CPP -r "${{ runner.temp }}/coverage.info" | |
- name: Report parallel coverage to Coveralls | |
if: matrix.env.coverage && github.event_name == 'push' && github.actor != 'dependabot[bot]' | |
uses: coverallsapp/github-action@v2 | |
with: | |
file: ${{ runner.temp }}/coverage.info | |
format: lcov | |
flag-name: mac-${{ matrix.env.cc }}-${{ matrix.qt }} | |
parallel: true | |
- name: Make app bundle | |
run: macdeployqt "$RUNNER_TEMP/src/cli/dokit.app" -dmg -verbose=2 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dokit-${{ steps.build.outputs.dokitVersion }} | |
path: ${{ runner.temp }}/src/cli/*.app | |
if-no-files-found: error | |
win: | |
runs-on: windows-latest | |
defaults: { run: { shell: cmd } } | |
strategy: | |
fail-fast: false | |
matrix: | |
qt: | |
- 5.9.9 | |
- 5.10.1 | |
- 5.11.3 | |
- 5.12.12 | |
- 5.13.2 | |
- 5.14.2 | |
- 5.15.2 | |
- 6.2.4 | |
- 6.3.2 | |
- 6.4.3 | |
- 6.5.3 | |
- 6.6.3 | |
- 6.7.3 | |
- 6.8.0 | |
generator: [ 'MinGW Makefiles', 'NMake Makefiles' ] | |
arch: [ x86, x86-64, arm64 ] | |
exclude: | |
# Exclude arm64 builds for Qt's earlier than 6.2, since Qt only added (Windows) arm64 | |
# 'Technology Preview' support in 6.2. | |
- { arch: arm64, qt: '5.9.9' } | |
- { arch: arm64, qt: '5.10.1' } | |
- { arch: arm64, qt: '5.11.3' } | |
- { arch: arm64, qt: '5.12.12' } | |
- { arch: arm64, qt: '5.13.2' } | |
- { arch: arm64, qt: '5.14.2' } | |
- { arch: arm64, qt: '5.15.2' } | |
- { arch: arm64, qt: '6.8.0' } # \todo 6.8.0 Beta1 removes cross-compiling to ARM support. | |
# Exclude MinGW builds for arm64, since MinGW has no arm64 support. | |
- { arch: arm64, generator: 'MinGW Makefiles' } | |
# Exclude MinGW builds for x86 (32-bit), since the GitHub Actions Windows runners only | |
# includes MinGW-w64, and not MinGW (32-bit). | |
- { arch: x86, generator: 'MinGW Makefiles' } | |
# Exclude x86 (32-bit) builds for Qt 5.10.1 with MSVC, for QTBUG-67259. | |
# See https://bugreports.qt.io/browse/QTBUG-67259 | |
- { arch: x86, qt: '5.10.1', generator: 'NMake Makefiles' } | |
# Exclude x86 (32-bit) builds for Qt 6.x, since the Qt online installer doesn't provide | |
# those binaries for Qt6. | |
- { arch: x86, qt: '6.2.4' } | |
- { arch: x86, qt: '6.3.2' } | |
- { arch: x86, qt: '6.4.3' } | |
- { arch: x86, qt: '6.5.3' } | |
- { arch: x86, qt: '6.6.3' } | |
- { arch: x86, qt: '6.7.3' } | |
- { arch: x86, qt: '6.8.0' } | |
# Exclude MinGW builds for x86-64 with Qt's earlier than 5.12, since the Qt online | |
# installer (as used by aqtinstaller) did not include x86-64 binaries until Qt 5.12. | |
- { arch: x86-64, qt: '5.9.9', generator: 'MinGW Makefiles' } | |
- { arch: x86-64, qt: '5.10.1', generator: 'MinGW Makefiles' } | |
- { arch: x86-64, qt: '5.11.3', generator: 'MinGW Makefiles' } | |
include: # Override default arch's for install-qt-action and msvc-dev-cmd. | |
- { generator: 'MinGW Makefiles', qt: '5.12.12', qtArch: win64_mingw73 } | |
- { generator: 'MinGW Makefiles', qt: '5.13.2', qtArch: win64_mingw73 } | |
- { generator: 'MinGW Makefiles', qt: '5.14.2', qtArch: win64_mingw73 } | |
- { generator: 'MinGW Makefiles', qt: '5.15.2', qtArch: win64_mingw81 } | |
- { generator: 'MinGW Makefiles', qt: '6.2.4', qtArch: win64_mingw } | |
- { generator: 'MinGW Makefiles', qt: '6.3.2', qtArch: win64_mingw } | |
- { generator: 'MinGW Makefiles', qt: '6.4.3', qtArch: win64_mingw } | |
- { generator: 'MinGW Makefiles', qt: '6.5.3', qtArch: win64_mingw } | |
- { generator: 'MinGW Makefiles', qt: '6.6.3', qtArch: win64_mingw } | |
- { generator: 'MinGW Makefiles', qt: '6.7.3', qtArch: win64_mingw } | |
- { generator: 'MinGW Makefiles', qt: '6.8.0', qtArch: win64_mingw } | |
- { generator: 'NMake Makefiles', arch: x86, qt: '5.9.9', qtArch: win32_msvc2015 } | |
- { generator: 'NMake Makefiles', arch: x86, qt: '5.11.3', qtArch: win32_msvc2015 } | |
- { generator: 'NMake Makefiles', arch: x86, qt: '5.12.12', qtArch: win32_msvc2017 } | |
- { generator: 'NMake Makefiles', arch: x86, qt: '5.13.2', qtArch: win32_msvc2017 } | |
- { generator: 'NMake Makefiles', arch: x86, qt: '5.14.2', qtArch: win32_msvc2017 } | |
- { generator: 'NMake Makefiles', arch: x86, qt: '5.15.2', qtArch: win32_msvc2019 } | |
- { generator: 'NMake Makefiles', arch: arm64, qtArch: win64_msvc2019_arm64 } | |
- { generator: 'NMake Makefiles', arch: arm64, msvcArch: amd64_arm64 } | |
- { generator: 'NMake Makefiles', arch: x86, msvcArch: amd64_x86 } | |
- { generator: 'NMake Makefiles', arch: x86-64, msvcArch: amd64 } | |
# \todo Remove this one when https://github.com/jurplel/install-qt-action/issues/250 is resovled. | |
- { generator: 'NMake Makefiles', arch: x86-64, qt: '6.8.0', qtArch: win64_msvc2022_64 } | |
# Define the toolchain and dll names per generator (for artifact naming mostly). | |
- { generator: 'NMake Makefiles', tool: msvc, dll: QtPokit.dll } | |
- { generator: 'MinGW Makefiles', tool: mingw, dll: libQtPokit.dll } | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install host Qt for cross-compilation | |
if: matrix.arch == 'arm64' | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: ${{ matrix.qt }} | |
arch: win64_msvc2019_64 | |
set-env: false | |
- name: Upload aqtinstall log file | |
if: matrix.arch == 'arm64' && failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "aqtinstall-log-win-${{ matrix.arch }}-\ | |
${{ startsWith(matrix.generator, 'MinGW') && 'mingw' || 'msvc' }}-${{ matrix.qt }}-cross" | |
path: aqtinstall.log | |
if-no-files-found: error | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: ${{ matrix.qt }} | |
modules: ${{ startsWith(matrix.qt, '6') && 'qtconnectivity' || '' }} | |
arch: ${{ matrix.qtArch }} | |
# Use Qt's shipped MinGW for Qt 6.6+ for now, as the runner's MinGW version crashes with Qt 6.6 and 6.7. | |
# \todo Remove this if/when the runner's MinGW is updated to fix the incompatibility. | |
tools: >- | |
${{ (startsWith(matrix.qt, '6.6') || startsWith(matrix.qt, '6.7') || startsWith(matrix.qt, '6.8' )) && | |
startsWith(matrix.generator, 'MinGW') && 'tools_mingw90' || '' }} | |
add-tools-to-path: true | |
documentation: true | |
doc-archives: >- | |
${{ (startsWith(matrix.qt, '5.10.') || startsWith(matrix.qt, '5.11.')) && 'qt' || | |
(startsWith(matrix.qt, '5') && 'qtcore qtbluetooth' || 'qtcore') }} | |
doc-modules: ${{ startsWith(matrix.qt, '6') && 'qtbluetooth' || '' }} | |
- name: Upload aqtinstall log file | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "aqtinstall-log-win-${{ matrix.arch }}-\ | |
${{ startsWith(matrix.generator, 'MinGW') && 'mingw' || 'msvc' }}-${{ matrix.qt }}" | |
path: aqtinstall.log | |
if-no-files-found: error | |
- name: Configure cross-compilation | |
if: matrix.arch == 'arm64' | |
shell: bash | |
run: | | |
echo "CMAKE_TOOLCHAIN_FILE=${QT_ROOT_DIR/_64/_arm64/}\lib\cmake\Qt6\qt.toolchain.cmake" >> $GITHUB_ENV | |
echo "qtHostPath=${QT_ROOT_DIR/_arm64/_64}" >> $GITHUB_ENV | |
- name: Configure MSVC | |
if: ${{ contains(matrix.generator, 'nmake') }} | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: ${{ matrix.msvcArch }} | |
toolset: ${{ startsWith(matrix.qt, '5') && '14.29' || '' }} # MSVC 14.38+ has many deprecation issues w/ Qt5. | |
- name: Build | |
env: | |
PROJECT_BUILD_ID: ${{ github.run_number }}.win.${{ matrix.arch }}.${{ matrix.tool }}.qt-${{ matrix.qt }} | |
run: | | |
cmake -D CMAKE_BUILD_TYPE=Release ^ | |
-D QT_HOST_PATH=%qtHostPath% ^ | |
-D QT_INSTALL_DOCS=%RUNNER_WORKSPACE%\Qt\Docs\Qt-${{ matrix.qt }} ^ | |
-G "${{ matrix.generator }}" -S "%GITHUB_WORKSPACE%" -B "%RUNNER_TEMP%" | |
cmake --build "%RUNNER_TEMP%" | |
- name: Capture build-output variables | |
id: post-build | |
shell: bash | |
run: | | |
echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" | tee -a "$GITHUB_OUTPUT" | |
{ echo -n 'tap='; [[ '${{ matrix.qt }}' =~ ^5\.1[2-9]|6 ]] && echo true || echo false; } | | |
tee -a "$GITHUB_OUTPUT" | |
- name: Install DLL for tests | |
run: | | |
copy /v /b src\lib\${{ matrix.dll }} /b test\unit\cli | |
copy /v /b src\lib\${{ matrix.dll }} /b test\unit\lib | |
working-directory: ${{ runner.temp }} | |
- name: Test # We can't execute arm64 binaries on an x86-64 host. | |
if: matrix.arch != 'arm64' | |
run: ctest --output-on-failure --test-dir "%RUNNER_TEMP%" --verbose | |
- name: Upload test results | |
if: matrix.arch != 'arm64' && fromJSON(steps.post-build.outputs.tap) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-${{ steps.post-build.outputs.dokitVersion }} | |
path: ${{ runner.temp }}/test/**/*.tap | |
if-no-files-found: error | |
- name: Make portable | |
if: matrix.arch != 'arm64' | |
run: | | |
mkdir portable | |
copy /v /b src\lib\${{ matrix.dll }} /b portable | |
copy /v /b src\cli\dokit.exe /b portable | |
cd portable | |
windeployqt --compiler-runtime --release --verbose 2 dokit.exe ${{ matrix.dll }} | |
:: dokit.exe --version # This would hang the job, because Qt will show a message box. | |
working-directory: ${{ runner.temp }} | |
- name: Check portable version | |
if: matrix.arch != 'arm64' | |
shell: bash | |
run: '"$RUNNER_TEMP/portable/dokit.exe" --version' | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dokit-${{ steps.post-build.outputs.dokitVersion }} | |
path: | | |
${{ runner.temp }}/src/lib/${{ matrix.dll }} | |
${{ runner.temp }}/src/cli/dokit.exe | |
if-no-files-found: error | |
- name: Upload artifacts (portable) | |
if: matrix.arch != 'arm64' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dokit-${{ steps.post-build.outputs.dokitVersion }}.portable | |
path: ${{ runner.temp }}/portable | |
if-no-files-found: error | |
collate-test-results: | |
needs: [ linux, mac, win ] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install lcov | |
run: | | |
sudo apt-mark hold grub-efi-amd64-signed | |
sudo apt update | |
sudo apt upgrade | |
sudo apt install lcov | |
- name: Download test results | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh run download "$GITHUB_RUN_ID" --dir "$RUNNER_TEMP/artifacts" --pattern test-results-* | |
- name: Generate test summary | |
uses: pcolby/tap-summary@v1 | |
with: | |
path: ${{ runner.temp }}/artifacts/**/*.tap | |
- name: Generate HTML coverage report | |
run: | | |
shopt -s globstar | |
# Update source code paths from macOS tracefiles to match Linux. | |
sed -i -Ee 's|^SF:/Users|SF:/home|' artifacts/**/coverage.info | |
# Combine all tracefiles into one. | |
lcov $(find artifacts -name '*.info' -type f -printf '-a %p\n') -o coverage.info | |
# Generate the HTML report. | |
echo 'genhtml_sort = 0' >> ~/.lcovrc | |
genhtml --output-directory coverage coverage.info | |
# Can use any of the removeHtmlDates.sh scripts here, so the Ubuntu GCC Qt6 job's version will do. | |
/usr/bin/env bash ./artifacts/test-results-*-cov.qt-6/removeHtmlDates.sh | |
# Remove build numbers from pre-releases, and remove extra build info (such as ".linux.x86-64.gcc-cov") | |
# from all releases, since this coverage report is an aggregation of many build hosts. | |
sed -i -Ee 's/(headerValue">([0-9]+\.){2}[0-9]+)(((-pre)\+[0-9]+)|(\+[0-9]+))\..*</\1\5\6</' \ | |
coverage/**/*.html | |
working-directory: ${{ runner.temp }} | |
- name: Upload HTML coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: "${{ runner.temp }}/coverage" | |
if-no-files-found: error | |
- name: Report partial-finished to Codacy | |
if: github.event_name == 'push' && github.actor != 'dependabot[bot]' | |
env: | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) final | |
- name: Report parallel-finished to Coveralls | |
if: github.event_name == 'push' && github.actor != 'dependabot[bot]' | |
uses: coverallsapp/github-action@v2 | |
with: | |
parallel-finished: true | |
update-tests-on-doc-branch: | |
permissions: | |
contents: write | |
runs-on: ubuntu-24.04 | |
if: success() && (github.ref == 'refs/heads/main') | |
needs: collate-test-results | |
steps: | |
- uses: actions/checkout@v4 | |
with: { ref: doc } | |
- name: Clear previous coverage report | |
run: rm -rf main/cov | |
- name: Download HTML report | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage-report | |
path: main/cov | |
- name: Inject version selectors | |
run: ./.selector.sh | |
- name: Inspect changes # for diagnostics only. | |
run: git status && git diff | |
- name: Push updates | |
run: | | |
[[ -z $(git status --porcelain) ]] || { | |
git config user.name github-actions | |
git config user.email [email protected] | |
git pull | |
git add . | |
git commit -m "Update coverage report for ${GITHUB_SHA}" | |
git push | |
} |