From 0575e3019dfa6dfcee81a9b23540a5258df344a6 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Fri, 15 Aug 2025 20:43:07 +0300 Subject: [PATCH 1/3] Update GHC versions in CI and add macos runners - Properly enable PAPI on linux only - Also dry run benchmarks --- .github/workflows/ci.yml | 37 ++++++++++++++++++++++++------------- statistics.cabal | 5 +++-- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f19af02..34b6343 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,18 +18,22 @@ jobs: matrix: include: # Linux - - { cabal: "3.12", os: ubuntu-latest, ghc: "8.4.4" } - - { cabal: "3.12", os: ubuntu-latest, ghc: "8.6.5" } - - { cabal: "3.12", os: ubuntu-latest, ghc: "8.8.4" } - - { cabal: "3.12", os: ubuntu-latest, ghc: "8.10.7" } - - { cabal: "3.12", os: ubuntu-latest, ghc: "9.0.2" } - - { cabal: "3.12", os: ubuntu-latest, ghc: "9.2.8" } - - { cabal: "3.12", os: ubuntu-latest, ghc: "9.4.8" } - - { cabal: "3.12", os: ubuntu-latest, ghc: "9.6.6" } - - { cabal: "3.12", os: ubuntu-latest, ghc: "9.8.4" } - - { cabal: "3.12", os: ubuntu-latest, ghc: "9.10.1" } - # Fails to resolve aeson [2025.01.14] - # - { cabal: "3.12", os: ubuntu-latest, ghc: "9.12.1" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "8.4.4" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "8.6.5" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "8.8.4" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "8.10.7" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.0.2" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.2.8" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.4.8" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.6.7" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.8.4" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.12.2" } + # Macos + - { cabal: "3.14", os: macos-latest, ghc: "9.6.7" } + - { cabal: "3.14", os: macos-latest, ghc: "9.8.4" } + - { cabal: "3.14", os: macos-latest, ghc: "9.10.2" } + - { cabal: "3.14", os: macos-latest, ghc: "9.12.2" } fail-fast: false steps: @@ -52,6 +56,8 @@ jobs: - name: "Install PAPI" run: | sudo apt-get install -y libpapi-dev + echo FLAG_PAPI=-fBenchPAPI >> "$GITHUB_ENV" + if: matrix.os == 'ubuntu-latest' # ---------------- - name: Versions run: | @@ -74,11 +80,16 @@ jobs: # ---------------- - name: Build run: | + echo FLAG_PAPI=$FLAG_PAPI cd unpacked/statistics-* - cabal configure --haddock-all --enable-tests --enable-benchmarks + cabal configure $FLAG_PAPI --haddock-all --enable-tests --enable-benchmarks --benchmark-option=-l cabal build all --write-ghc-environment-files=always # ---------------- - name: Test run: | cd unpacked/statistics-* cabal test all + # ---------------- + - name: Bench + run: | + cabal bench all diff --git a/statistics.cabal b/statistics.cabal index a466dd1..1fe7f4c 100644 --- a/statistics.cabal +++ b/statistics.cabal @@ -54,9 +54,10 @@ tested-with: || ==9.0.2 || ==9.2.8 || ==9.4.8 - || ==9.6.6 + || ==9.6.7 || ==9.8.4 - || ==9.10.1 + || ==9.10.2 + || ==9.12.2 source-repository head type: git From 32bc108c03df7b6d65e0448409f2944db2c116ba Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Fri, 15 Aug 2025 20:47:16 +0300 Subject: [PATCH 2/3] Bump doctest dependency Fixes #222 --- statistics.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statistics.cabal b/statistics.cabal index 1fe7f4c..97083b1 100644 --- a/statistics.cabal +++ b/statistics.cabal @@ -206,7 +206,7 @@ test-suite statistics-doctests build-depends: base -any , statistics -any - , doctest >=0.15 && <0.24 + , doctest >=0.15 && <0.25 -- We want to be able to build benchmarks using both tasty-bench and tasty-papi. -- They have similar API so we just create two shim modules which reexport From 14fbd7b5abba50f945c51ffbff7d888f6552b6e7 Mon Sep 17 00:00:00 2001 From: Alex Mason Date: Fri, 8 Aug 2025 13:39:50 +1000 Subject: [PATCH 3/3] Make benchmarks work on macOS --- benchmark/{bench.hs => Main.hs} | 2 ++ statistics.cabal | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) rename benchmark/{bench.hs => Main.hs} (99%) diff --git a/benchmark/bench.hs b/benchmark/Main.hs similarity index 99% rename from benchmark/bench.hs rename to benchmark/Main.hs index 4c5b793..c305617 100644 --- a/benchmark/bench.hs +++ b/benchmark/Main.hs @@ -1,3 +1,5 @@ +module Main where + import Data.Complex import Statistics.Sample import Statistics.Transform diff --git a/statistics.cabal b/statistics.cabal index 97083b1..8f01857 100644 --- a/statistics.cabal +++ b/statistics.cabal @@ -224,7 +224,7 @@ benchmark statistics-bench import: bench-stanza type: exitcode-stdio-1.0 hs-source-dirs: benchmark bench-time - main-is: bench.hs + main-is: Main.hs Other-modules: Bench build-depends: tasty-bench >= 0.3 @@ -234,6 +234,6 @@ benchmark statistics-bench-papi if impl(ghcjs) || !flag(BenchPAPI) buildable: False hs-source-dirs: benchmark bench-papi - main-is: bench.hs + main-is: Main.hs Other-modules: Bench build-depends: tasty-papi >= 0.1.2