Skip to content

CI: Enable cached builds #53

CI: Enable cached builds

CI: Enable cached builds #53

Workflow file for this run

# 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
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
env:
SCCACHE_CACHE_SIZE: "2G"
SCCACHE_GHA_ENABLED: "true"
SCCACHE_GHA_CACHE_TO: "sccache-${{ matrix.os }}"
SCCACHE_GHA_CACHE_FROM: "sccache-${{ matrix.os }}"
SCCACHE_ERROR_LOG: "/tmp/sccache_log.txt"
SCCACHE_LOG: "debug"
steps:
- name: Inspect Environment Variables
run: env
- name: Checkout sources
uses: actions/checkout@v4
# Note: Once we're able to access photonwidgets and mfc-utils, this can simply be replaced by
# setting
# with:
# submodules: recursive
# on the "Checkout sources" step
- name: Checkout submodules
run: |
git submodule update --init --force --depth=1 --recursive -- '3rdparty/extra-cmake-modules'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/kdalgorithms'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/ksyntaxhighlighting'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/nlohmann-json'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/pugixml'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/spdlog'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/tree-sitter'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/tree-sitter-cpp'
# git submodule update --init --force --depth=1 --recursive -- '3rdparty/photonwidgets'
# git submodule update --init --force --depth=1 --recursive -- '3rdparty/mfc-utils'
- 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
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Configure project
run: cmake -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache --preset=ci
- name: Build Project
run: cmake --build --preset=ci
- name: Run tests
run: ctest --preset=ci
# 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-ci/bin/
overwrite: true
- name: Print sccache log
run: cat /tmp/sccache_log.txt