mirror of
https://github.com/stackbuilders/hapistrano.git
synced 2024-12-26 13:01:29 +03:00
85 lines
2.7 KiB
YAML
85 lines
2.7 KiB
YAML
|
---
|
||
|
# 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:
|
||
|
os: [ubuntu-latest]
|
||
|
ghc:
|
||
|
- "9.0.1"
|
||
|
- "8.10.4"
|
||
|
- "8.8.4"
|
||
|
- "8.6.5"
|
||
|
include:
|
||
|
- os: macos-latest
|
||
|
ghc: "9.0.1"
|
||
|
|
||
|
steps:
|
||
|
- uses: actions/checkout@v3
|
||
|
- uses: haskell/actions/setup@v1
|
||
|
with:
|
||
|
ghc-version: ${{ matrix.ghc }}
|
||
|
cabal-version: "3.4"
|
||
|
- 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:
|
||
|
key: v1-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
|
||
|
restore-keys: v1-${{ runner.os }}-${{ matrix.ghc }}-
|
||
|
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
|