chore(main): release 1.0.0 #618
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: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | |
# | |
# SPDX-License-Identifier: MIT | |
name: knut tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# 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: | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: Ubuntu (clang&clazy) | |
os: ubuntu-latest | |
compiler_cache_path: /home/runner/.cache/sccache | |
cmake_preset: clazy | |
- name: Ubuntu (gcc) | |
os: ubuntu-latest | |
compiler_cache_path: /home/runner/.cache/sccache | |
cmake_preset: ci | |
- name: Windows | |
os: windows-latest | |
compiler_cache_path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache | |
cmake_preset: ci | |
- name: MacOS | |
os: macos-latest | |
compiler_cache_path: /Users/runner/Library/Caches/Mozilla.sccache | |
cmake_preset: ci | |
env: | |
SCCACHE_CACHE_SIZE: "2G" | |
steps: | |
- name: Inspect Environment Variables | |
run: env | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
# Ideally, we'd simply like to replace this with: | |
# submodules: recursive | |
# on the "Checkout sources" step | |
# However, this is not possible, as the secret key to access the Github repository is not available from forks. | |
# So we need to conditionally check for the secret key. | |
- name: Checkout submodules | |
run: | | |
git submodule update --init --force --depth=1 --recursive -- 3rdparty/* | |
- name: Configure SSH for connection to codereview.kdab.com (main repo only) | |
uses: shimataro/ssh-key-action@v2 | |
# The GERRIT_SSH_KEY is only available in the main knut repo **after** merging a PR | |
# So only run this step if that's the case. | |
if: ${{ github.repository == 'KDAB/knut' && github.event_name == 'push' }} | |
with: | |
key: ${{ secrets.GERRIT_SSH_KEY }} | |
name: id_knut-github-gerrit-access | |
known_hosts: "[codereview.kdab.com]:29418 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII7rIogDqC3Za+LV37295k312ihzhH/HsSNDE6+VHQMF" | |
config: | | |
Host codereview.kdab.com | |
HostName codereview.kdab.com | |
User knut-github-gerrit-access | |
IdentityFile ~/.ssh/id_knut-github-gerrit-access | |
- name: Checkout private submodules (main repo only) | |
# The GERRIT_SSH_KEY is only available in the main knut repo **after** merging a PR | |
# So only run this step if that's the case. | |
if: ${{ github.repository == 'KDAB/knut' && github.event_name == 'push' }} | |
run: | | |
git submodule update --init --force --depth=1 --recursive -- 3rdparty-kdab/* | |
- name: Install ninja-build tool | |
uses: aseprite/get-ninja@main | |
- name: Install Qt 6 | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: 6.5.* # 6.5 is the current LTS (as of 2024-06-06) | |
cache: true | |
- name: Make sure MSVC is found when Ninja generator is in use | |
uses: ilammy/msvc-dev-cmd@v1 | |
# Note: The Compiler cache steps were adapted from the CXX-Qt repository (https://github.com/kdab/cxx-qt) | |
# | |
# We want our compiler cache to always update to the newest state. | |
# The best way for us to achieve this is to **always** update the cache after every landed commit. | |
# That way it will closely follow our development. | |
# And if a PR diverges a lot with its cache that's not a big deal, as it will be merged eventually. | |
# | |
# This is a workaround for the fact that GH doesn't support updating existing caches. | |
# See: https://github.com/azu/github-actions-overwrite-cache-example | |
# | |
# Ideally we'd like to use this: | |
# - name: "Compiler cache" | |
# uses: actions/cache@v4 | |
# with: | |
# update: true <------- THIS DOESN'T EXIST YET | |
# path: ${{ matrix.compiler_cache_path }} | |
# key: ${{ matrix.name }}_compiler_cache | |
- name: "Restore Compiler Cache" | |
id: compiler-cache-restore | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ matrix.compiler_cache_path }} | |
key: ${{ matrix.os }}_${{ matrix.cmake_preset }}_compiler_cache | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: Install recent clang | |
uses: KyleMayes/install-llvm-action@v2 | |
if: ${{ matrix.cmake_preset == 'clazy' }} | |
with: | |
version: "17" | |
env: true | |
- name: Build & Install clazy | |
if: ${{ matrix.cmake_preset == 'clazy' }} | |
run: | | |
git clone --depth=1 https://github.com/KDE/clazy.git | |
cd clazy/ | |
cmake -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DLINK_CLAZY_TO_LLVM=OFF -DCMAKE_BUILD_TYPE=Release -G Ninja -DLLVM_ROOT=${{ env.LLVM_PATH }} | |
cmake --build . | |
sudo cmake --build . --target install | |
cd .. | |
echo "CLANGXX=${{ env.LLVM_PATH }}/bin/clang++" >> $GITHUB_ENV | |
- name: Configure project | |
run: cmake -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache --preset=${{ matrix.cmake_preset }} | |
- name: Build Project | |
run: cmake --build --preset=${{ matrix.cmake_preset }} | |
- name: Run tests | |
run: ctest --preset=${{ matrix.cmake_preset }} | |
# We only upload artifacts if building or testing has failed | |
# That way we can debug if necessary, but don't pay the 30s-60s | |
# of upload time if everything is going well. | |
- name: Output the build results as an artifact | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: knut-binaries-${{ matrix.os }}-${{ github.head_ref || github.ref_name }} | |
path: build-${{ matrix.cmake_preset }}/bin/ | |
overwrite: true | |
# This is a workaround for the fact that GH doesn't support updating existing caches. | |
# See: https://github.com/azu/github-actions-overwrite-cache-example | |
- name: "Delete previous compiler cache" | |
# Updating th cache doesn't work from forks | |
# So update it once it's merged into the repo | |
if: ${{ steps.compiler-cache-restore.outputs.cache-hit && github.event_name == 'push' }} | |
continue-on-error: true | |
run: | | |
gh extension install actions/gh-actions-cache | |
gh actions-cache delete "${{ matrix.os }}_${{ matrix.cmake_preset }}_compiler_cache" --confirm | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Save Compiler Cache" | |
uses: actions/cache/save@v4 | |
# Updating th cache doesn't work from forks | |
# So update it once it's merged into the repo | |
if: ${{ github.event_name == 'push' }} | |
with: | |
path: ${{ matrix.compiler_cache_path }} | |
key: ${{ matrix.os }}_${{ matrix.cmake_preset }}_compiler_cache |