Add types to SOAS #14
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: | |
- main | |
tags: [v*] | |
pull_request: | |
branches: | |
- main | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
contents: write # to submit Haddock documentation to GitHub Pages | |
env: | |
syntax-dir: "free-foil-hou/src/Language/Lambda/Syntax" | |
jobs: | |
tests: | |
name: Run tests | |
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 | |
ref: ${{ github.ref }} | |
- name: Restore Syntax files | |
id: restore-syntax-files | |
uses: actions/cache/restore@v4 | |
with: | |
key: syntax-files-${{ runner.os }}-${{ hashFiles(format('{0}.cf', env.syntax-dir), 'stack.yaml.lock') }} | |
path: | | |
${{ env.syntax-dir }}/Lex.hs | |
${{ env.syntax-dir }}/Par.hs | |
- name: Check Syntax files exist | |
if: steps.restore-syntax-files.outputs.cache-hit == 'true' | |
shell: bash | |
id: check-syntax-files | |
run: | | |
source scripts/lib.sh | |
check_syntax_files_exist | |
printf "SYNTAX_FILES_EXIST=$SYNTAX_FILES_EXIST\n" >> $GITHUB_OUTPUT | |
- name: 🧰 Setup Stack | |
uses: freckle/stack-action@v5 | |
with: | |
stack-build-arguments: --pedantic | |
stack-build-arguments-build: --dry-run | |
stack-build-arguments-test: --ghc-options -O2 ${{ steps.check-syntax-files.outputs.SYNTAX_FILES_EXIST == 'true' && ' ' || '--reconfigure --force-dirty --ghc-options -fforce-recomp' }} | |
- name: Save Syntax files | |
uses: actions/cache/save@v4 | |
if: steps.restore-syntax-files.outputs.cache-hit != 'true' | |
with: | |
key: syntax-files-${{ runner.os }}-${{ hashFiles(format('{0}.cf', env.syntax-dir), 'stack.yaml.lock') }} | |
path: | | |
${{ env.syntax-dir }}/Lex.hs | |
${{ env.syntax-dir }}/Par.hs | |
docs: | |
needs: [tests] | |
name: "Build (all) and upload haddock (only main)" | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: 🧰 Setup Stack | |
uses: freckle/stack-action@v5 | |
with: | |
test: false | |
stack-build-arguments: --fast --haddock --no-nix | |
cache-prefix: docs- | |
- name: Download pipeline artifact | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: pipeline-files-${{ runner.os }} | |
merge-multiple: true | |
- name: Add haddock | |
run: | | |
mkdir -p dist/haddock | |
mv $(stack path --local-doc-root)/* dist/haddock | |
- name: 🚀 Publish Site | |
uses: JamesIves/github-pages-deploy-action@v4 | |
if: ${{ github.ref_name == 'main' }} | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
folder: dist | |
single-commit: true |