-
Notifications
You must be signed in to change notification settings - Fork 7
120 lines (105 loc) · 2.76 KB
/
tests.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Tests
on:
- push
- pull_request
jobs:
rspec:
name: >-
${{ matrix.allow-failures && '~' }}
${{ matrix.ruby }};
${{ matrix.gemfile }};
${{ matrix.backend }}
runs-on: ubuntu-latest
continue-on-error: ${{ !! matrix.allow-failures }}
strategy:
fail-fast: false
matrix:
ruby:
- 2.7
- 2.6
- 2.5
- 2.4
- jruby
gemfile:
- Rails-5_2
- Rails-5_1
- Rails-5_0
backend:
- sqlite3
- mysql
- postgresql
include:
# Allow test failures for some configurations
- ruby: jruby
allow-failures: true
env:
# For Bundler control variables, refer to:
# https://bundler.io/v1.17/bundle_config.html
BUNDLE_GEMFILE: ${{ format('gemfiles/{0}.gemfile', matrix.gemfile) }}
steps:
- uses: actions/checkout@v2
- name: Install APT packages
run: sudo apt-get install -y libsqlite3-dev
- name: Use Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install gems
run: |
gem install bundler
bundle install --jobs 4 --retry 3
- name: Write database configuration
run: |
cat <<EOF > spec/support/database.yml
sqlite3:
adapter: sqlite3
database: ":memory:"
postgresql:
adapter: postgresql
host: localhost
username: postgres
password: verysecret
database: activeid_test
mysql:
adapter: mysql2
host: 127.0.0.1
port: 3306
username: root
password: verysecret
database: activeid_test
encoding: utf8mb4
EOF
- name: Run tests (with monkey patches)
run: bundle exec rspec
env:
DB: ${{ matrix.backend }}
- name: Run tests (without monkey patches)
run: bundle exec rspec
env:
DB: ${{ matrix.backend }}
NO_PATCHES: 1
services:
mariadb:
image: mariadb:latest
env:
MYSQL_ROOT_PASSWORD: verysecret
MYSQL_DATABASE: activeid_test
options: >-
--health-cmd="mysqladmin ping"
--health-interval=7s
--health-timeout=5s
--health-retries=10
ports:
- 3306:3306
postgresql:
image: postgres:latest
env:
POSTGRES_DB: activeid_test
POSTGRES_PASSWORD: verysecret
options: >-
--health-cmd="pg_isready"
--health-interval=7s
--health-timeout=5s
--health-retries=10
ports:
- 5432:5432