use iohk-monitoring Severity to handle debug #5571
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: 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: [ghc810, ghc96, ghc98] | |
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: ${{ matrix.os == 'ubuntu-latest' && 'x86_64-linux' || 'x86_64-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 | |
- 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: 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 |