Skip to content

Commit fc87679

Browse files
authored
Create rubyonrails.yml
1 parent 86981ce commit fc87679

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/rubyonrails.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This workflow uses actions that are not certified by GitHub. They are
2+
# provided by a third-party and are governed by separate terms of service,
3+
# privacy policy, and support documentation.
4+
#
5+
# This workflow will install a prebuilt Ruby version, install dependencies, and
6+
# run tests and linters.
7+
name: "Ruby on Rails CI"
8+
on:
9+
push:
10+
branches: [ "master" ]
11+
pull_request:
12+
branches: [ "master" ]
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
services:
17+
postgres:
18+
image: postgres:11-alpine
19+
ports:
20+
- "5432:5432"
21+
env:
22+
POSTGRES_DB: rails_test
23+
POSTGRES_USER: rails
24+
POSTGRES_PASSWORD: password
25+
env:
26+
RAILS_ENV: test
27+
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test"
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
# Add or replace dependency steps here
32+
- name: Install Ruby and gems
33+
uses: ruby/setup-ruby@78c01b705fd9d5ad960d432d3a0cfa341d50e410 # v1.179.1
34+
with:
35+
bundler-cache: true
36+
# Add or replace database setup steps here
37+
- name: Set up database schema
38+
run: bin/rails db:schema:load
39+
# Add or replace test runners here
40+
- name: Run tests
41+
run: bin/rake
42+
43+
lint:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Checkout code
47+
uses: actions/checkout@v4
48+
- name: Install Ruby and gems
49+
uses: ruby/setup-ruby@78c01b705fd9d5ad960d432d3a0cfa341d50e410 # v1.179.1
50+
with:
51+
bundler-cache: true
52+
- name: Generate binstubs
53+
run: bundle binstubs bundler-audit brakeman rubocop
54+
# Add or replace any other lints here
55+
- name: Security audit dependencies
56+
run: bin/bundler-audit --update
57+
- name: Security audit application code
58+
run: bin/brakeman -q -w2
59+
- name: Lint Ruby files
60+
run: bin/rubocop --parallel

0 commit comments

Comments
 (0)