Skip to content

Build with Cabal

Build with Cabal #784

Workflow file for this run

name: Build with Cabal
on:
push:
schedule:
- cron: '0 8 * * *'
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ghc:
- '9.6'
- '9.8'
- '9.10'
cabal:
- '3.12'
os:
- 'ubuntu-20.04'
- 'ubuntu-22.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: Confirm GHC and Cabal installation
run: |
ghc --version
cabal --version
- name: Configure project
run: |
cat > cabal.project.local <<EOF
package ethereum
documentation: False
benchmarks: True
tests: True
extra-lib-dirs:
/opt/local/lib
/usr/local/opt/openssl/lib
extra-include-dirs:
/opt/local/include
/usr/local/opt/openssl/include
package hashes
extra-lib-dirs:
/opt/local/lib
/usr/local/opt/openssl/lib
extra-include-dirs:
/opt/local/include
/usr/local/opt/openssl/include
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
- 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 run ethereum-tests
# benchmarks
- name: Run Benchmarks
run: cabal bench