Skip to content

Commit 1f0399c

Browse files
committed
fixup! fixup! fixup! fixup! [#164] Add workflow for running Windows tests on CI
1 parent c40dae8 commit 1f0399c

File tree

9 files changed

+55
-10
lines changed

9 files changed

+55
-10
lines changed

.github/workflows/ci.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
name: CI
1212

13-
on: [pull_request, push]
13+
on: [push]
1414

1515
jobs:
1616
xrefcheck-build-and-test:
@@ -58,7 +58,6 @@ jobs:
5858
stack --system-ghc exec -- pacman --noconfirm -Syuu;
5959
stack --system-ghc exec -- pacman -S --needed --noconfirm mingw-w64-x86_64-pcre;
6060
stack --system-ghc exec -- pacman -S --needed --noconfirm pcre-devel;
61-
stack --system-ghc install regex-pcre
6261
6362
- name: Build
6463
run: |

src/Xrefcheck/Core.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Data.Map qualified as M
2121
import Data.Reflection (Given)
2222
import Data.Text qualified as T
2323
import Fmt (Buildable (..), blockListF, blockListF', nameF, (+|), (|+))
24-
import System.FilePath (isPathSeparator)
24+
import System.FilePath.Posix (isPathSeparator)
2525
import Time (Second, Time)
2626

2727
import Data.DList (DList)

src/Xrefcheck/Scan.hs

+6-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ import Data.Reflection (Given)
2929
import Fmt (Buildable (..), nameF, (+|), (|+))
3030
import System.Directory (doesDirectoryExist)
3131
import System.Directory.Tree qualified as Tree
32-
import System.FilePath (dropTrailingPathSeparator, equalFilePath, takeDirectory, takeExtension)
32+
import qualified System.FilePath as OsDependentFilePath
33+
import System.FilePath.Posix (dropTrailingPathSeparator, equalFilePath, takeDirectory, takeExtension)
3334

3435
import Xrefcheck.Core
3536
import Xrefcheck.Progress
@@ -100,15 +101,17 @@ scanRepo rw formatsSupport config root = do
100101

101102
_ Tree.:/ repoTree <- liftIO $ Tree.readDirectoryWithL processFile root
102103
let (errs, fileInfos) = gatherScanErrs &&& gatherFileInfos
103-
$ dropSndMaybes . F.toList
104+
$ map (first useLinuxPathSep) . dropSndMaybes . F.toList
104105
$ Tree.zipPaths $ location Tree.:/ repoTree
105106
return . ScanResult errs $ RepoInfo (M.fromList fileInfos)
106107
where
107108
isDirectory = readingSystem . doesDirectoryExist
108109
gatherScanErrs = foldMap (snd . snd)
109110
gatherFileInfos = map (bimap normaliseWithNoTrailing fst)
111+
useLinuxPathSep | OsDependentFilePath.pathSeparator == '/' = id
112+
| otherwise = intercalate "/" . OsDependentFilePath.splitDirectories
110113

111-
processFile file = do
114+
processFile (useLinuxPathSep -> file) = do
112115
let ext = takeExtension file
113116
let mscanner = formatsSupport ext
114117
if isIgnored file

src/Xrefcheck/System.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Data.Coerce (coerce)
2020
import GHC.IO.Unsafe (unsafePerformIO)
2121
import System.Directory (canonicalizePath)
2222
import System.Environment (lookupEnv)
23-
import System.FilePath ((</>))
23+
import System.FilePath.Posix ((</>))
2424
import System.FilePath.Glob qualified as Glob
2525
import Xrefcheck.Util (normaliseWithNoTrailing)
2626

src/Xrefcheck/Util.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import Data.Time (UTCTime)
2626
import Data.Time.Clock (nominalDiffTimeToSeconds)
2727
import Data.Time.Clock.POSIX (POSIXTime, utcTimeToPOSIXSeconds)
2828
import Fmt (Builder)
29-
import System.FilePath (dropTrailingPathSeparator, normalise)
29+
import System.FilePath.Posix (dropTrailingPathSeparator, normalise)
3030
import Time (Second, Time (..), sec)
3131

3232
import Xrefcheck.Util.Colorize

src/Xrefcheck/Verify.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import Network.HTTP.Req
5858
import Network.HTTP.Types.Header (hRetryAfter)
5959
import Network.HTTP.Types.Status (Status, statusCode, statusMessage)
6060
import System.Directory (doesDirectoryExist, doesFileExist)
61-
import System.FilePath (makeRelative, normalise, splitDirectories, takeDirectory, (</>))
61+
import System.FilePath.Posix (makeRelative, normalise, splitDirectories, takeDirectory, (</>))
6262
import Text.ParserCombinators.ReadPrec qualified as ReadPrec (lift)
6363
import Text.Regex.TDFA.Text (Regex, regexec)
6464
import Text.URI (Authority (..), ParseExceptionBs, URI (..), mkURIBs)

tests/golden/check-ignoreRefs/check-ignoreRefs.bats

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ load '../helpers'
2222
-c config-check-enabled.yaml \
2323
-r .
2424

25-
assert_diff expected.gold
25+
assert_diff expected_linux.gold || assert_diff expected_windows.gold
2626
}
2727

2828
@test "Ignore localhost, no config specified" {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
=== Invalid references found ===
2+
3+
➥ In file check-ignoreRefs.md
4+
bad reference (external) at src:7:10-53:
5+
- text: "web-site"
6+
- link: https://localhost:20000/web-site
7+
- anchor: -
8+
9+
⛂ InternalException (HostCannotConnect "localhost" [Network.Socket.connect: <socket: N>: failed (Connection refused (WSAECONNREFUSED)),Network.Socket.connect: <socket: N>: failed (Connection refused (WSAECONNREFUSED))])
10+
11+
12+
13+
➥ In file check-ignoreRefs.md
14+
bad reference (external) at src:9:10-45:
15+
- text: "team"
16+
- link: https://127.0.0.1:20000/team
17+
- anchor: -
18+
19+
⛂ InternalException (HostCannotConnect "127.0.0.1" [Network.Socket.connect: <socket: N>: failed (Connection refused (WSAECONNREFUSED))])
20+
21+
22+
23+
➥ In file check-ignoreRefs.md
24+
bad reference (external) at src:11:10-44:
25+
- text: "blog"
26+
- link: http://localhost:20000/blog
27+
- anchor: -
28+
29+
⛂ ConnectionFailure Network.Socket.connect: <socket: N>: failed (Connection refused (WSAECONNREFUSED))
30+
31+
32+
33+
➥ In file check-ignoreRefs.md
34+
bad reference (external) at src:13:10-44:
35+
- text: "labs"
36+
- link: http://127.0.0.1:20000/labs
37+
- anchor: -
38+
39+
⛂ ConnectionFailure Network.Socket.connect: <socket: N>: failed (Connection refused (WSAECONNREFUSED))
40+
41+
42+
43+
Invalid references dumped, 4 in total.

0 commit comments

Comments
 (0)