Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Add test to ensure schema migrations are complete #1359

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Install Postgres support (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install postgresql@14 libpq openssl@1.1
brew install postgresql@14 libpq openssl@1.1 pkg-config
brew services start postgresql
sudo mkdir -p /var/run/postgresql/
sudo ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get -y install libsodium23 libsodium-dev libsystemd0 libsystemd-dev
sudo apt-get -y install libsodium23 libsodium-dev libsystemd0 libsystemd-dev git
sudo apt-get -y remove --purge software-properties-common
sudo apt-get -y autoremove

Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
- uses: actions/cache@v3
name: Cache cabal store
with:
path: |
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: cache-cabal-store-v1-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
Expand Down Expand Up @@ -144,3 +144,25 @@ jobs:

- name: Run tests
run: cabal test all -j1

- name: Check that Schema Migrations are complete
run: |
PGPASSFILE=config/pgpass-mainnet cabal run cardano-db-tool -- run-migrations --mdir schema/ --ldir /tmp/
echo "A"
git --version
echo "B"
git status schema
echo "C"
git status schema | grep schema/migration
echo "D"
git status schema | grep schema/migration > /tmp/schema.diff
echo "E"
echo "*************************************************************"
cat /tmp/schema.diff
echo "*************************************************************"
line_count="$(wc -l < /tmp/schema.diff)"
if test ${line_count} -ne 0 ; then
echo "Schema diff"
cat /tmp/schema.diff
exit 1
fi