change register repository calls to use one call per repo #1476
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This test verifies that the docker-compose.yml file is valid and that the | |
# containers can be started and stopped. It also verifies the database migrations. | |
name: Compose Migrate test | |
on: | |
workflow_call: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
docker: | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: 'go.mod' | |
- name: Install ko | |
uses: ko-build/setup-ko@v0.6 | |
- name: Start containers | |
run: KO_DOCKER_REPO=ko.local make run-docker services="postgres migrate" | |
- name: Wait for the migrations to complete | |
timeout-minutes: 1 | |
run: | | |
set -e | |
while [ "$(docker logs minder_migrate_1 | grep 'Database migration completed successfully')" = "" ]; do | |
sleep 1 | |
done | |
- name: Check that the database contains the tables found in the migrations folder | |
run: | | |
set -e | |
tables=$(grep -Ri 'CREATE TABLE' database/migrations | sed -E 's/.*CREATE TABLE (IF NOT EXISTS )?(.*) \(/\2/i') | |
for table in $tables; do | |
docker exec $(docker ps -a | grep postgres | awk '{print $1}') psql -U postgres -d mediator -c "SELECT * FROM $table" | |
done | |