Build #268
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: | |
push: | |
schedule: | |
- cron: '0 8 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
ghc: ['9.10', '9.8', '9.6', '9.4'] | |
cabal: ['3.12'] | |
os: ['ubuntu-22.04', 'ubuntu-20.04', 'macOS-latest'] | |
flags: [ '-with-time' ] | |
include: | |
- ghc: '9.8' | |
cabal: '3.12' | |
os: 'ubuntu-20.04' | |
flags: '+with-time' | |
- ghc: '9.4' | |
cabal: '3.12' | |
os: 'ubuntu-20.04' | |
flags: '+with-time' | |
steps: | |
# Setup | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install GHC and Cabal | |
id: setup | |
uses: haskell-actions/setup@v2 | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
cabal-update: true | |
- name: Configure project | |
run: | | |
cat > cabal.project.local <<EOF | |
package pact-time | |
documentation: True | |
benchmarks: True | |
tests: True | |
flags: ${{ matrix.flags }} | |
EOF | |
cabal build all --dry-run | |
cabal freeze | |
- name: Restore cached dependencies | |
uses: actions/cache/restore@v4 | |
id: cache | |
env: | |
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} | |
with: | |
path: ${{ steps.setup.outputs.cabal-store }} | |
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} | |
restore-keys: ${{ env.key }}- | |
- name: Install dependencies | |
# If we had an exact cache hit, the dependencies will be up to date. | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: cabal build all --only-dependencies | |
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail. | |
- name: Save cached dependencies | |
uses: actions/cache/save@v4 | |
# If we had an exact cache hit, trying to save the cache would error because of key clash. | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
path: ${{ steps.setup.outputs.cabal-store }} | |
key: ${{ steps.cache.outputs.cache-primary-key }} | |
# Build | |
- name: Build library | |
run: cabal build | |
# Tests | |
- name: Run Tests | |
run: cabal test |