reanimate/.github/workflows/gh-pages.yml
dependabot[bot] ff0e25c4ae
Bump JamesIves/github-pages-deploy-action from 4.3.3 to 4.3.4
Bumps [JamesIves/github-pages-deploy-action](https://github.com/JamesIves/github-pages-deploy-action) from 4.3.3 to 4.3.4.
- [Release notes](https://github.com/JamesIves/github-pages-deploy-action/releases)
- [Commits](https://github.com/JamesIves/github-pages-deploy-action/compare/v4.3.3...v4.3.4)

---
updated-dependencies:
- dependency-name: JamesIves/github-pages-deploy-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-27 11:22:20 +00:00

109 lines
3.3 KiB
YAML

name: GitHub Page
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-haskell@v1
with:
ghc-version: 'latest'
cabal-version: 'latest'
- uses: jorelali/setup-elm@v3
with:
elm-version: 0.19.1
- name: Cache
uses: actions/cache@v3.0.4
with:
path: |
~/.cabal
~/.stack
~/.stack-work
~/.dist-newstyle
~/.ghc
key: ${{ runner.os }}-${{ hashFiles('**/*.cabal') }}-cache
- name: Install dependencies
run: |
cabal v2-update
cabal v2-build --only-dependencies
mkdir pages
- name: Build
run: |
cabal v2-build
# - name: Generate HPC files
# run: |
# set -o xtrace
# for gold in examples/golden/*.golden; do
# BASE=examples/$(basename $gold)
# BASE=${BASE%.golden}
# cabal v2-exec --enable-coverage -- ghc -package reanimate "$BASE.hs" --make
# reanimate_datadir=$(pwd) ${BASE%.hs} test > /dev/null
# done;
# - name: Merge HPC files
# run: hpc sum --union *.tix --output=total.tix
# - name: Report
# run: |
# hpc report --hpcdir $(find dist-newstyle -name 'hpc')/vanilla/mix/*/ total.tix
# - name: Markup
# run: |
# hpc markup --destdir=hpc --hpcdir $(find dist-newstyle -name 'hpc')/vanilla/mix/*/ total.tix
# - name: HPC Badge
# run: |
# COVERAGE=$(cat hpc/hpc_index.html | tr '\n' ' ' | sed "s/.*Program Coverage Total.*>\([0-9]\{1,3\}\)%.*>\([0-9]\{1,3\}\)%.*>\([0-9]\{1,3\}\)%.*/\1/")
# echo "\
# { \"schemaVersion\": 1, \
# \"label\": \"api tests\", \
# \"message\": \"$COVERAGE%\", \
# \"color\": \"success\" \
# }" > pages/hpc_badge.json
- name: Haddock Badge
run: |
# Stack is required because cabal doesn't build docs for dependencies.
# Without those, coverage will not reach 100%
stack build --haddock --only-dependencies
stack haddock 2>&1 | grep ") in " | sort -hr > pages/haddock.txt
COVERAGE=$(awk '{good += $3; total += $5} END {printf "%.0f", good/total*100}' pages/haddock.txt)
echo "\
{ \"schemaVersion\": 1, \
\"label\": \"api docs\", \
\"message\": \"$COVERAGE%\", \
\"color\": \"success\" \
}" > pages/haddock_badge.json
# Is there a way to reuse the script from playground.yml?
- name: Playground
run: |
sudo apt-get update
sudo apt-get -y install texlive texlive-latex-base texlive-latex-extra
CWD=`pwd`
stack build
cd playground
stack build
# We need to install latex before we can generate the snippets.
stack exec --cwd ../ playground snippets playground/snippets > viewer-elm/dist/snippets.js
cd viewer-elm
npm install
npm run build
mkdir $CWD/pages/playground
cp dist/* $CWD/pages/playground/
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: pages # The folder the action should deploy.