Use db user when adding tables to replication #258
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
name: Smoke spec | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v**" | |
pull_request: | |
concurrency: | |
group: branch-smoke-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
smoke-spec: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
name: Ruby ${{ matrix.ruby }} - PG ${{ matrix.pg.from }} -> PG ${{ matrix.pg.to }} | |
strategy: | |
matrix: | |
ruby: ["3.0.5", "3.1.4", "3.2.1"] | |
pg: | |
[ | |
{ from: 10, to: 11 }, | |
{ from: 11, to: 12 }, | |
{ from: 12, to: 13 }, | |
{ from: 13, to: 14 }, | |
{ from: 14, to: 15 }, | |
{ from: 10, to: 15 }, | |
{ from: 12, to: 15 }, | |
] | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
bundler-cache: true | |
- name: Bundle install | |
env: | |
RAILS_ENV: test | |
run: | | |
gem install bundler | |
bundle install --jobs 4 --retry 3 --path vendor/bundle | |
- name: Run Lint | |
run: bundle exec rubocop | |
# - name: Setup upterm session | |
# uses: lhotari/action-upterm@v1 | |
- name: "Setug PG databases" | |
run: | | |
set -euvxo pipefail | |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null | |
sudo apt-get update | |
sudo apt-get install --yes --no-install-recommends postgresql-${{ matrix.pg.from }} postgresql-client-${{ matrix.pg.from }} | |
sudo apt-get install --yes --no-install-recommends postgresql-${{ matrix.pg.to }} postgresql-client-${{ matrix.pg.to }} | |
sudo systemctl restart postgresql@${{ matrix.pg.from }}-main.service | |
sudo systemctl restart postgresql@${{ matrix.pg.to }}-main.service | |
sudo systemctl restart postgresql | |
# Escape the quote because we are setting the password in PG | |
# String: james-bond123@7!''3aaR | |
export PGPASSWORD='james-bond123@7!'"'"''"'"'3aaR' | |
sudo su - postgres -c "createuser -p 5432 -d -s -e -l james-bond" | |
sudo -u postgres psql -p 5432 -c 'alter user "james-bond" with encrypted password '"'"''"$PGPASSWORD"''"'"';' | |
sudo su - postgres -c "createdb -p 5432 postgres-db" | |
sudo -u postgres psql -p 5432 -c "grant all privileges on database \"postgres-db\" to \"james-bond\";" | |
sudo su - postgres -c "createuser -p 5433 -d -s -e -l james-bond" | |
sudo -u postgres psql -p 5433 -c 'alter user "james-bond" with encrypted password '"'"''"$PGPASSWORD"''"'"';' | |
sudo su - postgres -c "createdb -p 5433 postgres-db" | |
sudo -u postgres psql -p 5433 -c "grant all privileges on database \"postgres-db\" to \"james-bond\";" | |
# Remove the escaped quote since we are passing the pwd to psql | |
# String: james-bond123@7!'3aaR | |
export PGPASSWORD='james-bond123@7!'"'"'3aaR' | |
psql -h localhost -d postgres-db -U james-bond -p 5432 -c 'ALTER SYSTEM SET wal_level = logical;' | |
psql -h localhost -d postgres-db -U james-bond -p 5433 -c 'ALTER SYSTEM SET wal_level = logical;' | |
sudo systemctl restart postgresql@${{ matrix.pg.from }}-main.service | |
sudo systemctl restart postgresql@${{ matrix.pg.to }}-main.service | |
sudo systemctl restart postgresql | |
psql -h localhost -d postgres-db -U james-bond -p 5432 -c 'show wal_level;' | |
psql -h localhost -d postgres-db -U james-bond -p 5433 -c 'show wal_level;' | |
- name: Run RSpec | |
run: bundle exec rspec spec/smoke_spec.rb |