diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f8e0888..3130af5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,10 @@ # Builds and tests this Haskell project on "GitHub Actions" # -# 2021 Rudy Matela +# 2021-2023 Rudy Matela # # some docs: https://github.com/haskell/actions/tree/main/setup +# +# The official haskell docker image: https://hub.docker.com/_/haskell name: build on: [push] jobs: @@ -11,24 +13,26 @@ jobs: steps: - name: Cache ~/.cabal/packages - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cabal/packages - key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('hello.cabal') }} + key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }} restore-keys: v1-${{ runner.os }}-cabal-packages- - name: Cache ~/.cabal and ~/.ghc - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.cabal !~/.cabal/packages ~/.ghc - key: v1-${{ runner.os }}-cabal-ghc-latest-${{ hashFiles('hello.cabal') }} + key: v1-${{ runner.os }}-cabal-ghc-latest-${{ hashFiles('*.cabal') }} restore-keys: v1-${{ runner.os }}-cabal-ghc-latest- - run: du -hd3 ~/.cabal ~/.ghc || true + - run: make --version + - run: haddock --version || sudo apt-get install ghc-haddock - run: ghc --version - run: cabal --version @@ -36,50 +40,54 @@ jobs: - run: ghc-pkg list - name: Check out repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 + + - run: git --version - - run: cabal update - run: make install-dependencies - - run: make - - run: make test - - run: make haddock + # 2023-07: some projects were failing with missing base for GHC 9.6. + # Here we compile through cabal only provisionally. + # - run: make + # - run: make test + # - run: make haddock - run: make test-sdist - - run: make test-via-cabal + #- run: make test-via-cabal + - run: cabal configure --enable-tests --enable-benchmarks --ghc-options="-O0" + - run: cabal build + - run: cabal test + - run: cabal haddock test-with-ghc: strategy: matrix: ghc: + - '9.4' + - '9.2' - '9.0' - '8.10' - - '8.8' - '8.6' - - '8.4' - '8.2' - - '8.0' - - '7.10' - - '7.8' runs-on: ubuntu-latest needs: build-and-test container: haskell:${{ matrix.ghc }} steps: - name: Cache ~/.cabal/packages - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cabal/packages - key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('hello.cabal') }} + key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }} restore-keys: v1-${{ runner.os }}-cabal-packages- - name: Cache ~/.cabal and ~/.ghc - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.cabal !~/.cabal/packages ~/.ghc - key: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-${{ hashFiles('hello.cabal') }} + key: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-${{ hashFiles('*.cabal') }} restore-keys: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}- - run: du -hd3 ~/.cabal ~/.ghc || true @@ -94,9 +102,8 @@ jobs: - run: ghc-pkg list - name: Check out repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - - run: cabal update - run: make install-dependencies - run: make @@ -110,12 +117,12 @@ jobs: needs: build-and-test steps: - name: Setup Haskell's GHC and Cabal as required by current Stackage LTS - uses: haskell/actions/setup@v1 + uses: haskell/actions/setup@v2 with: # lts-19.19 ghc-version: '9.0.2' cabal-version: '3.4' - - uses: actions/cache@v2 + - uses: actions/cache@v3 with: path: ~/.stack key: v1-${{ runner.os }}-stack-${{ hashFiles('stack.yaml') }} @@ -124,5 +131,5 @@ jobs: - run: stack --version - name: Check out repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - run: make test-via-stack diff --git a/mk/haskell.mk b/mk/haskell.mk index d432cb8..27e2966 100644 --- a/mk/haskell.mk +++ b/mk/haskell.mk @@ -1,6 +1,6 @@ # Implicit rules for compiling Haskell code. # -# Copyright (c) 2015-2021 Rudy Matela. +# Copyright (c) 2015-2023 Rudy Matela. # Distributed under the 3-Clause BSD licence. # # You can optionally configure the "Configuration variables" below in your main @@ -21,7 +21,7 @@ GHCFLAGS ?= GHC ?= ghc GHCCMD = $(GHC) -i$(GHCIMPORTDIRS) $(GHCFLAGS) HADDOCK ?= haddock -CABAL_INSTALL = $(shell cabal --version | grep -q "version [0-2]\." && echo 'cabal install' || echo 'cabal v1-install') +CABAL_INSTALL = $(shell cabal --version | grep -q "version [0-2]\." && echo 'cabal install' || echo 'cabal install --lib') # Hugs Parameters HUGSIMPORTDIRS ?= "/usr/lib/hugs/packages/*" @@ -90,7 +90,10 @@ depend: find $(ALL_HSS) | ./mk/ghcdeps -i$(GHCIMPORTDIRS) $(GHCFLAGS) > $(DEPMK) install-dependencies: - $(CABAL_INSTALL) $(INSTALL_DEPS) + if [ -n "$(INSTALL_DEPS)" ]; then \ + cabal update && \ + $(CABAL_INSTALL) $(INSTALL_DEPS); \ + fi # haddock rules haddock: doc/index.html diff --git a/test-framework-leancheck.cabal b/test-framework-leancheck.cabal index de1d9cc..400bbf7 100644 --- a/test-framework-leancheck.cabal +++ b/test-framework-leancheck.cabal @@ -34,15 +34,12 @@ extra-source-files: .gitignore , stack.yaml , test/sdist , .github/workflows/build.yml -tested-with: GHC==9.0 +tested-with: GHC==9.4 + , GHC==9.2 + , GHC==9.0 , GHC==8.10 - , GHC==8.8 , GHC==8.6 - , GHC==8.4 , GHC==8.2 - , GHC==8.0 - , GHC==7.10 - , GHC==7.8 source-repository head diff --git a/test/sdist b/test/sdist index 49435f1..645ac08 100755 --- a/test/sdist +++ b/test/sdist @@ -2,7 +2,7 @@ # # test/sdist: tests the package generated by "cabal sdist". # -# Copyright (c) 2015-2021 Rudy Matela. +# Copyright (c) 2015-2023 Rudy Matela. # Distributed under the 3-Clause BSD licence. set -xe @@ -29,7 +29,11 @@ tar -tf $pkg | sort --ignore-case > $tmp/ls-cabal-i tar -tf $pkg | sort --ignore-case --unique > $tmp/ls-cabal-iu diff -rud $tmp/ls-cabal-i $tmp/ls-cabal-iu -if [ -d .git ] +# Check if we have a clone of the repo and git is available +# The check that we can run git ls-files is needed to avoid: +# fatal: detected dubious ownership in repository at '/__w/.../hello-haskell' +# on CI. +if [ -d .git ] && git --version && git ls-files >/dev/null then # Test if files included by cabal are the same as files tracked in git. git ls-files | sort > $tmp/ls-git