forked from trilogy-libraries/activerecord-trilogy-adapter
-
Notifications
You must be signed in to change notification settings - Fork 2
40 lines (38 loc) · 1.42 KB
/
ci.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
name: CI
on: [push, pull_request]
jobs:
test:
strategy:
matrix:
rails_version:
- "~>6.0.0"
- "~>6.1.0"
- "~>7.0.0"
ruby_version:
- '3.0'
- '3.1'
- '3.2'
fail-fast: false
runs-on: ubuntu-latest
name: Test on Rails ${{ matrix.rails_version }} with Ruby ${{ matrix.ruby_version }}
env:
RAILS_VERSION: ${{ matrix.rails_version }}
DB_HOST: 127.0.0.1
DB_PORT: 3306
steps:
- uses: actions/checkout@v3
- name: Cache .gem files
uses: actions/cache@v3
with:
key: gems-${{ matrix.rails_version }}-${{ hashFiles('Gemfile', '*.gemspec') }}
path: vendor/cache
- name: Start mysql
run: docker run -d --rm --name=mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -p 3306:3306 --health-interval=1s --health-timeout=5s --health-retries=5 --volume="$(pwd)"/script/setup.sql:/docker-entrypoint-initdb.d/setup.sql --health-cmd='mysql trilogy_test -e "select * from posts"' mysql:5.7 --sql_mode=NO_ENGINE_SUBSTITUTION --log-bin --server-id=1 --gtid-mode=ON --enforce-gtid-consistency=ON
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- name: Wait for mysql
run: timeout -v '1m' bash -c 'until [ "`docker inspect -f {{.State.Health.Status}} mysql `" == "healthy" ]; do sleep 0.5; done'
- name: Run tests
run: bundle exec rake