This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
fix norm #148
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: Documentation | |
on: [push] | |
jobs: | |
documentation: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # To push a branch | |
pages: write # To push to a GitHub Pages site | |
id-token: write # To update the deployment status | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check modified files need re run | |
id: filter | |
uses: dorny/paths-filter@v2 | |
with: | |
filters: | | |
docs: | |
- 'docs/**' | |
docs2: | |
- 'book.toml' | |
workflow: | |
- '.github/workflows/documentation.yml' | |
- name: Install latest mdbook | |
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main' | |
run: | | |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name') | |
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz" | |
mkdir mdbook | |
curl -sSL $url | tar -xz --directory=./mdbook | |
echo `pwd`/mdbook >> $GITHUB_PATH | |
- name: Install emojify | |
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main' | |
run: | | |
wget --no-verbose https://github.com/shonfeder/emojitsu/releases/download/0.1.1/gh-actions-emojitsu | |
chmod +x gh-actions-emojitsu | |
# Emojify the markdown | |
find . -type f -name "*.md" -exec ./gh-actions-emojitsu emojify -i {} \; | |
- name: Build Book | |
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main' | |
run: mdbook build | |
- name: Install Haskell | |
uses: haskell-actions/setup@v2 | |
with: | |
enable-stack: true | |
stack-version: 'latest' | |
- name: Compil | |
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main' | |
run: | | |
if ! stack build; then | |
exit 0 | |
fi | |
- name: Tests | |
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main' | |
run: | | |
if ! stack test --test-arguments "--html book/Tests.html"; then | |
exit 0 | |
fi | |
- name: Coverage | |
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main' | |
run: | | |
if ! make tests-coverage; then | |
exit 0 | |
else | |
PATH_HTML=$(make tests-coverage-html-path) | |
cp -r "$PATH_HTML/koaky" book/ | |
cp -r "$PATH_HTML/combined" book/ | |
cp "$PATH_HTML/index.html" book/Coverage.html | |
fi | |
- name: Setup Pages | |
if: github.ref == 'refs/heads/main' | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main' | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
# Upload entire repository | |
path: 'book' | |
- name: Deploy to GitHub Pages | |
if: github.ref == 'refs/heads/main' | |
id: deployment | |
uses: actions/deploy-pages@v2 |