-
Notifications
You must be signed in to change notification settings - Fork 21.3k
/
ci.yml.tt
105 lines (90 loc) · 2.8 KB
/
ci.yml.tt
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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
<%- unless skip_brakeman? -%>
scan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Scan for security vulnerabilities
run: bin/brakeman
<% end -%>
<%- unless skip_rubocop? -%>
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Lint code for consistent style
run: bin/rubocop
<% end -%>
test:
runs-on: ubuntu-latest
<%- if options[:database] == "sqlite3" -%>
# services:
# redis:
# image: redis
# ports:
# - 6379:6379
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
<%- else -%>
services:
<%- if options[:database] == "mysql" || options[:database] == "trilogy" -%>
mysql:
image: mysql
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
<%- elsif options[:database] == "postgresql" -%>
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
<%- end -%>
# redis:
# image: redis
# ports:
# - 6379:6379
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
<%- end -%>
steps:
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable <%= (dockerfile_deploy_packages + [build_package_for_database]).join(" ") %>
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Run tests
env:
RAILS_ENV: test
<%- if options[:database] == "mysql" || options[:database] == "trilogy" -%>
DATABASE_URL: mysql2://127.0.0.1:3306
<%- elsif options[:database] == "postgresql" -%>
DATABASE_URL: postgres://postgres:postgres@localhost:5432
<%- end -%>
# REDIS_URL: redis://localhost:6379/0
run: bin/rails db:setup test test:system