Skip to content

Commit b68f4d6

Browse files
Uriel AlonsoUriel Alonso
authored andcommitted
Add Rails CI workflow
1 parent dd5d73a commit b68f4d6

File tree

1 file changed

+9
-114
lines changed

1 file changed

+9
-114
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,25 @@
1-
name: CI
1+
name: Rails CI
22

33
on:
4-
pull_request:
54
push:
6-
branches: [ main ]
5+
branches: [main]
6+
pull_request:
77

88
jobs:
9-
scan_ruby:
10-
runs-on: ubuntu-latest
11-
12-
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v6
15-
16-
- name: Set up Ruby
17-
uses: ruby/setup-ruby@v1
18-
with:
19-
bundler-cache: true
20-
21-
- name: Scan for common Rails security vulnerabilities using static analysis
22-
run: bin/brakeman --no-pager
23-
24-
- name: Scan for known security vulnerabilities in gems used
25-
run: bin/bundler-audit
26-
27-
scan_js:
28-
runs-on: ubuntu-latest
29-
30-
steps:
31-
- name: Checkout code
32-
uses: actions/checkout@v6
33-
34-
- name: Set up Ruby
35-
uses: ruby/setup-ruby@v1
36-
with:
37-
bundler-cache: true
38-
39-
- name: Scan for security vulnerabilities in JavaScript dependencies
40-
run: bin/importmap audit
41-
42-
lint:
43-
runs-on: ubuntu-latest
44-
env:
45-
RUBOCOP_CACHE_ROOT: tmp/rubocop
46-
steps:
47-
- name: Checkout code
48-
uses: actions/checkout@v6
49-
50-
- name: Set up Ruby
51-
uses: ruby/setup-ruby@v1
52-
with:
53-
bundler-cache: true
54-
55-
- name: Prepare RuboCop cache
56-
uses: actions/cache@v4
57-
env:
58-
DEPENDENCIES_HASH: ${{ hashFiles('.ruby-version', '**/.rubocop.yml', '**/.rubocop_todo.yml', 'Gemfile.lock') }}
59-
with:
60-
path: ${{ env.RUBOCOP_CACHE_ROOT }}
61-
key: rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}-${{ github.ref_name == github.event.repository.default_branch && github.run_id || 'default' }}
62-
restore-keys: |
63-
rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}-
64-
65-
- name: Lint code for consistent style
66-
run: bin/rubocop -f github
67-
689
test:
6910
runs-on: ubuntu-latest
7011

71-
# services:
72-
# redis:
73-
# image: valkey/valkey:8
74-
# ports:
75-
# - 6379:6379
76-
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
7712
steps:
78-
- name: Install packages
79-
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y libvips
80-
81-
- name: Checkout code
82-
uses: actions/checkout@v6
13+
- name: Checkout
14+
uses: actions/checkout@v4
8315

8416
- name: Set up Ruby
8517
uses: ruby/setup-ruby@v1
8618
with:
8719
bundler-cache: true
8820

89-
- name: Run tests
90-
env:
91-
RAILS_ENV: test
92-
# RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
93-
# REDIS_URL: redis://localhost:6379/0
94-
run: bin/rails db:test:prepare test
95-
96-
system-test:
97-
runs-on: ubuntu-latest
21+
- name: Validate business spec
22+
run: bin/rails spec:validate
9823

99-
# services:
100-
# redis:
101-
# image: valkey/valkey:8
102-
# ports:
103-
# - 6379:6379
104-
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
105-
steps:
106-
- name: Install packages
107-
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y libvips
108-
109-
- name: Checkout code
110-
uses: actions/checkout@v6
111-
112-
- name: Set up Ruby
113-
uses: ruby/setup-ruby@v1
114-
with:
115-
bundler-cache: true
116-
117-
- name: Run System Tests
118-
env:
119-
RAILS_ENV: test
120-
# RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
121-
# REDIS_URL: redis://localhost:6379/0
122-
run: bin/rails db:test:prepare test:system
123-
124-
- name: Keep screenshots from failed system tests
125-
uses: actions/upload-artifact@v4
126-
if: failure()
127-
with:
128-
name: screenshots
129-
path: ${{ github.workspace }}/tmp/screenshots
130-
if-no-files-found: ignore
24+
- name: Run tests
25+
run: bin/rails test

0 commit comments

Comments
 (0)