diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c3d7dc3..0fec2f7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,6 +33,25 @@ test_unit: script: - npm run test:unit +test_db: + needs: [deps, check_types, check_style] + dependencies: [deps] + script: <<-SUPABASE_DB_SCRIPT + npx supabase db diff -f dummy_migration + git add -N supabase/migrations + if ! git diff --exit-code --quiet supabase/migrations; then + echo "Supabase migrations and schema are not in sync. See diff below:" + git diff supabase/migrations + exit 1 + fi + + npx supabase db start + npx supabase db reset + npx supabase db lint + SUPABASE_DB_SCRIPT + after_script: + - npx supabase db stop + # test_e2e: # needs: [deps, check_types, check_style] # dependencies: [deps] @@ -42,7 +61,7 @@ test_unit: # - npm run test:e2e build: - needs: [deps, check_types, check_style, test_unit] + needs: [deps, check_types, check_style, test_unit, test_db] dependencies: [deps] script: - npm run build @@ -67,6 +86,7 @@ deploy_app: - scp -i /tmp/drp.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null package.json debian@drp-host.pub.home.local.koval.net:/home/debian/app/package.json - scp -i /tmp/drp.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null package-lock.json debian@drp-host.pub.home.local.koval.net:/home/debian/app/package-lock.json - ssh -i /tmp/drp.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null debian@drp-host.pub.home.local.koval.net -C "cd /home/debian/app && docker compose down && docker compose up -d" + - npx supabase db push environment: name: production url: https://drp.koval.net