Skip to content

Commit

Permalink
Allow more ghc versions in CI (#330)
Browse files Browse the repository at this point in the history
* Allow more ghc versions in CI

* Is ghc 8.10.7 on the path?

* Refactor tests handle missing tool dependencies

* Make CI run all tests regardless of the installed tool

* Splitup test runners

* Always show test-details when running tests in CI

* Split cabal tests into bios, direct and cabal tests
  • Loading branch information
fendor authored Feb 22, 2022
1 parent 1fdec5e commit 460a92e
Show file tree
Hide file tree
Showing 7 changed files with 263 additions and 99 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,23 @@ jobs:

steps:
- uses: actions/checkout@v2
- id: extra-ghc
uses: haskell/actions/setup@v1
with:
ghc-version: '8.10.7'

- uses: haskell/actions/setup@v1
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.6'
enable-stack: true

- name: Print extra ghc version
run: ghc-8.10.7 --version

- name: Print normal ghc version
run: ghc --version

- name: Cache Cabal
uses: actions/[email protected]
with:
Expand All @@ -38,8 +49,11 @@ jobs:
- run: cabal update
- name: Build
run: cabal build
- name: Test
run: cabal test
- name: Test Parser
run: cabal test parser-tests --test-show-details=direct
- name: Test Bios
# Run all tests in the project
run: cabal test bios-tests --test-show-details=direct --test-options="--ignore-tool-deps"

sdist:
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions hie-bios.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Extra-Source-Files: ChangeLog.md
wrappers/cabal
wrappers/cabal.hs
tests/configs/*.yaml
tests/projects/cabal-with-ghc/cabal-with-ghc.cabal
tests/projects/cabal-with-ghc/cabal.project
tests/projects/cabal-with-ghc/hie.yaml
tests/projects/cabal-with-ghc/src/MyLib.hs
tests/projects/symlink-test/a/A.hs
tests/projects/symlink-test/hie.yaml
tests/projects/deps-bios-new/A.hs
Expand Down Expand Up @@ -217,6 +221,7 @@ test-suite bios-tests
filepath,
directory,
temporary,
tagged,
ghc

hs-source-dirs: tests/
Expand Down
312 changes: 215 additions & 97 deletions tests/BiosTests.hs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions tests/projects/cabal-with-ghc/cabal-with-ghc.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cabal-version: 2.4
name: cabal-with-ghc
version: 0.1.0.0

library
exposed-modules: MyLib
build-depends: base
hs-source-dirs: src
default-language: Haskell2010
12 changes: 12 additions & 0 deletions tests/projects/cabal-with-ghc/cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
packages: .

-- It is intended that this ghc version is different to at least one ghc version
-- that is tested in CI.
--
-- Project validates that hie-bios honours this field.
--
-- If you change this, make sure to also change the 'extraGhc' constant in
-- 'tests/BiosTests.hs'.
--
-- Additionally, CI needs a proper setup to execute this test-case.
with-compiler: ghc-8.10.7
2 changes: 2 additions & 0 deletions tests/projects/cabal-with-ghc/hie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cradle:
cabal:
4 changes: 4 additions & 0 deletions tests/projects/cabal-with-ghc/src/MyLib.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module MyLib (someFunc) where

someFunc :: IO ()
someFunc = putStrLn "someFunc"

0 comments on commit 460a92e

Please sign in to comment.