From db55bafea120464812ec804ec328b1cb7f28ff2e Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Thu, 23 Jan 2025 22:21:46 +0100 Subject: [PATCH] Reuse code to wait for Postgres to be active --- .gitea/workflows/tests.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index 5aaaff8..7be8b5d 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -24,7 +24,8 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - uses: ruby/setup-ruby@v1.207.0 - run: bundle install - - name: Wait until Postgres is ready to accept connections + - &postgres_wait + name: Wait until Postgres is ready to accept connections run: | apt-get update && apt-get install -f -y postgresql-client until pg_isready -h postgres -U postgres -d postgres @@ -59,13 +60,6 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - uses: ruby/setup-ruby@v1.207.0 - run: bundle install - - name: Wait until Postgres is ready to accept connections - run: | - apt-get update && apt-get install -f -y postgresql-client - until pg_isready -h postgres -U postgres -d postgres - do - sleep 1 - echo "Trying again" - done + - *postgres_wait - run: bundle exec rake db:schema:load - run: bundle exec rake db:migrate:redo \ No newline at end of file