Reuse code to wait for Postgres to be active
Some checks failed
Add copyright notice / copyright_notice (pull_request) Successful in 2m23s
Check usage of free licenses / check-licenses (pull_request) Successful in 1m7s
Run unit tests / rubocop (pull_request) Successful in 3m3s
Build Nginx-based docker image / build-static-assets (pull_request) Successful in 50m52s
Run unit tests / unit_tests (pull_request) Successful in 6m1s
Run unit tests / reversible_migrations (pull_request) Failing after 3m20s

This commit is contained in:
Manuel Bustillo 2025-01-23 22:21:46 +01:00
parent f681f8d2f9
commit db55bafea1

View File

@ -24,7 +24,8 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- uses: ruby/setup-ruby@v1.207.0 - uses: ruby/setup-ruby@v1.207.0
- run: bundle install - run: bundle install
- name: Wait until Postgres is ready to accept connections - &postgres_wait
name: Wait until Postgres is ready to accept connections
run: | run: |
apt-get update && apt-get install -f -y postgresql-client apt-get update && apt-get install -f -y postgresql-client
until pg_isready -h postgres -U postgres -d postgres until pg_isready -h postgres -U postgres -d postgres
@ -59,13 +60,6 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- uses: ruby/setup-ruby@v1.207.0 - uses: ruby/setup-ruby@v1.207.0
- run: bundle install - run: bundle install
- name: Wait until Postgres is ready to accept connections - *postgres_wait
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
- run: bundle exec rake db:schema:load - run: bundle exec rake db:schema:load
- run: bundle exec rake db:migrate:redo - run: bundle exec rake db:migrate:redo