-
Notifications
You must be signed in to change notification settings - Fork 123
94 lines (85 loc) · 2.76 KB
/
ruby.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
name: Ruby
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby_version:
- '2.6'
- '3.0'
db:
- active_record:sqlite3
- active_record:mysql2
- active_record:postgresql
- mongoid:mongodb
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: ci_rails_admin
ports:
- 3306:3306
# needed because the mysql container does not provide a healthcheck
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
mongodb:
image: mongo:4.2
ports:
- 27017:27017
postgres:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ci_rails_admin
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
- uses: actions/cache@v2
with:
path: ~/vendor/bundle
key: ${{ matrix.ruby_version}}-${{ matrix.db }}-gems-${{ hashFiles('**/Gemfile', '**/Gemfile.lock') }}
restore-keys: |
${{ matrix.ruby_version}}-${{ matrix.db }}-gems-
- name: Set up ORM and DB adapter
id: setup-orm
run: |
orm=$(echo ${{ matrix.db }} | cut -f1 -d:)
db_adapter=$(echo ${{ matrix.db }} | cut -f2 -d:)
echo "::set-output name=orm::$orm"
echo "::set-output name=db_adapter::$db_adapter"
- name: Install dependencies
run: |
bundle config path ~/vendor/bundle
gem install bundler -v 2.2.19
bundle install --jobs 4 --retry 3
pushd spec/dummy_app
bundle config path ~/vendor/bundle
bundle install --jobs 4 --retry 3
# Piggyback of the Rails Admin CI rake task
bundle exec rake rails_admin:prepare_ci_env
bundle exec rake db:create db:migrate
popd
env:
RAILS_ENV: test
CI_ORM: ${{ steps.setup-orm.outputs.orm }}
CI_DB_ADAPTER: ${{ steps.setup-orm.outputs.db_adapter }}
- name: Run tests
run: bundle exec rake test
env:
RAILS_ENV: test
CI_ORM: ${{ steps.setup-orm.outputs.orm }}
CI_DB_ADAPTER: ${{ steps.setup-orm.outputs.db_adapter }}