diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3130af5..8557f89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,8 @@ # Builds and tests this Haskell project on "GitHub Actions" # -# 2021-2023 Rudy Matela +# 2021-2024 Rudy Matela # -# some docs: https://github.com/haskell/actions/tree/main/setup +# some docs: https://github.com/haskell-actions/setup # # The official haskell docker image: https://hub.docker.com/_/haskell name: build @@ -11,58 +11,66 @@ jobs: build-and-test: runs-on: ubuntu-latest steps: + - run: git --version + - run: make --version + - run: ghc --version + - run: cabal --version - - name: Cache ~/.cabal/packages + - name: Check out repository + uses: actions/checkout@v3 + + # check out needs to happen before cache so that hashing works + - name: Cache hash + run: echo Cache hash = ${{ hashFiles('*.cabal') }} + + - name: Cache cabal (source) packages uses: actions/cache@v3 with: - path: ~/.cabal/packages + path: | + ~/.cabal/packages + ~/.cache/cabal key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }} restore-keys: v1-${{ runner.os }}-cabal-packages- - - name: Cache ~/.cabal and ~/.ghc + - name: Cache installed cabal packages uses: actions/cache@v3 with: path: | ~/.cabal !~/.cabal/packages + ~/.config/cabal + ~/.local/state/cabal ~/.ghc 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 + restore-keys: v1-${{ runner.os }}-cabal-ghc-latest-${{ hashFiles('*.cabal') }} + # restore with exact match has some versions of cabal have trouble updating - run: haddock --version || sudo apt-get install ghc-haddock - - run: ghc --version - - run: cabal --version - - run: haddock --version - - run: ghc-pkg list - - - name: Check out repository - uses: actions/checkout@v3 + # blank line + # blank line for alignment with matrix scripts - - run: git --version + - run: du -hd3 ~/.ghc ~/.cabal ~/.config/cabal ~/.cache/cabal ~/.local/state/cabal || true + - run: ghc-pkg list - run: make install-dependencies + - run: ghc-pkg list + + - run: du -hd3 ~/.ghc ~/.cabal ~/.config/cabal ~/.cache/cabal ~/.local/state/cabal || true - # 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 + - run: make test + - run: make haddock - run: make test-sdist - #- run: make test-via-cabal - - run: cabal configure --enable-tests --enable-benchmarks --ghc-options="-O0" - - run: cabal build - - run: cabal test - - run: cabal haddock + - run: make test-via-cabal test-with-ghc: strategy: + max-parallel: 6 matrix: ghc: + - '9.8' + - '9.6' - '9.4' - '9.2' - '9.0' @@ -73,38 +81,51 @@ jobs: needs: build-and-test container: haskell:${{ matrix.ghc }} steps: - - name: Cache ~/.cabal/packages + - run: git --version || true # git is missing in some images + - run: make --version || true # make is missing in some images + - run: ghc --version + - run: cabal --version + + - name: Check out repository + uses: actions/checkout@v3 + + # check out needs to happen before cache so that hashing works + - name: Cache hash + run: echo Cache hash = ${{ hashFiles('*.cabal') }} + + - name: Cache cabal (source) packages uses: actions/cache@v3 with: - path: ~/.cabal/packages + path: | + ~/.cabal/packages + ~/.cache/cabal key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }} restore-keys: v1-${{ runner.os }}-cabal-packages- - - name: Cache ~/.cabal and ~/.ghc + - name: Cache installed cabal packages uses: actions/cache@v3 with: path: | ~/.cabal !~/.cabal/packages + ~/.config/cabal + ~/.local/state/cabal ~/.ghc 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 + restore-keys: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-${{ hashFiles('*.cabal') }} + # restore with exact match has some versions of cabal have trouble updating - run: make --version || rm /etc/apt/sources.list.d/*.list # faster update - run: make --version || apt-get update - run: make --version || apt-get install make - - run: ghc --version - - run: cabal --version - - run: haddock --version - - run: ghc-pkg list - - - name: Check out repository - uses: actions/checkout@v3 + - run: du -hd3 ~/.ghc ~/.cabal ~/.config/cabal ~/.cache/cabal ~/.local/state/cabal || true + - run: ghc-pkg list - run: make install-dependencies + - run: ghc-pkg list + + - run: du -hd3 ~/.ghc ~/.cabal ~/.config/cabal ~/.cache/cabal ~/.local/state/cabal || true - run: make - run: make test @@ -116,20 +137,41 @@ jobs: runs-on: ubuntu-latest needs: build-and-test steps: - - name: Setup Haskell's GHC and Cabal as required by current Stackage LTS - uses: haskell/actions/setup@v2 - with: # lts-19.19 - ghc-version: '9.0.2' - cabal-version: '3.4' + - name: Check out repository + uses: actions/checkout@v3 + + # check out needs to happen before cache so that hashing works + - name: Cache hash + run: echo Cache hash = ${{ hashFiles('stack.yaml') }} - - uses: actions/cache@v3 + - name: Cache stack folder + uses: actions/cache@v3 with: path: ~/.stack key: v1-${{ runner.os }}-stack-${{ hashFiles('stack.yaml') }} restore-keys: v1-${{ runner.os }}-stack- + - name: Cache ghcup folder + uses: actions/cache@v3 + with: + path: | + ~/.ghcup + /usr/local/.ghcup/bin + /usr/local/.ghcup/db + /usr/local/.ghcup/ghc/9.0.2 + key: v1-${{ runner.os }}-ghcup-${{ hashFiles('stack.yaml') }} + restore-keys: v1-${{ runner.os }}-ghcup- + + - name: Setup Haskell's GHC and Cabal as required by current Stackage LTS + uses: haskell-actions/setup@v2 + with: # lts-19.19 + ghc-version: '9.0.2' + cabal-version: '3.4' + + - run: du -hd2 ~/.stack ~/.ghcup /usr/local/.ghcup || true + - run: stack --version - - name: Check out repository - uses: actions/checkout@v3 - run: make test-via-stack + + - run: du -hd2 ~/.stack ~/.ghcup /usr/local/.ghcup || true diff --git a/fitspec.cabal b/fitspec.cabal index 64a5fde..7dc81f8 100644 --- a/fitspec.cabal +++ b/fitspec.cabal @@ -46,7 +46,9 @@ extra-source-files: .gitignore , mk/install-on , stack.yaml , test/sdist -tested-with: GHC==9.4 +tested-with: GHC==9.8 + , GHC==9.6 + , GHC==9.4 , GHC==9.2 , GHC==9.0 , GHC==8.10 diff --git a/mk/ghcdeps b/mk/ghcdeps index c493f68..35490bf 100755 --- a/mk/ghcdeps +++ b/mk/ghcdeps @@ -2,7 +2,7 @@ # # ghcdeps: generate Haskell make dependencies for compiling with GHC. # -# Copyright (c) 2015-2021 Rudy Matela. +# Copyright (c) 2015-2024 Rudy Matela. # Distributed under the 3-Clause BSD licence. # # From a list of files provided on standard input, diff --git a/mk/haddock-i b/mk/haddock-i index 29d008e..68644a0 100755 --- a/mk/haddock-i +++ b/mk/haddock-i @@ -2,7 +2,7 @@ # # haddock-i: list haddock's -i parameters. # -# Copyright (c) 2015-2021 Rudy Matela. +# Copyright (c) 2015-2024 Rudy Matela. # Distributed under the 3-Clause BSD licence. # # $ haddock-i ... diff --git a/mk/haskell.mk b/mk/haskell.mk index 27e2966..5e78a16 100644 --- a/mk/haskell.mk +++ b/mk/haskell.mk @@ -1,6 +1,6 @@ # Implicit rules for compiling Haskell code. # -# Copyright (c) 2015-2023 Rudy Matela. +# Copyright (c) 2015-2024 Rudy Matela. # Distributed under the 3-Clause BSD licence. # # You can optionally configure the "Configuration variables" below in your main @@ -91,9 +91,14 @@ depend: install-dependencies: if [ -n "$(INSTALL_DEPS)" ]; then \ + cd ~ && \ cabal update && \ - $(CABAL_INSTALL) $(INSTALL_DEPS); \ + $(CABAL_INSTALL) $(INSTALL_DEPS) || true; \ fi + # above, "|| true" is needed for cabal >= 3.10.2 + # Before, cabal would successfully skip installation + # of already existing packages + # cd ~ is needed so cabal installs only dependencies # haddock rules haddock: doc/index.html diff --git a/mk/install-on b/mk/install-on index ae2ed4d..30e2153 100755 --- a/mk/install-on +++ b/mk/install-on @@ -2,7 +2,7 @@ # # mk/install-on: install or updates the mk folder on a Haskell project # -# Copyright (c) 2019-2021 Rudy Matela. +# Copyright (c) 2019-2024 Rudy Matela. # Distributed under the 3-Clause BSD licence. # # usage: ./mk/install-on path/to/project diff --git a/stack.yaml b/stack.yaml index bcb8ff8..bce1ac1 100644 --- a/stack.yaml +++ b/stack.yaml @@ -4,4 +4,4 @@ packages: - . extra-deps: -- leancheck-1.0.0 +- leancheck-1.0.2 diff --git a/test/sdist b/test/sdist index 645ac08..c123192 100755 --- a/test/sdist +++ b/test/sdist @@ -2,7 +2,7 @@ # # test/sdist: tests the package generated by "cabal sdist". # -# Copyright (c) 2015-2023 Rudy Matela. +# Copyright (c) 2015-2024 Rudy Matela. # Distributed under the 3-Clause BSD licence. set -xe