Skip to content

Commit 147f455

Browse files
authored
Update rubyonrails.yml
should hopefully pass the job when failures occur only on rails 7.2 and 8.0 runs Signed-off-by: Robert Smith <[email protected]>
1 parent 5a59942 commit 147f455

File tree

1 file changed

+52
-46
lines changed

1 file changed

+52
-46
lines changed

.github/workflows/rubyonrails.yml

Lines changed: 52 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,104 @@
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.
71
name: "Ruby on Rails CI"
2+
83
on:
94
push:
105
branches: [ "main", "dev" ]
116
pull_request:
127
branches: [ "main", "dev" ]
8+
139
jobs:
1410
rspec:
1511
runs-on: ubuntu-latest
12+
13+
# ── Handle failures per-matrix entry ────────────────────────────────────────
14+
continue-on-error: ${{ matrix.allowed_failure }}
15+
1616
strategy:
17+
fail-fast: false # don’t cancel other matrix jobs early
1718
matrix:
18-
ruby: ['3.4.4']
19-
rails: ['7.1.5.1', '7.2', '8.0']
20-
fail-fast: false
21-
continue-on-error: ${{ matrix.rails != '7.1.5.1' }}
19+
include:
20+
# ✅ REQUIRED: must pass
21+
- ruby: '3.4.4'
22+
rails: '7.1.5.1'
23+
allowed_failure: false
24+
25+
# ⚠️ ALLOWED TO FAIL (prep work for upgrades)
26+
- ruby: '3.4.4'
27+
rails: '7.2'
28+
allowed_failure: true
29+
30+
- ruby: '3.4.4'
31+
rails: '8.0'
32+
allowed_failure: true
33+
2234
env:
2335
RAILS_ENV: test
2436
DATABASE_URL: "postgis://rails:password@localhost:5432/rails_test"
25-
ES_HOST: "http://localhost"
37+
ES_HOST: "http://localhost"
2638
RAILS_VERSION: ${{ matrix.rails }}
2739
environment: test
40+
2841
services:
2942
postgres:
3043
image: postgis/postgis:latest
31-
ports:
32-
- "5432:5432"
44+
ports: [ "5432:5432" ]
3345
env:
3446
POSTGRES_DB: rails_test
3547
POSTGRES_USER: rails
3648
POSTGRES_PASSWORD: password
3749
elasticsearch:
3850
image: elasticsearch:7.17.23
39-
ports:
40-
- "9200:9200"
51+
ports: [ "9200:9200" ]
4152
env:
42-
"node.name": elasticsearch
43-
"cluster.name": better-together-es
44-
"discovery.seed_hosts": elasticsearch
45-
"discovery.type": single-node
46-
"bootstrap.memory_lock": true
47-
"ES_JAVA_OPTS": "-Xms512m -Xmx512m"
53+
node.name: elasticsearch
54+
cluster.name: better-together-es
55+
discovery.seed_hosts: elasticsearch
56+
discovery.type: single-node
57+
bootstrap.memory_lock: "true"
58+
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
59+
4860
steps:
4961
- name: Checkout code
5062
uses: actions/checkout@v3
51-
# Add or replace dependency steps here
52-
- name: Install Ruby and gems
63+
64+
- name: Install Ruby/toolchain
5365
uses: ruby/setup-ruby@v1
5466
with:
5567
ruby-version: ${{ matrix.ruby }}
5668
bundler-cache: ${{ matrix.rails == '7.1.5.1' }}
57-
- name: Update Rails
58-
if: matrix.rails != '7.1.5.1'
69+
70+
- name: Update Rails for upgrade tracks
71+
if: matrix.allowed_failure
5972
run: |
6073
bundle config set deployment false
6174
bundle update rails --conservative
6275
bundle install
63-
# Add or replace database setup steps here
64-
- name: Set up database schema
65-
run: rm -f spec/dummy/tmp/pids/server.pid && cd ./spec/dummy && bundle exec rails db:schema:load
66-
# Add or replace test runners here
67-
- name: Run tests
76+
77+
- name: Prepare DB schema
78+
run: rm -f spec/dummy/tmp/pids/server.pid && cd spec/dummy && bundle exec rails db:schema:load
79+
80+
- name: Run RSpec
6881
env:
6982
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
7083
run: rm -f spec/dummy/tmp/pids/server.pid && bundle exec rspec
7184

85+
# ── Style & Security jobs stay unchanged ─────────────────────────────────────
7286
rubocop:
7387
runs-on: ubuntu-latest
7488
steps:
75-
- name: Checkout code
76-
uses: actions/checkout@v3
77-
- name: Install Ruby and gems
78-
uses: ruby/setup-ruby@v1
89+
- uses: actions/checkout@v3
90+
- uses: ruby/setup-ruby@v1
7991
with:
8092
bundler-cache: true
81-
- name: Lint Ruby files with Rubocop
82-
run: bundle exec rubocop --parallel
93+
- run: bundle exec rubocop --parallel
8394

8495
security:
8596
runs-on: ubuntu-latest
8697
steps:
87-
- name: Checkout code
88-
uses: actions/checkout@v3
89-
- name: Install Ruby and gems
90-
uses: ruby/setup-ruby@v1
98+
- uses: actions/checkout@v3
99+
- uses: ruby/setup-ruby@v1
91100
with:
92101
bundler-cache: true
93-
- name: Generate binstubs
94-
run: bundle binstubs bundler-audit --force
95-
- name: Security audit dependencies
96-
run: bundle exec bundler-audit --update
97-
- name: Security audit application code
98-
run: bundle exec brakeman -q -w2
102+
- run: bundle binstubs bundler-audit --force
103+
- run: bundle exec bundler-audit --update
104+
- run: bundle exec brakeman -q -w2

0 commit comments

Comments
 (0)