diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..414a959 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -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 diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 0000000..ffb0c19 --- /dev/null +++ b/.github/workflows/linting.yml @@ -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: "." diff --git a/src/proxy/resource.h b/src/proxy/resource.h index 5d1c273..52c87a6 100644 --- a/src/proxy/resource.h +++ b/src/proxy/resource.h @@ -3,4 +3,4 @@ #define IDR_LOADER_DLL 100 -#endif // RESOURCE_H +#endif // RESOURCE_H diff --git a/src/pybind11-qt/include/pybind11_qt/details/pybind11_qt_sip.h b/src/pybind11-qt/include/pybind11_qt/details/pybind11_qt_sip.h index be2e882..2996c4b 100644 --- a/src/pybind11-qt/include/pybind11_qt/details/pybind11_qt_sip.h +++ b/src/pybind11-qt/include/pybind11_qt/details/pybind11_qt_sip.h @@ -25,8 +25,7 @@ namespace pybind11::detail::qt { template struct MetaData>> - : MetaData> { - }; + : MetaData> {}; // template class for most Qt types that have Python equivalent (QWidget, // etc.) diff --git a/src/pybind11-qt/include/pybind11_qt/pybind11_qt_containers.h b/src/pybind11-qt/include/pybind11_qt/pybind11_qt_containers.h index 4c916e6..120b5e8 100644 --- a/src/pybind11-qt/include/pybind11_qt/pybind11_qt_containers.h +++ b/src/pybind11-qt/include/pybind11_qt/pybind11_qt_containers.h @@ -9,41 +9,36 @@ #include // 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 - struct type_caster> : qt::qlist_caster, T> { - }; + struct type_caster> : qt::qlist_caster, T> {}; // QSet // template - struct type_caster> : set_caster, T> { - }; + struct type_caster> : set_caster, T> {}; // QMap // template - struct type_caster> : qt::qmap_caster, K, V> { - }; + struct type_caster> : qt::qmap_caster, K, V> {}; // QStringList // template <> - struct type_caster : qt::qlist_caster { - }; + struct type_caster : qt::qlist_caster {}; // QVariantList // template <> - struct type_caster : qt::qlist_caster { - }; + struct type_caster : qt::qlist_caster {}; // QVariantMap // diff --git a/src/pybind11-qt/include/pybind11_qt/pybind11_qt_enums.h b/src/pybind11-qt/include/pybind11_qt/pybind11_qt_enums.h index ae98cd5..b58cc41 100644 --- a/src/pybind11-qt/include/pybind11_qt/pybind11_qt_enums.h +++ b/src/pybind11-qt/include/pybind11_qt/pybind11_qt_enums.h @@ -18,8 +18,7 @@ }; \ } \ template <> \ - struct type_caster : qt::qt_enum_caster { \ - }; \ + struct type_caster : qt::qt_enum_caster {}; \ } PYQT_ENUM(QtCore, Qt::AlignmentFlag); diff --git a/src/pybind11-qt/include/pybind11_qt/pybind11_qt_objects.h b/src/pybind11-qt/include/pybind11_qt/pybind11_qt_objects.h index 1a9517d..ad5aa1e 100644 --- a/src/pybind11-qt/include/pybind11_qt/pybind11_qt_objects.h +++ b/src/pybind11-qt/include/pybind11_qt/pybind11_qt_objects.h @@ -30,13 +30,11 @@ template <> \ struct type_caster \ : std::conditional_t, \ - type_caster_generic, qt::qt_type_caster> { \ - }; \ + type_caster_generic, qt::qt_type_caster> {}; \ template <> \ struct type_caster \ : std::conditional_t, \ - qt::qt_type_caster, type_caster> { \ - }; \ + qt::qt_type_caster, type_caster> {}; \ } // add declarations below to create bindings - the first argument is simply diff --git a/src/pybind11-utils/include/pybind11_utils/functional.h b/src/pybind11-utils/include/pybind11_utils/functional.h index 67c599e..8662d82 100644 --- a/src/pybind11-utils/include/pybind11_utils/functional.h +++ b/src/pybind11-utils/include/pybind11_utils/functional.h @@ -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; diff --git a/src/pybind11-utils/include/pybind11_utils/shared_cpp_owner.h b/src/pybind11-utils/include/pybind11_utils/shared_cpp_owner.h index 0fb0fe6..4eac89e 100644 --- a/src/pybind11-utils/include/pybind11_utils/shared_cpp_owner.h +++ b/src/pybind11-utils/include/pybind11_utils/shared_cpp_owner.h @@ -80,13 +80,11 @@ namespace mo2::python::detail { template <> \ struct type_caster> \ : mo2::python::detail::shared_cpp_owner_caster> { \ - }; \ + std::shared_ptr> {}; \ template <> \ struct type_caster> \ : mo2::python::detail::shared_cpp_owner_caster< \ - Type, std::shared_ptr> { \ - }; \ + Type, std::shared_ptr> {}; \ } #endif diff --git a/src/pybind11-utils/include/pybind11_utils/smart_variant_wrapper.h b/src/pybind11-utils/include/pybind11_utils/smart_variant_wrapper.h index 8bc5e6d..c5dd815 100644 --- a/src/pybind11-utils/include/pybind11_utils/smart_variant_wrapper.h +++ b/src/pybind11-utils/include/pybind11_utils/smart_variant_wrapper.h @@ -173,8 +173,7 @@ namespace pybind11::detail { template struct type_caster<::mo2::python::smart_variant> - : variant_caster<::mo2::python::smart_variant> { - }; + : variant_caster<::mo2::python::smart_variant> {}; } // namespace pybind11::detail