11name : " Ruby on Rails CI"
22
3- on :
4- push :
5- branches : [ "main", "dev" ]
6- pull_request :
7- branches : [ "main", "dev" ]
3+ on : { push: { branches: [main, dev] }, pull_request: { branches: [main, dev] } }
84
95jobs :
106 rspec :
117 runs-on : ubuntu-latest
12-
13- # ── Handle failures per-matrix entry ────────────────────────────────────────
14- continue-on-error : ${{ matrix.allowed_failure }}
15-
168 strategy :
17- fail-fast : false # don’t cancel other matrix jobs early
9+ fail-fast : false
1810 matrix :
1911 include :
20- # ✅ REQUIRED: must pass
2112 - ruby : ' 3.4.4'
2213 rails : ' 7.1.5.1'
23- allowed_failure : false
24-
25- # ⚠️ ALLOWED TO FAIL (prep work for upgrades)
14+ allowed_failure : false # ✅ required
2615 - ruby : ' 3.4.4'
2716 rails : ' 7.2'
28- allowed_failure : true
29-
17+ allowed_failure : true # ⚠️ allowed to fail
3018 - ruby : ' 3.4.4'
3119 rails : ' 8.0'
32- allowed_failure : true
20+ allowed_failure : true # ⚠️ allowed to fail
3321
3422 env :
3523 RAILS_ENV : test
3624 DATABASE_URL : " postgis://rails:password@localhost:5432/rails_test"
3725 ES_HOST : " http://localhost"
3826 RAILS_VERSION : ${{ matrix.rails }}
39- environment : test
4027
4128 services :
4229 postgres :
4330 image : postgis/postgis:latest
44- ports : [ "5432:5432" ]
45- env :
46- POSTGRES_DB : rails_test
47- POSTGRES_USER : rails
48- POSTGRES_PASSWORD : password
31+ ports : ["5432:5432"]
32+ env : { POSTGRES_DB: rails_test, POSTGRES_USER: rails, POSTGRES_PASSWORD: password }
4933 elasticsearch :
5034 image : elasticsearch:7.17.23
51- ports : [ "9200:9200" ]
35+ ports : ["9200:9200"]
5236 env :
5337 node.name : elasticsearch
5438 cluster.name : better-together-es
@@ -61,44 +45,51 @@ jobs:
6145 - name : Checkout code
6246 uses : actions/checkout@v3
6347
64- - name : Install Ruby/toolchain
48+ - name : Install Ruby & gems
6549 uses : ruby/setup-ruby@v1
6650 with :
6751 ruby-version : ${{ matrix.ruby }}
6852 bundler-cache : ${{ matrix.rails == '7.1.5.1' }}
6953
70- - name : Update Rails for upgrade tracks
71- if : matrix.allowed_failure
54+ # Updating Rails can legitimately blow up on the experimental tracks,
55+ # so we allow that *step* to error out without failing the job.
56+ - name : Update Rails
57+ if : matrix.rails != '7.1.5.1'
7258 run : |
7359 bundle config set deployment false
7460 bundle update rails --conservative
7561 bundle install
62+ continue-on-error : ${{ matrix.allowed_failure }}
7663
7764 - name : Prepare DB schema
78- run : rm -f spec/dummy/tmp/pids/server.pid && cd spec/dummy && bundle exec rails db:schema:load
65+ run : |
66+ rm -f spec/dummy/tmp/pids/server.pid
67+ cd spec/dummy
68+ bundle exec rails db:schema:load
7969
8070 - name : Run RSpec
8171 env :
8272 RAILS_MASTER_KEY : ${{ secrets.RAILS_MASTER_KEY }}
83- run : rm -f spec/dummy/tmp/pids/server.pid && bundle exec rspec
73+ run : |
74+ rm -f spec/dummy/tmp/pids/server.pid
75+ bundle exec rspec
76+ continue-on-error : ${{ matrix.allowed_failure }}
8477
85- # ── Style & Security jobs stay unchanged ─────────────────────────────────────
78+ # ── style & security jobs ( unchanged) ── ─────────────────────────────────────
8679 rubocop :
8780 runs-on : ubuntu-latest
8881 steps :
8982 - uses : actions/checkout@v3
9083 - uses : ruby/setup-ruby@v1
91- with :
92- bundler-cache : true
84+ with : { bundler-cache: true }
9385 - run : bundle exec rubocop --parallel
9486
9587 security :
9688 runs-on : ubuntu-latest
9789 steps :
9890 - uses : actions/checkout@v3
9991 - uses : ruby/setup-ruby@v1
100- with :
101- bundler-cache : true
92+ with : { bundler-cache: true }
10293 - run : bundle binstubs bundler-audit --force
10394 - run : bundle exec bundler-audit --update
10495 - run : bundle exec brakeman -q -w2
0 commit comments