clippy: fix new warnings in Rust 1.71 #573
This file contains 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
# SPDX-FileCopyrightText: 2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> | |
# SPDX-FileContributor: Andrew Hayzen <andrew.hayzen@kdab.com> | |
# SPDX-FileContributor: Be <be.0@gmx.com> | |
# | |
# SPDX-License-Identifier: MIT OR Apache-2.0 | |
name: cxx-qt tests | |
on: [push, pull_request] | |
# Cancel any previous runs for the same pull request | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: Ubuntu 22.04 (gcc) Qt5 | |
os: ubuntu-22.04 | |
qt_version: 5 | |
# FIXME: valgrind complains about invalid debuginfo. Might be fixed when Ubuntu updates to valgrind 3.20 | |
# https://bugs.kde.org/show_bug.cgi?id=452758 | |
ctest_args: --exclude-regex '^(example_qml_features_test_valgrind|example_qml_minimal_myobject_test_valgrind)$' | |
qt_qpa_platform: offscreen | |
compiler_cache_path: /home/runner/.cache/sccache | |
cargo_dir: ~/.cargo | |
packages-extra: >- | |
qtbase5-dev | |
qtdeclarative5-dev | |
qtquickcontrols2-5-dev | |
qml-module-qtquick2 | |
qml-module-qtquick-controls2 | |
qml-module-qttest | |
workspace: /home/runner/cxx-qt | |
- name: Ubuntu 22.04 (gcc) Qt6 | |
os: ubuntu-22.04 | |
qt_version: 6 | |
# FIXME: valgrind complains about invalid debuginfo. Might be fixed when Ubuntu updates to valgrind 3.20 | |
# https://bugs.kde.org/show_bug.cgi?id=452758 | |
ctest_args: --exclude-regex '^(example_qml_features_test_valgrind|example_qml_minimal_myobject_test_valgrind)$' | |
qt_qpa_platform: offscreen | |
compiler_cache_path: /home/runner/.cache/sccache | |
cargo_dir: ~/.cargo | |
packages-extra: >- | |
qt6-base-dev | |
qt6-declarative-dev | |
qt6-declarative-dev-tools | |
qml6-module-qtquick-controls | |
qml6-module-qtquick-window | |
qml6-module-qttest | |
qml6-module-qtqml-workerscript | |
libgl1-mesa-dev | |
libvulkan-dev | |
libxkbcommon-dev | |
workspace: /home/runner/cxx-qt | |
- name: macOS 11 (clang) Qt5 | |
os: macos-11 | |
qt_version: 5 | |
# FIXME: qmltestrunner fails to import QtQuick module | |
# https://github.com/KDAB/cxx-qt/issues/110 | |
# | |
# FIXME: clang-format-14 causes formatting differences if it is selected by brew | |
# once Ubuntu 22.04 is we can move to clang-format-14 everywhere | |
# for now we need at least clang-format-12 otherwise include reordering fails after clang-format off | |
# https://github.com/KDAB/cxx-qt/issues/121 | |
ctest_args: --exclude-regex '^(example_qml_extension_plugin_test|example_qml_features_test|example_qml_minimal_myobject_test|reuse_lint|cpp_clang_format|.*valgrind)$' | |
qt_qpa_platform: cocoa | |
compiler_cache_path: /Users/runner/Library/Caches/Mozilla.sccache | |
cargo_dir: ~/.cargo | |
workspace: /Users/runner/cxx-qt | |
cc: clang | |
cxx: clang++ | |
- name: macOS 11 (clang) Qt6 | |
os: macos-11 | |
qt_version: 6 | |
# FIXME: qmltestrunner fails to import QtQuick module | |
# https://github.com/KDAB/cxx-qt/issues/110 | |
ctest_args: --exclude-regex '^(example_qml_extension_plugin_test|example_qml_features_test|example_qml_minimal_myobject_test|reuse_lint|cpp_clang_format|.*valgrind)$' | |
qt_qpa_platform: cocoa | |
compiler_cache_path: /Users/runner/Library/Caches/Mozilla.sccache | |
cargo_dir: ~/.cargo | |
workspace: /Users/runner/cxx-qt | |
cc: clang | |
cxx: clang++ | |
- name: Windows 2022 (MSVC) Qt5 | |
os: windows-2022 | |
qt_version: 5 | |
# FIXME: many tests fail to link | |
# https://github.com/KDAB/cxx-qt/issues/111 | |
# cxx_qt_lib_cargo_tests fails to run with a missing DLL error. | |
ctest_args: --exclude-regex '^(cxx_qt_gen_cargo_tests|demo_threading_cargo_tests|example_qml.*|qml.*tests|test.*|reuse_lint|cpp_clang_format|.*valgrind|cxx_qt_lib_cargo_tests)$' | |
exe_suffix: .exe | |
qt_qpa_platform: windows | |
compiler_cache_path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache | |
cargo_dir: C:\Users\runneradmin\.cargo | |
cc: cl | |
cxx: cl | |
# The D drive runs out of space when building dependencies with vcpkg. | |
workspace: C:\cxx-qt | |
- name: Windows 2022 (MSVC) Qt6 | |
os: windows-2022 | |
qt_version: 6 | |
# FIXME: many tests fail to link | |
# https://github.com/KDAB/cxx-qt/issues/111 | |
# cxx_qt_lib_cargo_tests fails to run with a missing DLL error. | |
ctest_args: --exclude-regex '^(cxx_qt_gen_cargo_tests|demo_threading_cargo_tests|example_qml.*|qml.*tests|test.*|reuse_lint|cpp_clang_format|.*valgrind|cxx_qt_lib_cargo_tests)$' | |
exe_suffix: .exe | |
qt_qpa_platform: windows | |
compiler_cache_path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache | |
cargo_dir: C:\Users\runneradmin\.cargo | |
cc: cl | |
cxx: cl | |
# The D drive runs out of space when building dependencies with vcpkg. | |
workspace: C:\cxx-qt | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.name }} | |
env: | |
# 5 GB limit / 6 conditions = 833 MB | |
# Leave some headroom for Rust tools caches which take ~10-15 MB per OS | |
SCCACHE_CACHE_SIZE: 800M | |
steps: | |
# On Windows, the D drive that the workspace is on by default runs out of space when | |
# vcpkg builds Qt, so the repo needs to be cloned to the C drive. GitHub's checkout | |
# action does not support cloning to a path outside GITHUB_WORKSPACE: | |
# https://github.com/actions/checkout/issues/197 | |
- name: "Clone Git repository" | |
uses: LebedevRI/checkout@issue197 | |
with: | |
path: ${{ matrix.workspace }} | |
- name: "Install Rust toolchain" | |
uses: actions-rs/toolchain@v1 | |
with: | |
components: clippy, rustfmt | |
toolchain: stable | |
- name: "Rust tools cache" | |
uses: actions/cache@v3 | |
id: rust-tools-cache | |
with: | |
path: | | |
${{ matrix.cargo_dir }}/bin/sccache${{ matrix.exe_suffix }} | |
${{ matrix.cargo_dir }}/bin/mdbook${{ matrix.exe_suffix }} | |
${{ matrix.cargo_dir }}/bin/mdbook-linkcheck${{ matrix.exe_suffix }} | |
key: ${{ matrix.os }}_sccache-0.3.0_mdbook-0.4.15_mdbook-linkcheck-0.2.8 | |
- name: "Build Rust tools" | |
if: steps.rust-tools-cache.outputs.cache-hit != 'true' | |
run: cargo install sccache mdbook mdbook-linkcheck | |
- name: "Compiler cache" | |
uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.compiler_cache_path }} | |
key: ${{ matrix.name }}-${{ github.head_ref }}-${{ github.run_number }} | |
restore-keys: | | |
${{ matrix.name }}-${{ github.head_ref }} | |
${{ matrix.name }} | |
- name: "[Ubuntu] Install dependencies" | |
if: runner.os == 'Linux' | |
run: >- | |
sudo apt-get update && | |
sudo apt-get install -y | |
ninja-build | |
clang-format-12 | |
libssl-dev | |
pkg-config | |
python3-pip | |
valgrind | |
${{ matrix.packages-extra }} | |
# hack around https://bugs.launchpad.net/ubuntu/+source/qtchooser/+bug/1964763 | |
- name: "[Ubuntu] Add Qt6 tools to PATH" | |
if: runner.os == 'Linux' && matrix.qt_version == 6 | |
run: echo "PATH=/usr/lib/qt6/bin:${PATH}" >> "${GITHUB_ENV}" | |
- name: "[Ubuntu] Install reuse" | |
if: runner.os == 'Linux' | |
run: pip3 install reuse | |
- name: "[macOS] Install dependencies" | |
if: runner.os == 'macOS' | |
# FIXME: clang-format-14 causes formatting differences if it is selected by brew | |
# once Ubuntu 22.04 is we can move to clang-format-14 everywhere | |
# for now we need at least clang-format-12 otherwise include reordering fails after clang-format off | |
# https://github.com/KDAB/cxx-qt/issues/121 | |
# | |
# automake is needed for building libicu which is a dependency of Qt | |
run: brew install automake autoconf-archive ninja clang-format | |
- name: "Authenticate to GitHub Packages" | |
if: runner.os != 'Linux' && github.repository_owner == 'KDAB' | |
shell: bash | |
run: | | |
nuget sources add -Name cxx-qt-github-packages -Source https://nuget.pkg.github.com/KDAB/index.json -Username KDAB -Password ${{ secrets.GITHUB_TOKEN }} -NonInteractive | |
nuget setapikey ${{ secrets.GITHUB_TOKEN }} -Source cxx-qt-github-packages -NonInteractive | |
echo "VCPKG_BINARY_SOURCES=clear;nuget,cxx-qt-github-packages,readwrite;" >> "${GITHUB_ENV}" | |
# Required for CMake to find Ninja | |
- name: "[Windows] Set up MSVC Developer Command Prompt" | |
if: runner.os == 'Windows' | |
uses: seanmiddleditch/gha-setup-vsdevenv@v3 | |
# Ninja is required on Windows for CMAKE_CXX_COMPILER_LAUNCHER to work for using sccache. | |
- name: "Configure" | |
run: >- | |
cmake | |
-D USE_QT5=${{ matrix.qt_version == 5 }} | |
-D CMAKE_BUILD_TYPE=Release | |
-G Ninja | |
-S . -B build | |
working-directory: ${{ matrix.workspace }} | |
env: | |
RUSTC_WRAPPER: sccache | |
CC: ${{ matrix.cc }} | |
CXX: ${{ matrix.cxx }} | |
- name: "Build" | |
run: cmake --build build --config Release --parallel 2 | |
working-directory: ${{ matrix.workspace }} | |
env: | |
RUSTC_WRAPPER: sccache | |
- name: "Test" | |
run: ctest ${{ matrix.ctest_args }} -C Release -T test --output-on-failure --parallel 2 | |
working-directory: ${{ matrix.workspace }}/build | |
env: | |
RUSTC_WRAPPER: sccache | |
QT_QPA_PLATFORM: ${{ matrix.qt_qpa_platform }} | |
QT_SELECT: qt${{ matrix.qt_version }} | |
- name: "Print compiler cache statistics" | |
run: sccache --show-stats | |
- name: Upload GitHub Actions artifacts of vcpkg logs | |
if: always() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: vcpkg-logs-${{ matrix.name }} | |
path: | | |
${{ matrix.workspace }}/vcpkg/buildtrees/**/*.log | |
${{ matrix.workspace }}/build/vcpkg-bootstrap.log | |
${{ matrix.workspace }}/build/vcpkg-manifest-install.log | |
${{ matrix.workspace }}/build/vcpkg_installed/vcpkg/issue_body.md | |
if-no-files-found: ignore |