From c5f27f5dca4ced3cdd6babb11b202aa25865b6c3 Mon Sep 17 00:00:00 2001 From: ptak Date: Fri, 15 May 2026 00:22:20 +0200 Subject: [PATCH 1/4] ci: add some workflows --- .github/workflows/cpp_test.yml | 59 ++++++++++++++++++++++++++++++ .github/workflows/python.yml | 35 ++++++++++++++---- .github/workflows/r_check.yml | 67 ++++++++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/cpp_test.yml create mode 100644 .github/workflows/r_check.yml diff --git a/.github/workflows/cpp_test.yml b/.github/workflows/cpp_test.yml new file mode 100644 index 0000000..1375a5d --- /dev/null +++ b/.github/workflows/cpp_test.yml @@ -0,0 +1,59 @@ +name: C++ tests + +on: + push: + paths: + - include/** + - src_core/** + - tests/** + - CMakeLists.txt + - .github/workflows/cpp_test.yml + pull_request: + paths: + - include/** + - src_core/** + - tests/** + - CMakeLists.txt + - .github/workflows/cpp_test.yml + +jobs: + test-fast: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: 'release' + + - name: Configure + run: cmake -B build -DCMAKE_BUILD_TYPE=Release + + - name: Build + run: cmake --build build --target test_core --parallel + + - name: Test + run: ctest --test-dir build --output-on-failure + + test-full: + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: 'release' + + - name: Configure + run: cmake -B build -DCMAKE_BUILD_TYPE=Release + + - name: Build + run: cmake --build build --target test_core --parallel + + - name: Test + run: ctest --test-dir build --output-on-failure diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index c3c3cba..c8f150b 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -3,25 +3,46 @@ name: Python package on: push: paths: - - "py_package/**" - - ".github/workflows/python.yml" + - py_package/** + - .github/workflows/python.yml pull_request: paths: - - "py_package/**" - - ".github/workflows/python.yml" + - py_package/** + - .github/workflows/python.yml jobs: - test: + test-fast: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install package + run: | + python -m pip install --upgrade pip + python -m pip install ./py_package[dev] + + - name: Run tests + run: pytest py_package/tests + test-full: + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["3.11", "3.12"] steps: - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/r_check.yml b/.github/workflows/r_check.yml new file mode 100644 index 0000000..6666040 --- /dev/null +++ b/.github/workflows/r_check.yml @@ -0,0 +1,67 @@ +name: R package check + +on: + push: + paths: + - R/** + - src/** + - man/** + - inst/** + - DESCRIPTION + - NAMESPACE + - .github/workflows/r_check.yml + pull_request: + paths: + - R/** + - src/** + - man/** + - inst/** + - DESCRIPTION + - NAMESPACE + - .github/workflows/r_check.yml + +jobs: + test-fast: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: 'release' + + - name: Sync headers + run: make r-sync-headers + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck, any::tinytest + + - uses: r-lib/actions/check-r-package@v2 + with: + error-on: '"error"' + + test-full: + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: 'release' + + - name: Sync headers + run: make r-sync-headers + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck, any::tinytest + + - uses: r-lib/actions/check-r-package@v2 + with: + error-on: '"error"' From c537005da5a173976fd1c57d878efad2bee13a5a Mon Sep 17 00:00:00 2001 From: ptak Date: Fri, 15 May 2026 00:26:46 +0200 Subject: [PATCH 2/4] ci: create folder --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index f4633be..b2b160c 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ r-doc: Rscript -e "devtools::document()" r-sync-headers: + mkdir -p inst/include cp include/*.hpp inst/include/ r-build: r-sync-headers r-doc From f52f7cea51d8fde6e3a6b3b4c9fd502773b9bba2 Mon Sep 17 00:00:00 2001 From: ptak Date: Fri, 15 May 2026 00:33:58 +0200 Subject: [PATCH 3/4] ci: small r_check change --- .github/workflows/r_check.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/r_check.yml b/.github/workflows/r_check.yml index 6666040..be5f832 100644 --- a/.github/workflows/r_check.yml +++ b/.github/workflows/r_check.yml @@ -9,6 +9,7 @@ on: - inst/** - DESCRIPTION - NAMESPACE + - Makefile - .github/workflows/r_check.yml pull_request: paths: @@ -28,7 +29,7 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: - r-version: 'release' + r-version: "release" - name: Sync headers run: make r-sync-headers @@ -53,7 +54,7 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: - r-version: 'release' + r-version: "release" - name: Sync headers run: make r-sync-headers From ffcecf79ecd5ed3d734d8a99393759c3572c2730 Mon Sep 17 00:00:00 2001 From: ptak Date: Fri, 15 May 2026 00:40:48 +0200 Subject: [PATCH 4/4] fix: add #include --- src_core/MultisetMedian.cpp | 1 + src_core/SlidingWelford.cpp | 1 + src_core/SlidingWelfordRing.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src_core/MultisetMedian.cpp b/src_core/MultisetMedian.cpp index 2e65667..7e1b121 100644 --- a/src_core/MultisetMedian.cpp +++ b/src_core/MultisetMedian.cpp @@ -1,6 +1,7 @@ #include "MultisetMedian.hpp" #include #include +#include MultisetMedian::MultisetMedian(std::size_t size) : window_size_(size) { if (size <= 0) { diff --git a/src_core/SlidingWelford.cpp b/src_core/SlidingWelford.cpp index 2928cd7..c6327d7 100644 --- a/src_core/SlidingWelford.cpp +++ b/src_core/SlidingWelford.cpp @@ -1,4 +1,5 @@ #include "SlidingWelford.hpp" +#include SlidingWelford::SlidingWelford(std::size_t window_size) : window_size_(window_size), mean_(0.0), M2_(0.0) { diff --git a/src_core/SlidingWelfordRing.cpp b/src_core/SlidingWelfordRing.cpp index 3a1dc19..3efc5d6 100644 --- a/src_core/SlidingWelfordRing.cpp +++ b/src_core/SlidingWelfordRing.cpp @@ -1,4 +1,5 @@ #include "SlidingWelfordRing.hpp" +#include SlidingWelfordRing::SlidingWelfordRing(std::size_t window_size) : window_size_(window_size), mean_(0.0), M2_(0.0) {