diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index a9fe0b4..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,33 +0,0 @@ -version: 2 -jobs: - test_debug: - docker: - - image: tschijnmo/drudge:corebase - steps: - - run: | - git clone --recurse-submodules https://github.com/tschijnmo/libparenth.git - mkdir cmake-test-debug - cd cmake-test-debug - cmake -DCMAKE_BUILD_TYPE=debug ../libparenth - make - ./test/testmain - - test_release: - docker: - - image: tschijnmo/gccpython:latest - steps: - - run: | - git clone --recurse-submodules https://github.com/tschijnmo/libparenth.git - mkdir cmake-test-release - cd cmake-test-release - cmake -DCMAKE_BUILD_TYPE=release ../libparenth - make - ./test/testmain - -workflows: - version: 2 - tests: - jobs: - - test_debug - - test_release - diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5a181ce --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 + + # Maintain dependencies for git submodules + - package-ecosystem: "gitsubmodule" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3f349fa --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,47 @@ +name: CI + +on: + push: + branches: + - master + - 'release/*' + pull_request: + branches: + - master + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + permissions: + contents: read + strategy: + matrix: + build_type: [Debug, Release] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y cmake g++ + + - name: Configure CMake + run: | + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .. + + - name: Build + run: | + cd build + make + + - name: Run tests + run: | + cd build + ./test/testmain diff --git a/.gitignore b/.gitignore index cc97520..04e66d7 100644 --- a/.gitignore +++ b/.gitignore @@ -33,5 +33,6 @@ /.idea/ /cmake-*/ +/build-*/ /test/catch.hpp diff --git a/.gitmodules b/.gitmodules index da8c0df..be85c24 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "deps/fbitset"] path = deps/fbitset - url = https://github.com/tschijnmo/fbitset + url = https://github.com/DrudgeCAS/fbitset diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py deleted file mode 100644 index bcc19e2..0000000 --- a/.ycm_extra_conf.py +++ /dev/null @@ -1,12 +0,0 @@ -import os.path -def FlagsForFile(filename, **kwargs): - proj_dir = os.path.dirname(os.path.realpath(__file__)) - - proj_include = os.path.join(proj_dir, 'include'); - fbitset_include = os.path.join(proj_dir, 'deps', 'fbitset', 'include') - flags = [ - '-std=gnu++1z', '-I/usr/local/include', - '-I' + proj_include, '-I' + fbitset_include, - '-I.' - ] - return {'flags': flags} diff --git a/README.md b/README.md index 4064b3c..48538a3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://circleci.com/gh/tschijnmo/libparenth.svg?style=shield)](https://circleci.com/gh/tschijnmo/libparenth) +[![CI](https://github.com/DrudgeCAS/libparenth/actions/workflows/ci.yml/badge.svg)](https://github.com/DrudgeCAS/libparenth/actions/workflows/ci.yml) # libparenth Fast searching for optimal parenthesization of tensor contractions diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a51ce5e..dd78f0b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,16 +1,17 @@ -# Download the Catch2 single header. +# Fetch Catch2 v3.11.0 +include(FetchContent) -file(DOWNLOAD - "https://github.com/catchorg/Catch2/releases/download/v2.0.1/catch.hpp" - "${CMAKE_CURRENT_BINARY_DIR}/catch.hpp" - ) +FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v3.11.0 +) -include_directories(testmain - PRIVATE ${CMAKE_CURRENT_BINARY_DIR} - ) +FetchContent_MakeAvailable(Catch2) # The main test driver. add_executable(testmain - testmain.cpp matrixchain.cpp ) + +target_link_libraries(testmain PRIVATE Catch2::Catch2WithMain) diff --git a/test/matrixchain.cpp b/test/matrixchain.cpp index 1e720c9..642517b 100644 --- a/test/matrixchain.cpp +++ b/test/matrixchain.cpp @@ -10,12 +10,22 @@ */ #include +#include #include -#include - #include +// Disable Catch2's range detection for fbitset by providing stream insertion operator +namespace fbitset { + template + inline std::ostream& operator<<(std::ostream& os, const Fbitset& fs) { + os << "Fbitset<" << N << ">{count=" << fs.count() << "}"; + return os; + } +} + +#include + using namespace libparenth; TEST_CASE("A simple chain product of three matrices can be parenthesized") diff --git a/test/testmain.cpp b/test/testmain.cpp index f442470..772e440 100644 --- a/test/testmain.cpp +++ b/test/testmain.cpp @@ -1,8 +1,2 @@ -#define CATCH_CONFIG_RUNNER -#include - -int main(int argc, char* argv[]) -{ - int result = Catch::Session().run(argc, argv); - return result; -} +// Main test runner is provided by Catch2::Catch2WithMain +// This file is kept for potential future custom main() if needed