forked from rails-on-services/apartment
-
Notifications
You must be signed in to change notification settings - Fork 4
100 lines (99 loc) · 3.12 KB
/
rspec_pg_16.yml
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
98
99
100
name: RSpec PostgreSQL 16
on:
push:
branches:
- development
- main
pull_request:
types: [opened, synchronize, reopened]
release:
types: [published]
jobs:
test:
name: ${{ github.workflow }}, Ruby ${{ matrix.ruby_version }}, Rails ${{ matrix.rails_version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby_version:
- 3.1
- 3.2
- 3.3
- jruby
rails_version:
- 6_1
- 7_0
- 7_1
- 7_2
# - master # versions failing
exclude:
- ruby_version: jruby
rails_version: 7_1
- ruby_version: jruby
rails_version: 7_2
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.rails_version }}${{ matrix.ruby_version == 'jruby' && '_jdbc' || '' }}_postgresql.gemfile
CI: true
DATABASE_ENGINE: postgresql
RUBY_VERSION: ${{ matrix.ruby_version }}
RAILS_VERSION: ${{ matrix.rails_version }}
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: apartment_postgresql_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Install PostgreSQL client
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends postgresql-common
echo | sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends postgresql-client-16
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- name: Configure config database.yml
run: bundle exec rake db:load_credentials
- name: Database Setup
run: bundle exec rake db:test:prepare
- name: Run tests
id: rspec-tests
timeout-minutes: 20
continue-on-error: true
run: |
mkdir -p ./coverage
bundle exec rspec --format progress \
--format RspecJunitFormatter -o ./coverage/test-results.xml \
--profile
- name: Codecov Upload
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
disable_search: true
env_vars: DATABASE_ENGINE, RUBY_VERSION, RAILS_VERSION
file: ./coverage/coverage.json
- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
disable_search: true
env_vars: DATABASE_ENGINE, RUBY_VERSION, RAILS_VERSION
file: ./coverage/test-results.xml
- name: Notify of test failure
if: steps.rspec-tests.outcome == 'failure'
run: exit 1