Skip to content

Merge pull request #1491 from sgillespie/fix/ci-failures #3214

Merge pull request #1491 from sgillespie/fix/ci-failures

Merge pull request #1491 from sgillespie/fix/ci-failures #3214

Workflow file for this run

name: Haskell CI
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
env:
# Modify this value to "invalidate" the cabal cache.
CABAL_CACHE_VERSION: "2023-05-05"
strategy:
fail-fast: false
matrix:
cabal: ["3.10.1.0"]
ghc: ["8.10.7", "9.2.7", "9.6.2" ]
os: [ubuntu-latest, macos-latest]
steps:
- name: Install Haskell
uses: input-output-hk/actions/haskell@latest
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Install system dependencies
uses: input-output-hk/actions/base@latest
with:
use-sodium-vrf: false # default is true
- uses: actions/checkout@v3
- name: Select build directory
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- name: Install SystemD (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get -y install libsystemd0 libsystemd-dev
- name: Install Postgres (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libpq-dev libpq5 net-tools postgresql
- name: Post Install Cleanup (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get -y remove --purge software-properties-common
sudo apt-get -y autoremove
- name: Install Postgres support (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install postgresql@14 libpq openssl@1.1 tree
tree /usr/local/opt/postgresql@14/lib/
echo "PKG_CONFIG_PATH=/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/postgresql@14/lib/postgresql@14/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH" | tee $GITHUB_ENV
- name: Start Postgresql service (macOS)
if: matrix.os == 'macos-latest'
run: |
brew services start postgresql
sudo mkdir -p /var/run/postgresql/
sudo ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
- name: Start Postgres service (Linux)
if: matrix.os == 'ubuntu-latest'
run: sudo pg_ctlcluster 14 main start
- name: Check if postgres is running
run: |
sleep 20
netstat -an
ls -al /var/run/postgresql/.s.PGSQL.5432 || true
ls -al || true
- name: Debug Pkgconfig
run: |
echo $PKG_CONFIG_PATH
pkg-config --list-all
- name: Haskell versions
run: |
ghc --version
cabal --version
- name: Cabal update
run: cabal update
- name: Cabal Configure
run: cabal configure --enable-tests --write-ghc-environment-files=always
- name: Configure to use libsodium
run: |
cat >> cabal.project.local <<EOF
package cardano-crypto-praos
flags: -external-libsodium-vrf
EOF
- name: Record dependencies
id: record-deps
run: |
cabal build all --dry-run --minimize-conflict-set
cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt
- name: Cache Cabal store
uses: actions/cache@v3
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
- name: Build dependencies
if: matrix.os == 'ubuntu-latest'
run: cabal build all -j --ghc-option=-j4 --enable-tests --only-dependencies
- name: Build
run: cabal build all -j --ghc-option=-j4 --enable-tests
- name: Set up database user (Linux)
if: matrix.os == 'ubuntu-latest'
run: sudo -u postgres createuser --createdb --superuser runner
- name: Set up database
run: |
cardano_db_sync_exe="$(cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[] | select(."component-name" == "exe:cardano-db-sync") | ."bin-file"' | head)"
echo "Executable found at: $cardano_db_sync_exe"
chmod 600 config/pgpass-mainnet
chmod 600 cardano-chain-gen/test/testfiles/pgpass-testing
PGPASSFILE=config/pgpass-mainnet scripts/postgresql-setup.sh --createdb
PGPASSFILE=cardano-chain-gen/test/testfiles/pgpass-testing scripts/postgresql-setup.sh --createdb
- name: Run tests
run: cabal test all -j1