Skip to content

Commit 27cd3b2

Browse files
committed
CI: Add test to ensure schema migrations are complete
1 parent 8981a96 commit 27cd3b2

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

Diff for: .github/workflows/haskell.yml

+23-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- name: Install Postgres support (macOS)
4141
if: matrix.os == 'macos-latest'
4242
run: |
43-
brew install postgresql@14 libpq [email protected]
43+
brew install postgresql@14 libpq [email protected] pkg-config
4444
brew services start postgresql
4545
sudo mkdir -p /var/run/postgresql/
4646
sudo ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
@@ -71,7 +71,7 @@ jobs:
7171
if: matrix.os == 'ubuntu-latest'
7272
run: |
7373
sudo apt-get update
74-
sudo apt-get -y install libsodium23 libsodium-dev libsystemd0 libsystemd-dev
74+
sudo apt-get -y install libsodium23 libsodium-dev libsystemd0 libsystemd-dev git
7575
sudo apt-get -y remove --purge software-properties-common
7676
sudo apt-get -y autoremove
7777
@@ -107,7 +107,7 @@ jobs:
107107
- uses: actions/cache@v3
108108
name: Cache cabal store
109109
with:
110-
path: |
110+
path: |
111111
${{ steps.setup-haskell.outputs.cabal-store }}
112112
dist-newstyle
113113
key: cache-cabal-store-v1-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
@@ -144,3 +144,23 @@ jobs:
144144
145145
- name: Run tests
146146
run: cabal test all -j1
147+
148+
- name: Check that Schema Migrations are complete
149+
run: |
150+
PGPASSFILE=config/pgpass-mainnet cabal run cardano-db-tool -- run-migrations --mdir schema/ --ldir /tmp/
151+
echo "A"
152+
git --version
153+
echo "B"
154+
git status schema
155+
echo "C"
156+
git status schema | grep schema/migration > /tmp/schema.diff
157+
echo "D"
158+
echo "*************************************************************"
159+
cat /tmp/schema.diff
160+
echo "*************************************************************"
161+
line_count="$(wc -l < /tmp/schema.diff)"
162+
if test ${line_count} -ne 0 ; then
163+
echo "Schema diff"
164+
cat /tmp/schema.diff
165+
exit 1
166+
fi

0 commit comments

Comments
 (0)