Skip to content

Add hie.yaml to root #6841

Add hie.yaml to root

Add hie.yaml to root #6841

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]
# TODO: Add ghc910 when input-output-hk/devx is fixed
compiler-nix-name: [ghc96, ghc98, ghc912]
include:
# We want a single job, because macOS runners are scarce.
- os: macos-latest
compiler-nix-name: ghc96
env:
# Increment this value to "invalidate" the cabal cache. Be sure to do this
# after updating dependencies (Hackage or chap)
CABAL_CACHE_VERSION: 1
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install GHC and Cabal
uses: input-output-hk/actions/devx@latest
with:
platform:
${{ (runner.os == 'Linux' && 'x86_64-linux') ||
(runner.os == 'macOS' && runner.arch == 'X64' && 'x86_64-darwin') ||
(runner.os == 'macOS' && runner.arch == 'ARM64' && 'aarch64-darwin')
}}
target-platform: ""
compiler-nix-name: ${{ matrix.compiler-nix-name }}
minimal: false
# enable IOG-full flavour to bring in all the crypto libraries we need.
iog-full: true
# TODO: remove when input-output-hk/devx is fixed
- name: Install system dependencies
uses: input-output-hk/actions/base@latest
with:
use-sodium-vrf: true
- name: Add LMDB to Nix environment
run: |
nix-env -f '<nixpkgs>' -iA lmdb
LMDB_STORE=$(find /nix/store -maxdepth 1 -name '*lmdb*-dev' -type d | head -1)
if [ -n "$LMDB_STORE" ]; then
echo "LMDB_PKGCONFIG=${LMDB_STORE}/lib/pkgconfig" >> $GITHUB_ENV
fi
shell: devx {0}
- name: cache cabal
uses: actions/cache@v3
with:
path: |
~/.cabal-devx/packages
~/.cabal-devx/store
key: ${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.compiler-nix-name }}-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.freeze') }}
restore-keys: ${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.compiler-nix-name }}-
- name: cabal update
run: |
export PKG_CONFIG_PATH_FOR_TARGET=${{ env.LMDB_PKGCONFIG }}:${PKG_CONFIG_PATH_FOR_TARGET:-}
cabal update
- name: cabal build dependencies
run: |
export PKG_CONFIG_PATH_FOR_TARGET=${{ env.LMDB_PKGCONFIG }}:${PKG_CONFIG_PATH_FOR_TARGET:-}
cabal build all -j --enable-tests --only-dependencies
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# if: ${{ failure() }}
# with:
# limit-access-to-actor: true
- name: cabal build
run: |
export PKG_CONFIG_PATH_FOR_TARGET=${{ env.LMDB_PKGCONFIG }}:${PKG_CONFIG_PATH_FOR_TARGET:-}
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