diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 1691ca2152..2945ac2812 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -140,24 +140,23 @@ jobs: run: | column -s, -t < ghcide/bench-results/unprofiled/${{ matrix.example }}/results.csv | tee ghcide/bench-results/unprofiled/${{ matrix.example }}/results.txt + - name: tar benchmarking artifacts + run: find ghcide/bench-results -name "*.csv" -or -name "*.svg" -or -name "*.html" | xargs tar -czf benchmark-artifacts.tar.gz + - name: Archive benchmarking artifacts uses: actions/upload-artifact@v3 with: name: bench-results-${{ runner.os }}-${{ matrix.ghc }} - path: | - ghcide/bench-results/results.* - ghcide/bench-results/**/*.csv - ghcide/bench-results/**/*.svg - ghcide/bench-results/**/*.eventlog.html + path: benchmark-artifacts.tar.gz + + - name: tar benchmarking logs + run: find ghcide/bench-results -name "*.log" -or -name "*.eventlog" -or -name "*.hp" | xargs tar -czf benchmark-logs.tar.gz - name: Archive benchmark logs uses: actions/upload-artifact@v3 with: name: bench-logs-${{ runner.os }}-${{ matrix.ghc }} - path: | - ghcide/bench-results/**/*.log - ghcide/bench-results/**/*.eventlog - ghcide/bench-results/**/*.hp + path: benchmark-logs.tar.gz bench_post_job: if: always() diff --git a/ghcide/bench/config.yaml b/ghcide/bench/config.yaml index bcec13dfbe..a744f56e17 100644 --- a/ghcide/bench/config.yaml +++ b/ghcide/bench/config.yaml @@ -37,14 +37,14 @@ examples: package: lsp-types version: 1.5.0.0 modules: - - src/Language/LSP/VFS.hs - - src/Language/LSP/Types/Lens.hs + - src/Language/LSP/Types/WatchedFiles.hs + - src/Language/LSP/Types/CallHierarchy.hs - name: lsp-types-conservative package: lsp-types version: 1.5.0.0 modules: - - src/Language/LSP/VFS.hs - - src/Language/LSP/Types/Lens.hs + - src/Language/LSP/Types/WatchedFiles.hs + - src/Language/LSP/Types/CallHierarchy.hs extra-args: - --conservative-change-tracking # Small-sized project with TH diff --git a/ghcide/bench/lib/Experiments.hs b/ghcide/bench/lib/Experiments.hs index df58577e6c..081df51984 100644 --- a/ghcide/bench/lib/Experiments.hs +++ b/ghcide/bench/lib/Experiments.hs @@ -24,7 +24,9 @@ module Experiments ) where import Control.Applicative.Combinators (skipManyTill) import Control.Exception.Safe (IOException, handleAny, try) -import Control.Monad.Extra +import Control.Monad.Extra (allM, forM, forM_, unless, + void, whenJust, (&&^)) +import Control.Monad.Fail (MonadFail) import Control.Monad.IO.Class import Data.Aeson (Value (Null), toJSON) import Data.Either (fromRight) @@ -72,8 +74,13 @@ data DocumentPositions = DocumentPositions { doc :: !TextDocumentIdentifier } -allWithIdentifierPos :: Monad m => (DocumentPositions -> m Bool) -> [DocumentPositions] -> m Bool -allWithIdentifierPos f docs = allM f (filter (isJust . identifierP) docs) +allWithIdentifierPos :: MonadFail m => (DocumentPositions -> m Bool) -> [DocumentPositions] -> m Bool +allWithIdentifierPos f docs = case applicableDocs of + -- fail if there are no documents to benchmark + [] -> fail "None of the example modules have identifier positions" + docs' -> allM f docs' + where + applicableDocs = filter (isJust . identifierP) docs experiments :: [Bench] experiments =