Skip to content

[proposal] Support custom rules #824

[proposal] Support custom rules

[proposal] Support custom rules #824

Workflow file for this run

name: GHC (build, test, haddock)
# Controls when the workflow will run
on:
push:
branches: [master]
tags: [v*]
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write # to submit Haddock documentation to GitHub Pages
jobs:
check:
name: "Run static checks"
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
- uses: haskell-actions/run-fourmolu@v10
with:
version: "0.14.0.0"
pattern: |
eo-phi-normalizer/**/*.hs
!eo-phi-normalizer/src/Language/EO/Phi/Syntax/**/*.hs
!eo-phi-normalizer/Setup.hs
- uses: haskell-actions/hlint-setup@v2
- name: Get hlint-bin
id: get-hlint-bin
run: |
chmod +x scripts/run-hlint.sh
echo "hlint-bin=$(realpath scripts/run-hlint.sh)" >> $GITHUB_OUTPUT
- uses: haskell-actions/hlint-run@v2
with:
hlint-bin: ${{ steps.get-hlint-bin.outputs.hlint-bin }}
pipeline:
name: Run pipeline
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: 🧰 Setup Stack
uses: freckle/stack-action@v5
with:
stack-build-arguments: ${{ github.ref_name != 'master' && '--fast' || '' }} --pedantic
# TODO #213:10m enable macos test after https://github.com/objectionary/normalizer/issues/180 is resolved
# TODO #98:10m enable windows tests after https://github.com/objectionary/normalizer/issues/185 is resolved
test: ${{ matrix.os != 'windows-latest' && matrix.os != 'macos-latest'}}
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: 21
- name: Run pipeline
shell: bash
run: ./scripts/pipeline.sh
- name: Upload pipeline artifact
id: pipeline-artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: pipeline-${{ runner.os }}-${{ hashFiles('pipeline/eo/*.eo') }}
overwrite: true
path: |
pipeline
!pipeline/**/.eoc
!pipeline/yaml
pipeline/phi/.eoc/4-pull/org
pipeline/phi/.eoc/phi/org
pipeline/phi/.eoc/print/org
report
- name: Write about the artifact in the job summary
if: always()
shell: bash
run: |
cat << EOF >> $GITHUB_STEP_SUMMARY
<h2>Artifact</h2>
<p>
The artifact
<a href="${{ steps.pipeline-artifact.outputs.artifact-url }}">
pipeline-${{ runner.os }}-${{ hashFiles('pipeline/eo/*.eo') }}
</a> contains files used or produced during the pipeline run:
</p>
<ul>
<li>EO and PHI programs</li>
<li>Reports</li>
</ul>
EOF
- name: Write the report in the job summary
if: success()
shell: bash
run: |
cat << EOF >> $GITHUB_STEP_SUMMARY
<h2>Report</h2>
<details>
<summary>Click to expand</summary>
$(cat report/report.md)
</details>
EOF
docs:
needs: pipeline
if: ${{ github.ref_name == 'master' }}
name: "Build and upload site (master)"
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
- name: 🧰 Setup Stack
uses: freckle/stack-action@v5
with:
test: false
stack-build-arguments: --fast --haddock --copy-bins
cache-prefix: docs-
- name: Download pipeline artifact
uses: actions/download-artifact@v4
with:
pattern: pipeline-${{ runner.os }}-*
merge-multiple: true
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "latest"
- name: cargo-install
uses: baptiste0928/cargo-install@v3.0.1
with:
crate: mdsh
git: https://github.com/zimbatm/mdsh
tag: v0.8.0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Add haddock
run: |
mkdir -p dist/haddock
mv $(stack path --local-doc-root)/* dist/haddock
- name: Run mdsh
run: ./scripts/run-mdsh.sh
- name: Configure git for github-actions
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Commit changes produced by mdsh
run: |
git pull --rebase --autostash
git add site
git commit -m "Run mdsh" \
&& git push \
|| true
- name: Add docs
run: |
cd site/docs
mdbook build
mv docs ../../dist
- name: Add report
run: |
mkdir -p dist/report
cp report/report.html dist/report/index.html
- name: Add index.html
run: mv site/index.html dist
- name: 🚀 Publish Site
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
folder: dist
single-commit: true