Skip to content

Commit

Permalink
Merge pull request #57 from KDAB/dantti/gha_3.0
Browse files Browse the repository at this point in the history
Add .github actions to 3.0 branch
  • Loading branch information
Allen Winter authored Apr 1, 2024
2 parents 28790c9 + 622b053 commit a6f19f3
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 5 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
#
# SPDX-License-Identifier: MIT

name: CI

on:
push:
branches:
- master
- kdchart-3.0
pull_request:
branches:
- master
- kdchart-3.0

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-22.04
#- windows-2022
#- macos-12

build_type:
#- Debug
- Release

link_type:
- shared
#- static

config:
- qt_version: "5.15"
- qt_version: "6.3.*"

include:
- os: ubuntu-22.04
build_type: Release
link_type: shared
config:
qt_version: "6.6.0"
apt_pgks:
- llvm
pip_pgks:
- shiboken6-generator==6.6.0 pyside6==6.6.0

steps:
- name: Install Qt with options and default aqtversion
uses: jurplel/install-qt-action@v3
with:
aqtversion: null # use whatever the default is
version: ${{ matrix.config.qt_version }}
cache: true

- name: Checkout sources
uses: actions/checkout@v4

- name: Install dependencies on Ubuntu (${{ join(matrix.config.apt_pgks, ' ') }})
if: ${{ runner.os == 'Linux' && matrix.config.apt_pgks }}
run: |
sudo apt update -qq
echo ${{ join(matrix.config.apt_pgks, ' ') }} | xargs sudo apt install -y
- name: Install Python dependencies (${{ join(matrix.config.pip_pgks, ' ') }})
if: ${{ matrix.config.pip_pgks }}
run: echo ${{ join(matrix.config.pip_pgks, ' ') }} | xargs pip install

- name: Hackery due Shiboken hardcoded paths
if: ${{ matrix.config.pip_pgks }}
run: |
sudo mkdir -p /opt/rh/gcc-toolset-10/root/usr/bin/
sudo cp /usr/bin/g++-10 /opt/rh/gcc-toolset-10/root/usr/bin/c++
sudo mkdir -p /opt/rh/gcc-toolset-10/root/usr/lib/gcc/x86_64-linux-gnu/10/
sudo cp /usr/lib/gcc/x86_64-linux-gnu/10/cc1plus /opt/rh/gcc-toolset-10/root/usr/lib/gcc/x86_64-linux-gnu/10/
- name: Install ninja-build tool (must be after Qt due PATH changes)
uses: turtlesec-no/get-ninja@main

- name: Make sure MSVC is found when Ninja generator is in use
uses: ilammy/msvc-dev-cmd@v1

- name: Configure project
run: >
cmake -S . -B ./build -G Ninja
--warn-uninitialized -Werror=dev
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DKDChart_QT6=${{ startsWith(matrix.config.qt_version, '6.') }}
-DKDChart_STATIC=${{ matrix.link_type == 'static' }}
-DKDChart_TESTS=${{ matrix.build_type == 'Debug' }}
-DKDChart_EXAMPLES=${{ matrix.build_type == 'Debug' }}
-DKDChart_DOCS=${{ matrix.build_type == 'Debug' && runner.os == 'Linux' }}
-DKDChart_PYTHON_BINDINGS=${{ matrix.config.pip_pgks }}
-DPython3_FIND_VIRTUALENV=ONLY
- name: Build Project
run: cmake --build ./build

- name: Run tests on Linux (offscreen)
if: ${{ matrix.build_type == 'Debug' && runner.os == 'Linux' }}
run: ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure
env:
QT_QPA_PLATFORM: offscreen

- name: Run tests on Windown/macOS
if: ${{ matrix.build_type == 'Debug' && runner.os != 'Linux' }}
run: ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure

- name: Read tests log when it fails
uses: andstor/file-reader-action@v1
if: ${{ failure() && matrix.build_type == 'Debug' }}
with:
path: "./build/Testing/Temporary/LastTest.log"
59 changes: 59 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
#
# SPDX-License-Identifier: MIT

name: CI Nightly

on:
schedule:
- cron: '0 3 * * *'

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-22.04

config:
- name: clang-tidy
cmake_arg: '-DCMAKE_CXX_CLANG_TIDY=clang-tidy'
qt_version: "5.15"

- name: clazy
cmake_arg: '-DCMAKE_CXX_COMPILER=clazy'
qt_version: "5.15"
apt_pgks:
- clazy

steps:
- name: Install Qt ${{ matrix.config.qt_version }} with options and default aqtversion
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.config.qt_version }}
cache: true

- name: Install ninja-build tool (must be after Qt due PATH changes)
uses: turtlesec-no/get-ninja@main

- name: Install dependencies on Ubuntu (${{ join(matrix.config.apt_pgks, ' ') }})
if: ${{ runner.os == 'Linux' && matrix.config.apt_pgks }}
run: |
sudo apt update -qq
echo ${{ join(matrix.config.apt_pgks, ' ') }} | xargs sudo apt install -y
- uses: actions/checkout@v4
#with:
#ref: '2.0' # schedule.cron do not allow branch setting

- name: Configure project
run: >
cmake -S . -B ./build -G Ninja ${{ matrix.config.cmake_arg }}
--warn-uninitialized -Werror=dev
-DCMAKE_BUILD_TYPE=Debug
-DKDChart_TESTS=ON
- name: Build Project
id: ctest
run: cmake --build ./build
5 changes: 3 additions & 2 deletions cmake/KDAB/modules/KDPySide6ModuleBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ macro(
DIRECTORY
PROPERTY INCLUDE_DIRECTORIES
)
make_path(python_dir_include_dirs ${raw_python_dir_include_dirs})
set(shiboken_include_dirs "${shiboken_include_dirs}${PATH_SEP}${python_dir_include_dirs}")
# python_dir_include_dirs being empty breaks shiboken6 generator https://bugreports.qt.io/browse/PYSIDE-2505
#make_path(python_dir_include_dirs ${raw_python_dir_include_dirs})
#set(shiboken_include_dirs "${shiboken_include_dirs}${PATH_SEP}${python_dir_include_dirs}")

set(shiboken_framework_include_dirs_option "")
if(CMAKE_HOST_APPLE)
Expand Down
2 changes: 1 addition & 1 deletion src/KDGantt/kdganttconstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Constraint::Constraint(const QModelIndex &idx1,
const QModelIndex &idx2,
Constraint::Type type,
Constraint::RelationType relationType,
const Constraint::DataMap &datamap)
const DataMap &datamap)
: d(new Private)
{
d->start = idx1;
Expand Down
4 changes: 2 additions & 2 deletions src/KDGantt/kdganttconstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#endif

namespace KDGantt {
using DataMap = QMap<int, QVariant>;

class KDGANTT_EXPORT Constraint
{
class Private;
Expand All @@ -47,8 +49,6 @@ class KDGANTT_EXPORT Constraint
InvalidConstraintPen
};

typedef QMap<int, QVariant> DataMap;

Constraint();
Constraint(const QModelIndex &idx1,
const QModelIndex &idx2,
Expand Down

0 comments on commit a6f19f3

Please sign in to comment.