Skip to content

Haskell CI

Haskell CI #100

Workflow file for this run

name: Haskell CI
on:
push:
pull_request:
schedule:
# Everyday at 4:00 AM UTC
- cron: "0 4 * * *"
jobs:
build:
name: build
defaults:
run:
shell: devx {0}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
compiler-nix-name: [ghc810, ghc96]
include:
# We want a single job, because macOS runners are scarce.
- os: macos-latest
compiler-nix-name: ghc96
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install GHC and Cabal
uses: input-output-hk/actions/devx@latest
with:
platform: ${{ matrix.os == 'ubuntu-latest' && 'x86_64-linux' || 'x86_64-darwin' }}
target-platform: ""
compiler-nix-name: ${{ matrix.compiler-nix-name }}
minimal: false
# enable IOG flavour to bring in all the crypto libraries we need.
iog: true
- name: cache cabal
uses: actions/cache@v3
with:
path: |
~/.cabal-devx/packages
~/.cabal-devx/store
key: ${{ runner.os }}-${{ matrix.compiler-nix-name }}-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.freeze') }}
restore-keys: ${{ runner.os }}-${{ matrix.compiler-nix-name }}-
- name: cabal update
run: cabal update
- name: cabal build dependencies
run: cabal build all -j --enable-tests --only-dependencies
- name: cabal build
run: cabal build all -j --enable-tests
- name: postgres init
working-directory:
run: |
# Set up environment
PG_DIR="$(mktemp -d)"
DB_DIR="${PG_DIR}/db"
DBUSER=$(whoami)
DBNAME=$DBUSER
# Pass environment to subsequent steps
echo "PG_DIR=${PG_DIR}" >> "$GITHUB_ENV"
echo "DB_DIR=${DB_DIR}" >> "$GITHUB_ENV"
echo "DBUSER=${DBUSER}" >> "$GITHUB_ENV"
# Start postgres
./scripts/postgresql-test.sh \
-s "$PG_DIR" \
-d "$DB_DIR" \
-u "$DBUSER" \
-n "$DBNAME" \
start
- name: cabal test
run: |
# Create pgpass file
export PGPASSFILE="${PG_DIR}/pgpass-testing"
echo "${PG_DIR}:5432:$DBUSER:$DBUSER:*" > $PGPASSFILE
chmod 600 $PGPASSFILE
# Run tests
cabal test all -j1
- name: postgres shutdown
if: ${{ always() }}
run: |
./scripts/postgresql-test.sh -d "$DB_DIR" stop