-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
93 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
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/free-foil/src/Language/LambdaPi/Syntax/'), 'stack.yaml.lock') }} | ||
path: | | ||
haskell/free-foil/src/Language/LambdaPi/Syntax/Lex.hs | ||
haskell/free-foil/src/Language/LambdaPi/Syntax/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', 'haskell/free-foil/src/Language/LambdaPi/Syntax/'), 'stack.yaml.lock') }} | ||
path: | | ||
haskell/free-foil/src/Language/LambdaPi/Syntax/Lex.hs | ||
haskell/free-foil/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 |