version 0.3.1 #479
This file contains hidden or 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 with Cabal | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
ghc: ['9.6', '9.8', '9.10', '9.12'] | |
cabal: ['latest'] | |
os: ['ubuntu-22.04', 'ubuntu-24.04', 'macOS-latest'] | |
steps: | |
# Setup | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install GHC and Cabal | |
uses: haskell-actions/setup@v2 | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
- name: Configure project | |
run: | | |
cat > cabal.project.local <<EOF | |
package digraph | |
documentation: True | |
benchmarks: True | |
tests: True | |
EOF | |
# Restore Packages from Caches | |
- name: Restore cache ~/.cabal/packages and ~/.cabal/store | |
id: deps-cache-restore | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
~/.cabal/packages | |
~/.cabal/store | |
key: deps-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.local') }} | |
restore-keys: | | |
deps-${{ matrix.os }}-${{ matrix.ghc }}- | |
# Restore dist-newstyle | |
- name: Cache dist-newstyle | |
uses: actions/cache@v4 | |
with: | |
path: | | |
dist-newstyle | |
key: dist-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.local') }} | |
restore-keys: | | |
dist-${{ matrix.os }}-${{ matrix.ghc }}- | |
save-always: true | |
# Build | |
- name: Update package database | |
run: cabal update | |
- name: Configure build | |
run: | | |
cabal build all --dry-run | |
cabal freeze | |
cat cabal.project.freeze | |
- name: Show outdated packages | |
run: cabal outdated | |
- name: Install build dependencies | |
run: cabal build --only-dependencies | |
# Save packages | |
- name: Save cache for ~/.cabal/packages and ~/.cabal/store | |
uses: actions/cache/save@v4 | |
if: always() | |
with: | |
path: | | |
~/.cabal/packages | |
~/.cabal/store | |
key: ${{ steps.deps-cache-restore.outputs.cache-primary-key }} | |
- name: Build library | |
run: cabal build | |
# Tests | |
- name: Run Tests | |
run: cabal test | |