diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45ace8ed..07bf6af8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -146,6 +146,9 @@ jobs: run: | cd tests + # The two macOS runners share a home, and two stack builds recaching one snapshot's + # package db deadlock against each other. + export STACK_ROOT="$HOME/.stack-$RUNNER_NAME" export NIX_PATH=nixpkgs=$(nix run .#nixpkgsPath) export PATH=$(nix build --no-link .#stack --json | jq -r '.[0].outputs.out')/bin:$PATH @@ -164,10 +167,15 @@ jobs: echo "Got TEST_ROOT: $TEST_ROOT" echo TEST_ROOT="$TEST_ROOT" >> $GITHUB_ENV + # The two macOS runners share a home, and two stack builds recaching one snapshot's + # package db deadlock against each other. + export STACK_ROOT="$HOME/.stack-$RUNNER_NAME" export NIX_PATH=nixpkgs=$(nix run .#nixpkgsPath) export PATH=$(nix build --no-link .#stack --json | jq -r '.[0].outputs.out')/bin:$PATH + export PATH=$(nix build --no-link .#direnv --json | jq -r '.[0].outputs.out')/bin:$PATH - stack run --nix --no-nix-pure -- \ + direnv allow + direnv exec . stack run --nix --no-nix-pure -- \ --print \ --fixed-root "$TEST_ROOT" \ --markdown-summary "$GITHUB_STEP_SUMMARY" \ diff --git a/tests/app/Spec/Tests.hs b/tests/app/Spec/Tests.hs index d2c3873f..c0fec56c 100644 --- a/tests/app/Spec/Tests.hs +++ b/tests/app/Spec/Tests.hs @@ -5,7 +5,6 @@ module Spec.Tests where -import Control.Concurrent.QSem import Control.Monad import Control.Monad.Catch import Control.Monad.IO.Class @@ -28,13 +27,11 @@ tests = introduceJupyterRunner $ introduceJustBubblewrap $ introduceBootstrapNixpkgs $ - introduce' (defaultNodeOptions { nodeOptionsCreateFolder = False }) "Introduce parallel semaphore" parallelSemaphore getQSem (const $ return ()) $ + withParallelLanesFromArgs getParallelism $ $(getSpecFromFolder $ defaultGetSpecFromFolderOptions { getSpecCombiner = 'describeParallel - , getSpecIndividualSpecHooks = 'withParallelSemaphore + , getSpecIndividualSpecHooks = 'takeParallelLane }) - where - getQSem = getCommandLineOptions >>= liftIO . newQSem . getParallelism -- * Parallelism stuff @@ -43,7 +40,7 @@ getParallelism :: CommandLineOptions SpecialOptions -> Int getParallelism = optTestParallelism . optUserOptions describeParallel :: ( - MonadBaseControl IO m, MonadIO m, MonadMask m, HasParallelSemaphore context + MonadBaseControl IO m, MonadIO m, MonadMask m ) => String -> SpecFree context m () -> SpecFree context m () describeParallel s = (describe' (defaultNodeOptions { nodeOptionsRecordTime = False , nodeOptionsVisibilityThreshold = 50 })) s @@ -51,11 +48,4 @@ describeParallel s = (describe' (defaultNodeOptions { nodeOptionsRecordTime = Fa , nodeOptionsVisibilityThreshold = 125 , nodeOptionsCreateFolder = False })) -withParallelSemaphore :: forall context m. ( - MonadBaseControl IO m, MonadIO m, MonadMask m, HasParallelSemaphore context - ) => FilePath -> SpecFree context m () -> SpecFree context m () -withParallelSemaphore _ = around' (defaultNodeOptions { nodeOptionsRecordTime = False - , nodeOptionsVisibilityThreshold = 125 - , nodeOptionsCreateFolder = False }) "claim semaphore" $ \action -> do - s <- getContext parallelSemaphore - bracket_ (liftIO $ waitQSem s) (liftIO $ signalQSem s) (void action) + diff --git a/tests/src/TestLib/TH.hs b/tests/src/TestLib/TH.hs index 7eb862f3..ff96eeb7 100644 --- a/tests/src/TestLib/TH.hs +++ b/tests/src/TestLib/TH.hs @@ -11,8 +11,10 @@ import UnliftIO.Exception findGitRoot :: FilePath -> IO (Maybe FilePath) findGitRoot dir = do - let gitDir = dir ".git" - doesDirectoryExist gitDir >>= \case + let gitPath = dir ".git" + -- In a worktree or submodule checkout, .git is a file pointing at the real gitdir. + isRoot <- (||) <$> doesDirectoryExist gitPath <*> doesFileExist gitPath + case isRoot of True -> return (Just dir) False -> do let parent = takeDirectory dir diff --git a/tests/stack.yaml b/tests/stack.yaml index c5a6f5b5..a3f5de3d 100644 --- a/tests/stack.yaml +++ b/tests/stack.yaml @@ -11,6 +11,13 @@ nix: system-ghc: true extra-deps: +- git: https://github.com/codedownio/sandwich.git + # master branch + commit: 71f7ac9754fe6bf6a6856cb0b774c356bb8ed02d + subdirs: + - sandwich + - sandwich-contexts + - git: https://github.com/codedownio/lsp.git # upgrade-monads-newest-jan2026 branch commit: c723f4a4fb99661c76b1356f8a839a0e266b0f32 diff --git a/tests/stack.yaml.lock b/tests/stack.yaml.lock index ad241700..656fa660 100644 --- a/tests/stack.yaml.lock +++ b/tests/stack.yaml.lock @@ -4,6 +4,32 @@ # https://docs.haskellstack.org/en/stable/topics/lock_files packages: +- completed: + commit: 71f7ac9754fe6bf6a6856cb0b774c356bb8ed02d + git: https://github.com/codedownio/sandwich.git + name: sandwich + pantry-tree: + sha256: a025fad1cfe3429e13a06e040846e9c0baee29178750ac2e9911542e83ae315d + size: 7057 + subdir: sandwich + version: 0.3.1.0 + original: + commit: 71f7ac9754fe6bf6a6856cb0b774c356bb8ed02d + git: https://github.com/codedownio/sandwich.git + subdir: sandwich +- completed: + commit: 71f7ac9754fe6bf6a6856cb0b774c356bb8ed02d + git: https://github.com/codedownio/sandwich.git + name: sandwich-contexts + pantry-tree: + sha256: 40d6a71d61001e81690af04a504a69e4be0a328f413ac239a8c1f3ed19a3bfae + size: 1849 + subdir: sandwich-contexts + version: 0.3.0.4 + original: + commit: 71f7ac9754fe6bf6a6856cb0b774c356bb8ed02d + git: https://github.com/codedownio/sandwich.git + subdir: sandwich-contexts - completed: commit: c723f4a4fb99661c76b1356f8a839a0e266b0f32 git: https://github.com/codedownio/lsp.git