Repository navigation
114 lines (112 loc) · 3.62 KB
/
Copy pathmain.yml
File metadata and controls
114 lines (112 loc) · 3.62 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: "Main"
on:
push:
branches:
- master
paths:
- 'lib/**'
- 'spec/**'
- '.github/workflows/main.yml'
pull_request:
jobs:
rspec:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ["2.4", "2.5", "2.6", "2.7", "3.2", "3.3"]
rails_version: [5, 6, 7, 8]
db: [pg, mysql2, sqlite3]
exclude:
- rails_version: 6
ruby: "2.4"
# Rails 5 and 6 lockfiles predate Ruby 3
- rails_version: 5
ruby: "3.2"
- rails_version: 5
ruby: "3.3"
- rails_version: 6
ruby: "3.2"
- rails_version: 6
ruby: "3.3"
# Rails 7.2+ requires Ruby 3.1+, Rails 8 requires Ruby 3.2+
- rails_version: 7
ruby: "2.4"
- rails_version: 7
ruby: "2.5"
- rails_version: 7
ruby: "2.6"
- rails_version: 7
ruby: "2.7"
- rails_version: 8
ruby: "2.4"
- rails_version: 8
ruby: "2.5"
- rails_version: 8
ruby: "2.6"
- rails_version: 8
ruby: "2.7"
env:
APPRAISAL_NAME: rails-${{ matrix.rails_version }}-${{ matrix.db }}
BUNDLE_GEMFILE: ${{ format('./gemfiles/rails_{0}_{1}.gemfile', matrix.rails_version, matrix.db) }}
DB_NAME: wrapped_transaction_test
PG_USER: test
PG_PASS: test
MYSQL_USER: root
MYSQL_PASS: root
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: "Install postgresql client"
if: ${{ matrix.db == 'pg' }}
run: |
sudo apt-get update --fix-missing
sudo apt-get -yqq install libpq-dev
- name: "Set up PG"
uses: harmon758/postgresql-action@v1
if: ${{ matrix.db == 'pg' }}
with:
postgresql version: '11'
postgresql db: ${{ env.DB_NAME }}
postgresql user: ${{ env.PG_USER }}
postgresql password: ${{ env.PG_PASS }}
- name: "Set PG DATABASE_URL"
if: ${{ matrix.db == 'pg' }}
run: |
echo "DATABASE_URL=postgres://${PG_USER}:${PG_PASS}@localhost/${DB_NAME}" >> "$GITHUB_ENV"
- name: "Shut down default MySQL database"
if: ${{ matrix.db == 'mysql2' }}
run: |
sudo systemctl stop mysql.service
- name: "Set Up MySQL"
if: ${{ matrix.db == 'mysql2' }}
uses: mirromutth/mysql-action@v1.1
with:
mysql database: ${{ env.DB_NAME }}
mysql root password: ${{ env.MYSQL_PASS }}
- name: "Set MySQL DATABASE_URL"
if: ${{ matrix.db == 'mysql2' }}
run: |
echo "DATABASE_URL=mysql2://${MYSQL_USER}:${MYSQL_PASS}@127.0.0.1/${DB_NAME}" >> "$GITHUB_ENV"
- name: "Install sqlite3"
if: ${{ matrix.db == 'sqlite3' }}
run: |
sudo apt-get update --fix-missing
sudo apt-get -yqq install sqlite3 libsqlite3-dev
echo "DATABASE_URL=sqlite3::memory:" >> "$GITHUB_ENV"
- uses: actions/cache@v4
with:
path: vendor/bundle
key: bundle-use-ruby-ubuntu-latest-${{ matrix.ruby }}-${{ env.APPRAISAL_NAME }}-${{ hashFiles(format('{0}.lock', env.BUNDLE_GEMFILE)) }}
restore-keys: |
bundle-use-ruby-ubuntu-latest-${{ matrix.ruby }}-${{ env.APPRAISAL_NAME }}
- name: bundle install
run: |
bundle config deployment true
bundle config path vendor/bundle
bundle install --jobs 4
- name: "Run RSpec"
run: |
bin/rspec