Fix build cache issues (#192)

This commit is contained in:
Sebastián Estrella 2022-04-25 21:48:34 -05:00 committed by GitHub
parent c377835763
commit 00f285010b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 20 deletions

View File

@ -2,6 +2,7 @@
# - https://github.com/actions/cache/blob/main/examples.md#haskell---cabal # - https://github.com/actions/cache/blob/main/examples.md#haskell---cabal
# - https://github.com/haskell/time/blob/master/.github/workflows/ci.yml # - https://github.com/haskell/time/blob/master/.github/workflows/ci.yml
# - https://github.com/stackbuilders/stache/blob/master/.github/workflows/ci.yaml # - https://github.com/stackbuilders/stache/blob/master/.github/workflows/ci.yaml
# - https://markkarpov.com/post/github-actions-for-haskell-ci.html
--- ---
name: CI name: CI
@ -25,34 +26,28 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: haskell/actions/setup@v1 - if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install zsh
- if: ${{ runner.os == 'macOS' }}
run: |
brew update
brew install zsh
- uses: haskell/actions/setup@v2
with: with:
ghc-version: ${{ matrix.ghc }} ghc-version: ${{ matrix.ghc }}
cabal-version: "3.6" cabal-version: "3.6"
- run: | id: setup-haskell
if [ "$RUNNER_OS" == "Linux" ]
then
sudo apt-get update
sudo apt-get install zsh
else
brew update
brew install zsh
fi
- run: cabal update
- run: cabal configure --enable-tests - run: cabal configure --enable-tests
- run: cabal freeze - run: cabal freeze
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('*.cabal', 'cabal.project.freeze') }} key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
path: | path: |
~/.cabal/packages ${{ steps.setup-haskell.outputs.cabal-store }}
~/.cabal/store
dist-newstyle dist-newstyle
- run: cabal build --only-dependencies restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
- run: cabal build - run: cabal build
- run: cabal test - run: cabal test
- run: | - run: ./script/haddock
# Fixes issue with different haddock coverage with different ghc versions https://github.com/haskell/haddock/issues/123
cabal haddock | grep "100%" | wc -l | grep -E "[4-9]|[1-9][0-9]+" ||
(echo "Haddock failed with exit code 1. Have you checked that the minimum of 4 modules with 100% documentation is fulfilled?" && false)

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ cabal-dev
*.dyn_o *.dyn_o
*.dyn_hi *.dyn_hi
.cabal-sandbox/ .cabal-sandbox/
.envrc
.hpc .hpc
.hsenv .hsenv
.tool-versions .tool-versions

13
script/haddock Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
min_count=4
count=$(cabal haddock | grep "100%" | wc -l)
if [ "$count" -le "$min_count" ];
then
echo "Haddock failed with exit code 1. Have you checked that the minimum of ${min_count} modules with 100% documentation is fulfilled?"
exit 1
fi