From 480faa92ae9225c23e79156bb2390eb078828e0e Mon Sep 17 00:00:00 2001 From: Anton Sorokin Date: Wed, 5 Oct 2022 22:28:27 +0300 Subject: [PATCH] [#164] Add workflow for running Windows tests on CI Problem: we are not testing behavior of xrefcheck on Windows Solution: test locally and add workflow to run golden and tasty tests on CI via github-actions windows runner --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++++++++++++++++ src/Xrefcheck/Core.hs | 4 +-- 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..152d19f2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +# SPDX-FileCopyrightText: 2020 Kowainik +# SPDX-FileCopyrightText: 2022 Serokell +# +# SPDX-License-Identifier: MPL-2.0 + +# Sources: +# • https://github.com/kowainik/validation-selective/blob/5b46cd4810bbaa09b704062ebbfa2bb47137425d/.github/workflows/ci.yml +# • https://kodimensional.dev/github-actions +# • https://github.com/serokell/tztime/blob/336f585c2c7125a8ba58ffbf3dbea4f36a7c40e7/.github/workflows/ci.yml + +name: CI + +on: [pull_request, push] + +jobs: + xrefcheck-build-and-test: + runs-on: windows-latest + strategy: + matrix: + stack: ["2.7.5"] + ghc: ["9.0.2"] + include: + - ghc: "9.0.2" + stackyaml: stack.yaml + steps: + - uses: actions/checkout@v2 + + - uses: haskell/actions/setup@v1.2 + name: Setup Haskell Stack + with: + ghc-version: ${{ matrix.ghc }} + stack-version: ${{ matrix.stack }} + + - uses: actions/cache@v3 + name: Cache ~/.stack + with: + path: ~/.stack + key: ${{ runner.os }}-${{ matrix.ghc }}-stack + + - name: install pacman dependencies + run: + stack --system-ghc exec -- pacman -S pkgconf; + stack --system-ghc exec -- pacman -S mingw-w64-x86_64-pcre + + + - name: Build + run: | + stack build --system-ghc --stack-yaml ${{ matrix.stackyaml }} --test --bench --no-run-tests --no-run-benchmarks --ghc-options '-Werror' --haddock --no-haddock-deps + + - name: stack test xrefcheck:xrefcheck-tests + run: | + stack test --system-ghc --stack-yaml ${{ matrix.stackyaml }} + xrefcheck:xrefcheck-tests + + - uses: mig4/setup-bats@v1 + name: Setup bats + + - name: Golden tests + run: bats ./tests/golden/** diff --git a/src/Xrefcheck/Core.hs b/src/Xrefcheck/Core.hs index b4410862..185564ff 100644 --- a/src/Xrefcheck/Core.hs +++ b/src/Xrefcheck/Core.hs @@ -21,7 +21,7 @@ import Data.Map qualified as M import Data.Text qualified as T import Fmt (Buildable (..), blockListF, blockListF', nameF, (+|), (|+)) import System.Console.Pretty (Color (..), Style (..), color, style) -import System.FilePath (isPathSeparator, pathSeparator) +import System.FilePath (isPathSeparator) import Text.Numeral.Roman (toRoman) import Time (Second, Time) @@ -295,7 +295,7 @@ canonizeLocalRef :: Text -> Text canonizeLocalRef ref = maybe ref canonizeLocalRef (T.stripPrefix localPrefix ref) where - localPrefix = toText ['.', pathSeparator] + localPrefix = "./" ----------------------------------------------------------- -- Visualisation