Build #917
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: Build | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: | |
- synchronize | |
- opened | |
- reopened | |
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: | |
- '3.10' | |
ghc: | |
- '8.10' | |
- '9.0' | |
- '9.2' | |
- '9.4' | |
- '9.6' | |
- '9.8' | |
- '9.10' | |
exclude: | |
# TODO: https://github.com/haskell-actions/setup/issues/77 | |
# To work around the above issue, we exclude the following versions: | |
- os: macOS-latest | |
ghc: '8.10' | |
- os: macOS-latest | |
ghc: '9.0' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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@v4 | |
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 | |
- 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 | |
--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.10' | |
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.10' | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: gh-pages |