2022-04-01 21:45:11 +03:00
|
|
|
---
|
|
|
|
# The present workflow was made based on the following references:
|
|
|
|
# - https://github.com/actions/cache/blob/main/examples.md#haskell---cabal
|
|
|
|
# - https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md
|
|
|
|
# - https://github.com/haskell/time/blob/master/.github/workflows/ci.yml
|
|
|
|
# - https://github.com/stackbuilders/stache/blob/master/.github/workflows/ci.yaml
|
|
|
|
name: CI
|
|
|
|
|
|
|
|
on: push
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-04-09 18:53:58 +03:00
|
|
|
os:
|
|
|
|
- macos-latest
|
|
|
|
- ubuntu-latest
|
2022-04-01 21:45:11 +03:00
|
|
|
ghc:
|
2022-04-09 18:53:58 +03:00
|
|
|
- "9.0"
|
|
|
|
- "8.10"
|
2022-04-01 21:45:11 +03:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: haskell/actions/setup@v1
|
|
|
|
with:
|
|
|
|
ghc-version: ${{ matrix.ghc }}
|
2022-04-09 18:53:58 +03:00
|
|
|
cabal-version: "3.6"
|
2022-04-01 21:45:11 +03:00
|
|
|
- run: |
|
|
|
|
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 freeze
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
2022-04-09 18:53:58 +03:00
|
|
|
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('*.cabal', 'cabal.project.freeze') }}
|
|
|
|
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
|
2022-04-01 21:45:11 +03:00
|
|
|
path: |
|
|
|
|
~/.cabal/packages
|
|
|
|
~/.cabal/store
|
|
|
|
dist-newstyle
|
|
|
|
- run: cabal build --only-dependencies
|
|
|
|
- run: cabal build
|
|
|
|
- run: cabal test
|
|
|
|
- run: |
|
|
|
|
# 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)
|
|
|
|
|
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: docker/setup-buildx-action@v1
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
key: v1-${{ runner.os }}-buildx-${{ github.sha }}
|
|
|
|
restore-keys: v1-${{ runner.os }}-buildx-
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
- uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
load: true
|
|
|
|
tags: hapistrano:latest
|
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
|
|
|
- run: docker run hapistrano --version
|
|
|
|
- run: |
|
|
|
|
rm -rf /tmp/.buildx-cache
|
|
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|