fix failed tests #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: [ "master" ] | |
push: | |
branches: [ "master" ] | |
tags: [ "*.*.*" ] | |
jobs: | |
runhaskell: | |
name: π Build & Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: π₯ Checkout repository | |
uses: actions/checkout@v3 | |
- name: π§° Setup Haskell & Stack | |
uses: haskell-actions/setup@v2 | |
with: | |
enable-stack: true | |
stack-no-global: true | |
stack-version: 'latest' | |
- name: πΎ Cache Stack | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.stack | |
key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }} | |
- name: πΈ Build Snapshot | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
stack --no-terminal test --bench --only-snapshot | |
- name: π¨ Build & Test | |
run: | | |
stack --no-terminal test --bench --haddock --no-haddock-deps --no-run-benchmarks --coverage | |
mkdir -p dist/haddock && mv $(stack path --local-install-root)/doc/* dist/haddock | |
sed -i 's@href="[^"]*/doc/\([^"]*.html\)"@href="\1"@g' dist/haddock/index.html | |
- name: π Coverage | |
run: | | |
stack hpc report --all --destdir dist/coverage 2>&1 | tee coverage.log | |
coverage=$(cat coverage.log | tr '\n' ' ' | sed "s/.* \([0-9]\+\)% top-level declarations used.*/\1/") | |
color="$(if [[ ${coverage} -ge '80' ]]; then echo 'green'; elif [[ $coverage -ge '60' ]]; then echo 'yellow'; else echo 'red'; fi)" | |
wget -O dist/coverage/badge.svg "https://img.shields.io/badge/coverage-${coverage}%25-${color}" | |
- name: π Publish Documentation | |
if: github.event_name == 'push' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: dist | |
enable_jekyll: true |