-
-
Notifications
You must be signed in to change notification settings - Fork 14
135 lines (119 loc) · 4.65 KB
/
run_tests.yml
File metadata and controls
135 lines (119 loc) · 4.65 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Test supported versions
# Need the quotes, otherwise YAML.load, which we uses to generate run_tests_on_head.yml will interpret this
# as the boolean `true`...
'on':
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 10 1-7 * 6'
workflow_dispatch:
branches: [ master ]
env:
PGUSER: postgres
PGPASSWORD: postgres
MYSQL_USER: root
MYSQL_PASSWORD: root
# This set to false for run_tests_on_head by the rakefile
CACHE_DEPENDENCIES: 'true'
# Dumb workaround since it's not possible to clear caches in Github Actions
CACHE_VERSION: '3'
jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- gemfile: gemfiles/rails_8_1.gemfile
ruby_version: '4.0'
- gemfile: gemfiles/rails_8_1.gemfile
ruby_version: '3.4'
- gemfile: gemfiles/rails_8_1.gemfile
ruby_version: '3.2'
- gemfile: gemfiles/rails_8_0.gemfile
ruby_version: '3.4'
- gemfile: gemfiles/rails_8_0.gemfile
ruby_version: '3.2'
- gemfile: gemfiles/rails_7_2.gemfile
ruby_version: '3.3'
- gemfile: gemfiles/rails_7_2.gemfile
ruby_version: '3.1'
- gemfile: gemfiles/rails_7_1.gemfile
ruby_version: '3.2'
- gemfile: gemfiles/rails_7_1.gemfile
ruby_version: 2.7
- gemfile: gemfiles/rails_7_0.gemfile
ruby_version: '3.1'
- gemfile: gemfiles/rails_7_0.gemfile
ruby_version: 2.7
- gemfile: gemfiles/rails_6_1.gemfile
ruby_version: '3.0'
- gemfile: gemfiles/rails_6_1.gemfile
ruby_version: 2.5
- gemfile: gemfiles/rails_6_0.gemfile
ruby_version: 2.7
- gemfile: gemfiles/rails_6_0.gemfile
ruby_version: 2.5
- gemfile: gemfiles/rails_5_2.gemfile
ruby_version: 2.6
- gemfile: gemfiles/rails_5_2.gemfile
ruby_version: 2.3
- gemfile: gemfiles/rails_5_1.gemfile
ruby_version: 2.5
- gemfile: gemfiles/rails_5_1.gemfile
ruby_version: 2.3
- gemfile: gemfiles/rails_5_0.gemfile
ruby_version: 2.4
- gemfile: gemfiles/rails_5_0.gemfile
ruby_version: 2.3
- gemfile: gemfiles/rails_4_2.gemfile
ruby_version: 2.4
- gemfile: gemfiles/rails_4_2.gemfile
ruby_version: 2.1
- gemfile: gemfiles/rails_4_1.gemfile
ruby_version: 2.3
- gemfile: gemfiles/rails_4_1.gemfile
ruby_version: 2.1
runs-on: ubuntu-latest
services:
db:
image: postgres:11
ports: ['5432:5432']
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_USER: ${{env.PGUSER}}
POSTGRES_PASSWORD: ${{env.PGUSER}}
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
BUNDLE_PATH: vendor/bundle
steps:
- uses: actions/checkout@v2
- run: sudo service mysql start
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
- uses: actions/cache@v4
if: ${{ env.CACHE_DEPENDENCIES == 'true' }}
with:
# The path given to bundler is used relatively to the directory of the gemfile
# I keep the different gemfiles in the 'gemfiles' directory, so the path to cache is also there.
path: gemfiles/vendor/bundle
key: ResetCaches1-${{ runner.os }}-gems-${{ env.CACHE_VERSION }}-ruby${{ matrix.ruby_version }}-${{ matrix.gemfile }}-${{ hashFiles(matrix.gemfile) }}-${{ hashFiles('activerecord_where_assoc.gemspec') }}
restore-keys: ResetCaches1-${{ runner.os }}-gems-${{ env.CACHE_VERSION }}-ruby${{ matrix.ruby_version }}-${{ matrix.gemfile }}
- name: Install dependencies
run: bundle install --jobs 4 --retry 3
- run: psql --host=localhost --port=5432 -c 'CREATE DATABASE activerecord_where_assoc'
- run: mysql -h 127.0.0.1 -u "${{ env.MYSQL_USER }}" -p${{ env.MYSQL_PASSWORD }} -e 'CREATE DATABASE activerecord_where_assoc'
- run: DB=sqlite3 bundle exec rake test
- run: DB=pg bundle exec rake test
# PG build segfaults on older ruby version, no idea why and painful to debug, so just skip them.
if: ${{ matrix.ruby_version >= 2.4 || matrix.ruby_version == 'head' }}
- run: DB=mysql bundle exec rake test
# MySQL build segfaults on older ruby version, no idea why and painful to debug, so just skip them.
if: ${{ matrix.ruby_version >= 2.4 || matrix.ruby_version == 'head' }}