Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! [#164] Add workflow for running Windows t…
Browse files Browse the repository at this point in the history
…ests on CI
  • Loading branch information
Sorokin-Anton committed Oct 11, 2022
1 parent c40dae8 commit 1f0399c
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

name: CI

on: [pull_request, push]
on: [push]

jobs:
xrefcheck-build-and-test:
Expand Down Expand Up @@ -58,7 +58,6 @@ jobs:
stack --system-ghc exec -- pacman --noconfirm -Syuu;
stack --system-ghc exec -- pacman -S --needed --noconfirm mingw-w64-x86_64-pcre;
stack --system-ghc exec -- pacman -S --needed --noconfirm pcre-devel;
stack --system-ghc install regex-pcre
- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion src/Xrefcheck/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Data.Map qualified as M
import Data.Reflection (Given)
import Data.Text qualified as T
import Fmt (Buildable (..), blockListF, blockListF', nameF, (+|), (|+))
import System.FilePath (isPathSeparator)
import System.FilePath.Posix (isPathSeparator)
import Time (Second, Time)

import Data.DList (DList)
Expand Down
9 changes: 6 additions & 3 deletions src/Xrefcheck/Scan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import Data.Reflection (Given)
import Fmt (Buildable (..), nameF, (+|), (|+))
import System.Directory (doesDirectoryExist)
import System.Directory.Tree qualified as Tree
import System.FilePath (dropTrailingPathSeparator, equalFilePath, takeDirectory, takeExtension)
import qualified System.FilePath as OsDependentFilePath
import System.FilePath.Posix (dropTrailingPathSeparator, equalFilePath, takeDirectory, takeExtension)

import Xrefcheck.Core
import Xrefcheck.Progress
Expand Down Expand Up @@ -100,15 +101,17 @@ scanRepo rw formatsSupport config root = do

_ Tree.:/ repoTree <- liftIO $ Tree.readDirectoryWithL processFile root
let (errs, fileInfos) = gatherScanErrs &&& gatherFileInfos
$ dropSndMaybes . F.toList
$ map (first useLinuxPathSep) . dropSndMaybes . F.toList
$ Tree.zipPaths $ location Tree.:/ repoTree
return . ScanResult errs $ RepoInfo (M.fromList fileInfos)
where
isDirectory = readingSystem . doesDirectoryExist
gatherScanErrs = foldMap (snd . snd)
gatherFileInfos = map (bimap normaliseWithNoTrailing fst)
useLinuxPathSep | OsDependentFilePath.pathSeparator == '/' = id
| otherwise = intercalate "/" . OsDependentFilePath.splitDirectories

processFile file = do
processFile (useLinuxPathSep -> file) = do
let ext = takeExtension file
let mscanner = formatsSupport ext
if isIgnored file
Expand Down
2 changes: 1 addition & 1 deletion src/Xrefcheck/System.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Data.Coerce (coerce)
import GHC.IO.Unsafe (unsafePerformIO)
import System.Directory (canonicalizePath)
import System.Environment (lookupEnv)
import System.FilePath ((</>))
import System.FilePath.Posix ((</>))
import System.FilePath.Glob qualified as Glob
import Xrefcheck.Util (normaliseWithNoTrailing)

Expand Down
2 changes: 1 addition & 1 deletion src/Xrefcheck/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Data.Time (UTCTime)
import Data.Time.Clock (nominalDiffTimeToSeconds)
import Data.Time.Clock.POSIX (POSIXTime, utcTimeToPOSIXSeconds)
import Fmt (Builder)
import System.FilePath (dropTrailingPathSeparator, normalise)
import System.FilePath.Posix (dropTrailingPathSeparator, normalise)
import Time (Second, Time (..), sec)

import Xrefcheck.Util.Colorize
Expand Down
2 changes: 1 addition & 1 deletion src/Xrefcheck/Verify.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import Network.HTTP.Req
import Network.HTTP.Types.Header (hRetryAfter)
import Network.HTTP.Types.Status (Status, statusCode, statusMessage)
import System.Directory (doesDirectoryExist, doesFileExist)
import System.FilePath (makeRelative, normalise, splitDirectories, takeDirectory, (</>))
import System.FilePath.Posix (makeRelative, normalise, splitDirectories, takeDirectory, (</>))
import Text.ParserCombinators.ReadPrec qualified as ReadPrec (lift)
import Text.Regex.TDFA.Text (Regex, regexec)
import Text.URI (Authority (..), ParseExceptionBs, URI (..), mkURIBs)
Expand Down
2 changes: 1 addition & 1 deletion tests/golden/check-ignoreRefs/check-ignoreRefs.bats
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ load '../helpers'
-c config-check-enabled.yaml \
-r .

assert_diff expected.gold
assert_diff expected_linux.gold || assert_diff expected_windows.gold
}

@test "Ignore localhost, no config specified" {
Expand Down
File renamed without changes.
43 changes: 43 additions & 0 deletions tests/golden/check-ignoreRefs/expected_windows.gold
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
=== Invalid references found ===

➥ In file check-ignoreRefs.md
bad reference (external) at src:7:10-53:
- text: "web-site"
- link: https://localhost:20000/web-site
- anchor: -

⛂ InternalException (HostCannotConnect "localhost" [Network.Socket.connect: <socket: N>: failed (Connection refused (WSAECONNREFUSED)),Network.Socket.connect: <socket: N>: failed (Connection refused (WSAECONNREFUSED))])



➥ In file check-ignoreRefs.md
bad reference (external) at src:9:10-45:
- text: "team"
- link: https://127.0.0.1:20000/team
- anchor: -

⛂ InternalException (HostCannotConnect "127.0.0.1" [Network.Socket.connect: <socket: N>: failed (Connection refused (WSAECONNREFUSED))])



➥ In file check-ignoreRefs.md
bad reference (external) at src:11:10-44:
- text: "blog"
- link: http://localhost:20000/blog
- anchor: -

⛂ ConnectionFailure Network.Socket.connect: <socket: N>: failed (Connection refused (WSAECONNREFUSED))



➥ In file check-ignoreRefs.md
bad reference (external) at src:13:10-44:
- text: "labs"
- link: http://127.0.0.1:20000/labs
- anchor: -

⛂ ConnectionFailure Network.Socket.connect: <socket: N>: failed (Connection refused (WSAECONNREFUSED))



Invalid references dumped, 4 in total.

0 comments on commit 1f0399c

Please sign in to comment.