208 support metrics report generation #345
Workflow file for this run
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: 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 | |
# TODO #208:10m replace with freckle/stack-action after https://github.com/freckle/stack-action/pull/69 is merged | |
uses: deemp/stack-action@main | |
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 | |
- 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 | |
report | |
- name: Write about the artifact in the job summary | |
if: always() | |
shell: bash | |
run: | | |
cat << EOF >> $GITHUB_STEP_SUMMARY | |
<h2>Artifact</h2> | |
<p> | |
EO and PHI files that participated in the pipeline | |
are in the artifact | |
<a href="${{ steps.pipeline-artifact.outputs.artifact-url }}"> | |
pipeline-${{ hashFiles('pipeline/eo/*.eo') }} | |
</a>. | |
</p> | |
EOF | |
- name: Write the report in the job summary | |
if: success() | |
shell: bash | |
run: | | |
cat report/report.md >> $GITHUB_STEP_SUMMARY | |
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 | |
# TODO #208:10m replace with freckle/stack-action after https://github.com/freckle/stack-action/pull/69 is merged | |
uses: deemp/stack-action@main | |
with: | |
test: false | |
stack-build-arguments: --fast --haddock | |
- 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: Build site | |
run: | | |
ROOT=$PWD | |
mkdir -p dist/haddock | |
mv $(stack path --local-doc-root)/* dist/haddock | |
cd site/docs | |
mdbook build | |
mv docs ../../dist | |
cd ../.. | |
cd site | |
mv index.html ../dist | |
cd .. | |
mkdir -p dist/report | |
cp report/report.html dist/report/index.html | |
- name: 🚀 Publish Site | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
folder: dist | |
single-commit: true |