-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (80 loc) · 2.42 KB
/
main.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
name: CI
'on':
- push
jobs:
code_checks:
runs-on: ubuntu-20.04
services:
db:
image: mysql:5.7
ports:
- 3307:3307
env:
MYSQL_DATABASE: 'db'
MYSQL_USER: 'user'
MYSQL_PASSWORD: 'password'
MYSQL_ROOT_PASSWORD: 'password'
MYSQL_TCP_PORT: 3307
options: >-
--init-file /.github/GH-mysql-init.sql
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Show databases for root user
run: mysql --protocol=tcp -h 127.0.0.1 -P 3307 -u root -proot_password -e "SHOW DATABASES"
- name: Show databases for rails_user
run: mysql --protocol=tcp -h 127.0.0.1 -P 3307 -u rails_user -ppassword -e "SHOW DATABASES"
- uses: actions/setup-node@v1
with:
node-version: 20.x
registry-url: 'https://registry.npmjs.org'
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec rake
# - name: Gem cache
# id: cache-bundle
# uses: actions/cache@v1
# with:
# path: vendor/bundle
# key: 'bundle-${{ hashFiles(''**/Gemfile.lock'') }}'
# - name: Bundle install
# env:
# RAILS_ENV: test
# run: |
# gem install bundler
# bundle install --jobs 4 --retry 3 --path vendor/bundle
- name: Install yarn
run: npm install -g yarn
- name: Get yarn cache dir
id: yarn-cache-dir
run: 'echo "::set-output name=dir::$(yarn cache dir)"'
- name: Yarn cache
id: cache-yarn
uses: actions/cache@v1
with:
path: '${{ steps.yarn-cache-dir.outputs.dir }}'
key: 'yarn-${{ hashFiles(''**/yarn.lock'') }}'
- name: Yarn install
run: yarn install
- name: 'Setup DB, Run tests'
env:
RAILS_ENV: test
run: bundle exec rails db:create db:schema:load
- name: Audit
env:
RAILS_ENV: test
run: bundle exec rake audit
- name: Rubocop
env:
RAILS_ENV: test
run: bundle exec rubocop
- name: RSpec
env:
RAILS_ENV: test
run: bundle exec rspec