Skip to content

Build

Build #685

Workflow file for this run

name: Build
on:
workflow_dispatch:
pull_request:
types:
- synchronize
- opened
- reopened
merge_group:
push:
branches:
- main
schedule:
# Run once per day (at UTC 18:00) to maintain cache:
- cron: 0 18 * * *
jobs:
build:
name: ${{ matrix.os }}-ghc-${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
env:
cabal-build-dir: b
strategy:
matrix:
os:
- ubuntu-latest
- macOS-latest
- windows-latest
cabal:
- latest
ghc:
- 8.10.7
- 9.0.2
- 9.2.8
- 9.4.8
- 9.6.4
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Environment
uses: haskell-actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Configure
run: >
cabal configure
--builddir=${{ env.cabal-build-dir }}
--enable-tests
--enable-benchmarks
--enable-documentation
--test-show-details=direct
--write-ghc-environment-files=always
- name: Freeze
run: >
cabal freeze
--builddir=${{ env.cabal-build-dir }}
- name: Cache
uses: actions/cache@v3
env:
hash: ${{ hashFiles('cabal.project.freeze') }}
with:
key: ${{ matrix.os }}-ghc-${{ matrix.ghc }}-${{ env.hash }}
restore-keys: |
${{ matrix.os }}-ghc-${{ matrix.ghc }}-
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
${{ env.cabal-build-dir }}
- name: Dependencies
run: >
cabal build all
--builddir=${{ env.cabal-build-dir }}
--only-dependencies
- name: Build
run: >
cabal build all
--builddir=${{ env.cabal-build-dir }}
--enable-tests
--enable-benchmarks
--ghc-options=-Wall
--ghc-options=-Werror
- name: Test
run: >
cabal test all
--builddir=${{ env.cabal-build-dir }}
- name: Benchmark
run: >
cabal bench all
--builddir=${{ env.cabal-build-dir }}
|| true
- name: Documentation (Generation)
run: >
cabal haddock all
--builddir=${{ env.cabal-build-dir }}
--enable-documentation
--haddock-hyperlink-source
--haddock-html-location
'https://hackage.haskell.org/package/$pkg-$version/docs'
- name: Documentation (Staging)
if: |
github.ref == 'refs/heads/main'
&& matrix.os == 'ubuntu-latest'
&& matrix.ghc == '9.6.4'
run: >
mv ${{ env.cabal-build-dir }}/build/*/*/*/doc/html/* gh-pages
touch gh-pages/.nojekyll
- name: Documentation (Deployment)
if: |
github.ref == 'refs/heads/main'
&& matrix.os == 'ubuntu-latest'
&& matrix.ghc == '9.6.4'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: gh-pages