-
Notifications
You must be signed in to change notification settings - Fork 160
83 lines (76 loc) · 2.42 KB
/
haskell.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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, macos-latest]
compiler-nix-name: [ghc8107, ghc928, ghc962]
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