Skip to content

Bump rubocop from 1.81.6 to 1.81.7 #576

Bump rubocop from 1.81.6 to 1.81.7

Bump rubocop from 1.81.6 to 1.81.7 #576

Workflow file for this run

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 13 -> PG 14
strategy:
matrix:
ruby: ["3.4.4", "3.3.6", "3.2.1", "3.1.4"]
pg:
[
{ from: 11, to: 12 },
{ from: 12, to: 13 },
{ from: 13, to: 14 },
{ from: 14, to: 15 },
{ from: 11, to: 16 },
{ from: 15, to: 16 },
{ from: 16, to: 17 }
]
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 }}
# Stop existing services first to free up ports
echo "Attempting to stop existing PostgreSQL services..."
sudo systemctl stop postgresql@${{ matrix.pg.from }}-main.service || echo "Failed to stop ${{ matrix.pg.from }}-main, or already stopped."
sudo systemctl stop postgresql@${{ matrix.pg.to }}-main.service || echo "Failed to stop ${{ matrix.pg.to }}-main, or already stopped."
sudo systemctl stop postgresql.service || echo "Failed to stop generic postgresql.service, or already stopped."
sleep 2 # Give a moment for ports to free up
echo "Dropping existing clusters (if any)..."
sudo pg_dropcluster --stop ${{ matrix.pg.from }} main || echo "Cluster ${{ matrix.pg.from }}/main not found or already dropped."
sudo pg_dropcluster --stop ${{ matrix.pg.to }} main || echo "Cluster ${{ matrix.pg.to }}/main not found or already dropped."
sleep 2 # Ensure drop completes
echo "Creating cluster ${{ matrix.pg.from }}/main on port 5432..."
sudo pg_createcluster --start --port 5432 ${{ matrix.pg.from }} main
echo "Creating cluster ${{ matrix.pg.to }}/main on port 5433..."
sudo pg_createcluster --start --port 5433 ${{ matrix.pg.to }} main
echo "Ensuring services are managed by systemd..."
sudo systemctl restart postgresql@${{ matrix.pg.from }}-main.service
sudo systemctl restart postgresql@${{ matrix.pg.to }}-main.service
echo "Optimizing source DB instance (port 5432) for maintenance tasks..."
sudo -u postgres psql -p 5432 -d postgres -c "ALTER SYSTEM SET maintenance_work_mem = '256MB';"
sudo -u postgres psql -p 5432 -d postgres -c "ALTER SYSTEM SET synchronous_commit = 'on';"
sudo -u postgres psql -p 5432 -d postgres -c "ALTER SYSTEM SET fsync = 'on';"
sudo -u postgres psql -p 5432 -d postgres -c "ALTER SYSTEM SET commit_delay = 0;"
sudo -u postgres psql -p 5432 -d postgres -c "SELECT pg_reload_conf();"
echo "Optimizing target DB instance (port 5433) for maintenance tasks..."
sudo -u postgres psql -p 5433 -d postgres -c "ALTER SYSTEM SET maintenance_work_mem = '256MB';"
sudo -u postgres psql -p 5433 -d postgres -c "ALTER SYSTEM SET synchronous_commit = 'on';"
sudo -u postgres psql -p 5433 -d postgres -c "ALTER SYSTEM SET fsync = 'on';"
sudo -u postgres psql -p 5433 -d postgres -c "ALTER SYSTEM SET commit_delay = 0;"
sudo -u postgres psql -p 5433 -d postgres -c "SELECT pg_reload_conf();"
# 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
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;'
echo "=== PostgreSQL Configuration Check ==="
echo "Source DB (5432) settings:"
psql -h localhost -d postgres-db -U james-bond -p 5432 -c 'show synchronous_commit;'
psql -h localhost -d postgres-db -U james-bond -p 5432 -c 'show fsync;'
psql -h localhost -d postgres-db -U james-bond -p 5432 -c 'show commit_delay;'
echo "Target DB (5433) settings:"
psql -h localhost -d postgres-db -U james-bond -p 5433 -c 'show synchronous_commit;'
psql -h localhost -d postgres-db -U james-bond -p 5433 -c 'show fsync;'
psql -h localhost -d postgres-db -U james-bond -p 5433 -c 'show commit_delay;'
echo "=== End Configuration Check ==="
- name: Run RSpec
env:
PG_EASY_REPLICATE_STATEMENT_TIMEOUT: "30s"
run: bundle exec rspec spec/smoke_spec.rb