Generalize patterns for free foil #74
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: Haskell (build, test, haddock) | |
# Controls when the workflow will run | |
on: | |
push: | |
branches: [main] | |
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: | |
tests: | |
name: Run tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-12] | |
steps: | |
- name: 📥 Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set codepage on Windows | |
if: ${{ runner.os == 'Windows' }} | |
run: chcp 65001 | |
- name: Restore Syntax files | |
id: restore-syntax-files | |
uses: actions/cache/restore@v4 | |
with: | |
key: syntax-files-${{ runner.os }}-${{ hashFiles(format('{0}.cf', 'haskell/lambda-pi/src/Language/LambdaPi/Syntax/'), 'stack.yaml.lock') }} | |
path: | | |
haskell/lambda-pi/src/Language/LambdaPi/Syntax/Lex.hs | |
haskell/lambda-pi/src/Language/LambdaPi/Syntax/Par.hs | |
- 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.restore-syntax-files.outputs.cache-hit == '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', 'haskell/lambda-pi/src/Language/LambdaPi/Syntax/'), 'stack.yaml.lock') }} | |
path: | | |
haskell/lambda-pi/src/Language/LambdaPi/Syntax/Lex.hs | |
haskell/lambda-pi/src/Language/LambdaPi/Syntax/Par.hs | |
docs: | |
needs: [tests] | |
if: ${{ github.ref_name == 'main' }} | |
name: "Build and upload site (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 | |
cache-prefix: docs- | |
- 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 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
folder: dist | |
single-commit: true |