Merge pull request #109 from Holt59/ci/initial-gh-action-for-build

Add Github Workflows
This commit is contained in:
Mikaël Capelle
2023-07-09 17:10:28 +02:00
committed by GitHub
10 changed files with 103 additions and 30 deletions
+76
View File
@@ -0,0 +1,76 @@
name: Build Plugin Python
on:
push:
branches: master
pull_request:
types: [opened, reopened]
jobs:
build:
runs-on: windows-2022
steps:
- name: Checkout mob
uses: actions/checkout@v3
with:
repository: modorganizer2/mob
ref: master
path: ./mob
- name: Cache mob
id: cache-mob
uses: actions/cache@v3
with:
path: |
./mob/mob.exe
key: ${{ runner.OS }}-mob-cache-${{ hashFiles('mob/.git/refs/heads/master') }}
restore-keys: |
${{ runner.OS }}-mob-cache-
- if: ${{ steps.cache-mob.outputs.cache-hit != 'true' }}
name: Build mob
run: .\mob\bootstrap.ps1
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.5.1
# modules: qtpositioning qtwebchannel qtwebengine qtwebsockets
cache: true
- name: Add Qt bins to PATH
run: echo "${QT_ROOT_DIR }/msvc2019_64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v3
with:
path: |
./build
!./build/modorganizer_super
key: ${{ runner.OS }}-mo2-dependencies-${{ hashFiles('mob/.git/refs/heads/master') }}
restore-keys: |
${{ runner.OS }}-mo2-dependencies-
- if: ${{ steps.cache-dependencies.outputs.cache-hit != 'true' }}
name: Build dependencies with mob
run: .\mob\mob.exe
-l 4 -d .
build
fmt gtest python spdlog boost sip pyqt pybind11
- name: Build dependencies log
uses: actions/upload-artifact@v3
with:
name: build-dependencies-log
path: |
mob.log
# TODO: cache this?
- name: Build cmake_common and uibase
run: .\mob\mob.exe -l 4 -d . build
--ignore-uncommitted-changes
--redownload --reextract --reconfigure --rebuild
cmake_common uibase
- uses: actions/checkout@v3
with:
path: ./build/modorganizer_super/plugin_python
- name: Build Plugin Python
run: |
..\..\..\mob\mob.exe -l 5 cmake -c "-DPLUGIN_PYTHON_TESTS=1 .." vsbuild
cmake --build vsbuild --config RelWithDebInfo -j4
cmake --build vsbuild --config RelWithDebInfo -j4 --target python-tests --target runner-tests
working-directory: ./build/modorganizer_super/plugin_python
- name: Test Plugin Python
run: ctest --test-dir vsbuild -C RelWithDebInfo --output-on-failure
working-directory: ./build/modorganizer_super/plugin_python
+12
View File
@@ -0,0 +1,12 @@
name: Lint Plugin Python
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run clang-format
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: "15"
check-path: "."
+1 -1
View File
@@ -3,4 +3,4 @@
#define IDR_LOADER_DLL 100
#endif // RESOURCE_H
#endif // RESOURCE_H
@@ -25,8 +25,7 @@ namespace pybind11::detail::qt {
template <typename T>
struct MetaData<T, std::enable_if_t<std::is_pointer_v<T>>>
: MetaData<std::remove_pointer_t<T>> {
};
: MetaData<std::remove_pointer_t<T>> {};
// template class for most Qt types that have Python equivalent (QWidget,
// etc.)
@@ -9,41 +9,36 @@
#include <pybind11/stl.h>
// this needs to be included here to get proper QVariantList and QVariantMap
#include "details/pybind11_qt_qlist.h"
#include "details/pybind11_qt_qmap.h"
#include "pybind11_qt_basic.h"
#include "details/pybind11_qt_qlist.h"
namespace pybind11::detail {
// QList
//
template <class T>
struct type_caster<QList<T>> : qt::qlist_caster<QList<T>, T> {
};
struct type_caster<QList<T>> : qt::qlist_caster<QList<T>, T> {};
// QSet
//
template <class T>
struct type_caster<QSet<T>> : set_caster<QList<T>, T> {
};
struct type_caster<QSet<T>> : set_caster<QList<T>, T> {};
// QMap
//
template <class K, class V>
struct type_caster<QMap<K, V>> : qt::qmap_caster<QMap<K, V>, K, V> {
};
struct type_caster<QMap<K, V>> : qt::qmap_caster<QMap<K, V>, K, V> {};
// QStringList
//
template <>
struct type_caster<QStringList> : qt::qlist_caster<QStringList, QString> {
};
struct type_caster<QStringList> : qt::qlist_caster<QStringList, QString> {};
// QVariantList
//
template <>
struct type_caster<QVariantList> : qt::qlist_caster<QVariantList, QVariant> {
};
struct type_caster<QVariantList> : qt::qlist_caster<QVariantList, QVariant> {};
// QVariantMap
//
@@ -18,8 +18,7 @@
}; \
} \
template <> \
struct type_caster<QEnum> : qt::qt_enum_caster<QEnum> { \
}; \
struct type_caster<QEnum> : qt::qt_enum_caster<QEnum> {}; \
}
PYQT_ENUM(QtCore, Qt::AlignmentFlag);
@@ -30,13 +30,11 @@
template <> \
struct type_caster<QClass*> \
: std::conditional_t<std::is_copy_constructible_v<QClass>, \
type_caster_generic, qt::qt_type_caster<QClass*>> { \
}; \
type_caster_generic, qt::qt_type_caster<QClass*>> {}; \
template <> \
struct type_caster<QClass> \
: std::conditional_t<std::is_copy_constructible_v<QClass>, \
qt::qt_type_caster<QClass>, type_caster<QClass*>> { \
}; \
qt::qt_type_caster<QClass>, type_caster<QClass*>> {}; \
}
// add declarations below to create bindings - the first argument is simply
@@ -97,10 +97,7 @@ namespace pybind11::detail {
: f(std::move(f_))
{
}
func_handle(const func_handle& f_)
{
operator=(f_);
}
func_handle(const func_handle& f_) { operator=(f_); }
func_handle& operator=(const func_handle& f_)
{
gil_scoped_acquire acq;
@@ -80,13 +80,11 @@ namespace mo2::python::detail {
template <> \
struct type_caster<std::shared_ptr<Type>> \
: mo2::python::detail::shared_cpp_owner_caster<Type, \
std::shared_ptr<Type>> { \
}; \
std::shared_ptr<Type>> {}; \
template <> \
struct type_caster<std::shared_ptr<const Type>> \
: mo2::python::detail::shared_cpp_owner_caster< \
Type, std::shared_ptr<const Type>> { \
}; \
Type, std::shared_ptr<const Type>> {}; \
}
#endif
@@ -173,8 +173,7 @@ namespace pybind11::detail {
template <class... Args>
struct type_caster<::mo2::python::smart_variant<Args...>>
: variant_caster<::mo2::python::smart_variant<Args...>> {
};
: variant_caster<::mo2::python::smart_variant<Args...>> {};
} // namespace pybind11::detail