-
Notifications
You must be signed in to change notification settings - Fork 6
70 lines (68 loc) · 2.02 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
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
name: CI
on: push
jobs:
linting:
runs-on: ubuntu-latest
name: Linting of Ruby files
steps:
- uses: actions/checkout@v4
- name: Install Ruby, Bundler and gems
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
bundler-cache: true
- run: bundle exec standardrb
tests:
runs-on: ubuntu-latest
name: Test ${{ matrix.gemfile }} with Ruby ${{ matrix.ruby-version }}
strategy:
fail-fast: false
matrix:
ruby-version:
- "3.1"
- "3.2"
- "3.3"
- "3.4"
gemfile:
- rails6.1_mysql2
- rails6.1_trilogy
- rails7.0_mysql2
- rails7.0_trilogy
- rails7.1_mysql2
- rails7.1_trilogy
- rails7.2_mysql2
- rails7.2_trilogy
include:
- {ruby-version: "3.4", gemfile: "rails_main_mysql2"}
- {ruby-version: "3.4", gemfile: "rails_main_trilogy"}
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
MYSQL_URL: 'mysql://root:[email protected]:3306'
steps:
- name: Start MySQL service
run: sudo systemctl start mysql.service
- uses: actions/checkout@v4
- name: Install Ruby, Bundler and gems
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Check MySQL service health
run: mysql -uroot -Proot -e 'show databases'
- name: Create user 'john-doe' in MySQL
run: mysql --host 127.0.0.1 --port 3306 -uroot -Proot -e "CREATE USER 'john-doe'; GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX ON *.* TO 'john-doe'; FLUSH PRIVILEGES;"
- run: bundle exec rake test
tests_successful:
name: Tests passing?
needs: tests
if: always()
runs-on: ubuntu-latest
steps:
- run: |
if ${{ needs.tests.result == 'success' }}
then
echo "All tests passed"
else
echo "Some tests failed"
false
fi