-
Notifications
You must be signed in to change notification settings - Fork 16
97 lines (80 loc) · 3.71 KB
/
smoke.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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