Skip to content

Commit f5371bc

Browse files
committed
Overwrite test root dir on windows CI job
Adds support for the `HLS_TEST_ROOTDIR` which allows to overwrite the location for the test case artifacts.
1 parent 6024f5a commit f5371bc

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

.github/actions/setup-build/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ runs:
4444
echo "CABAL_PKGS_DIR=C:\\cabal\\packages" >> $GITHUB_ENV
4545
shell: bash
4646

47+
- if: inputs.os == 'Windows'
48+
name: (Windows) Platform config (root test directory)
49+
run: |
50+
mkdir C:\\hls-tests
51+
echo "HLS_TEST_ROOTDIR=C:\\hls-tests" >> $GITHUB_ENV
52+
shell: bash
53+
4754
- if: ( inputs.os == 'Linux' ) || ( inputs.os == 'macOS' )
4855
name: (Linux,macOS) Platform config
4956
run: |

hls-test-utils/src/Test/Hls.hs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,16 @@ instance Default (TestConfig b) where
608608
-- However, it is totally safe to delete the directory between runs.
609609
setupTestEnvironment :: IO FilePath
610610
setupTestEnvironment = do
611-
tmpDirRoot <- getTemporaryDirectory
612-
let testRoot = tmpDirRoot </> "hls-tests"
613-
createDirectoryIfMissing True testRoot
614-
pure testRoot
611+
mRootDir <- lookupEnv "HLS_TEST_ROOTDIR"
612+
case mRootDir of
613+
Nothing -> do
614+
tmpDirRoot <- getTemporaryDirectory
615+
let testRoot = tmpDirRoot </> "hls-tests"
616+
createDirectoryIfMissing True testRoot
617+
pure testRoot
618+
Just rootDir -> do
619+
createDirectoryIfMissing True rootDir
620+
pure rootDir
615621

616622
goldenWithHaskellDocFormatter
617623
:: Pretty b

0 commit comments

Comments
 (0)