-
Notifications
You must be signed in to change notification settings - Fork 2
93 lines (80 loc) · 2.92 KB
/
haskell.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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