Skip to content

Make it build with ghc 9.8 #450

Make it build with ghc 9.8

Make it build with ghc 9.8 #450

Workflow file for this run

name: Haskell CI using Cabal
on:
push:
branches: [ "master" ]
pull_request:
jobs:
build:
runs-on: ${{ matrix.sys.os }}
strategy:
fail-fast: false
matrix:
ghc: ["8.10.7", "9.6", "9.8"]
cabal: ["3.12"]
# os: [ubuntu-latest, macos-latest, windows-latest]
sys:
- { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' }
- { os: ubuntu-latest, shell: bash }
defaults:
run:
shell: ${{ matrix.sys.shell }}
steps:
- name: Install system dependencies
uses: input-output-hk/actions/base@latest
with:
use-sodium-vrf: true
- name: Install Haskell
uses: input-output-hk/actions/haskell@latest
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: WINDOWS Install libs
if: runner.os == 'Windows'
run: |
/usr/bin/pacman --noconfirm -S mingw-w64-x86_64-pcre
- name: Set cache version
run: echo "CACHE_VERSION=grFfw7r" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Cabal update
run: cabal update
- name: Configure build
run: |
if [ "${{github.event.inputs.tests}}" == "all" ]; then
echo "Reconfigure cabal projects to run tests for all dependencies"
sed -i 's|tests: False|tests: True|g' cabal.project
fi
cp ".github/workflows/cabal.project.local.ci" cabal.project.local
echo "# cabal.project.local"
cat cabal.project.local
- name: Record dependencies
id: record-deps
run: |
cabal build all --dry-run
cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[] | select(.style != "local") | .id' | sort | uniq > dependencies.txt
# Use a fresh cache each month
- name: Store month number as environment variable used in cache version
run: echo "MONTHNUM=$(date -u '+%m')" >> $GITHUB_ENV
# From the dependency list we restore the cached dependencies.
# We use the hash of `dependencies.txt` as part of the cache key because that will be stable
# until the `index-state` values in the `cabal.project` file changes.
- name: Restore cached dependencies
uses: actions/cache/restore@v4
id: cache
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key:
cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.MONTHNUM }}-${{ hashFiles('dependencies.txt') }}
# try to restore previous cache from this month if there's no cache for the dependencies set
restore-keys: |
cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.MONTHNUM }}-
- name: Install dependencies
run: cabal build all --only-dependencies
# Always store the cabal cache.
- name: Cache Cabal store
uses: actions/cache/save@v4
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key:
${{ steps.cache.outputs.cache-primary-key }}
- name: Build
run: cabal build all
- name: Run unit tests
run: cabal test cardano-addresses cardano-addresses-cli
- name: Upload Windows Artifact
uses: actions/upload-artifact@v4
if: runner.os == 'Windows'
with:
name: ${{ matrix.sys.os }}-${{ matrix.ghc }}-exe
path: ${{ steps.setup-haskell.outputs.cabal-store }}