@@ -11,22 +11,17 @@ jobs:
1111 matrix :
1212 include :
1313 - ruby : ' 3.4.4'
14- rails : ' 7.1.5.1 '
14+ rails : ' 7.2.2.2 '
1515 allowed_failure : false # ✅ required
16- # - ruby: '3.4.4'
17- # rails: '7.2'
18- # allowed_failure: true # ⚠️ allowed to fail
1916 - ruby : ' 3.4.4'
20- rails : ' 8.0'
21- allowed_failure : false # ✅ required
22- - ruby : ' 3.4.4'
23- rails : ' 8.1'
24- allowed_failure : true # ⚠️ allowed to fail
17+ rails : ' 8.0.2'
18+ allowed_failure : false # ✅ required
2519
2620 env :
2721 RAILS_ENV : test
2822 DATABASE_URL : " postgis://rails:password@localhost:5432/rails_test"
2923 ES_HOST : " http://localhost"
24+ ELASTICSEARCH_URL : " http://localhost:9200"
3025 RAILS_VERSION : ${{ matrix.rails }}
3126
3227 services :
@@ -54,18 +49,18 @@ jobs:
5449 with :
5550 ruby-version : ${{ matrix.ruby }}
5651
57- # Run the automatic bundle-install only on 7.1 .
52+ # Run the automatic bundle-install only on 7.2 .
5853 # For 7.2 / 8.0 it just sets up Ruby *and* restores a cache layer
5954 # that we’ll reuse in the later manual install.
60- bundler-cache : ${{ matrix.rails == '7.1.5.1 ' }}
55+ bundler-cache : ${{ matrix.rails == '7.2.2.2 ' }}
6156
6257 # One cache bucket per Rails version so they don’t clobber each other.
6358 cache-version : rails-${{ matrix.rails }}
6459
6560 # Updating Rails can legitimately blow up on the experimental tracks,
6661 # so we allow that *step* to error out without failing the job.
6762 - name : Update Rails & install gems
68- if : matrix.rails != '7.1.5.1 '
63+ if : matrix.rails != '7.2.2.2 '
6964 id : update
7065 run : |
7166 # turn off deployment mode
@@ -77,21 +72,52 @@ jobs:
7772 continue-on-error : ${{ matrix.allowed_failure }}
7873
7974 - name : Prepare DB schema
80- if : (matrix.rails == '7.1.5.1 ') || steps.update.outcome == 'success'
75+ if : (matrix.rails == '7.2.2.2 ') || steps.update.outcome == 'success'
8176 run : |
8277 rm -f spec/dummy/tmp/pids/server.pid
8378 bundle exec rake -f spec/dummy/Rakefile db:schema:load
8479 continue-on-error : ${{ matrix.allowed_failure }}
8580
81+ - name : Wait for Elasticsearch
82+ if : (matrix.rails == '7.2.2.2') || steps.update.outcome == 'success'
83+ run : |
84+ echo "Waiting for Elasticsearch to be healthy..."
85+ curl -s "http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" || (echo "Elasticsearch not healthy" && exit 1)
86+
87+
8688 - name : Run RSpec
87- if : (matrix.rails == '7.1.5.1 ') || steps.update.outcome == 'success'
89+ if : (matrix.rails == '7.2.2.2 ') || steps.update.outcome == 'success'
8890 env :
8991 RAILS_MASTER_KEY : ${{ secrets.RAILS_MASTER_KEY }}
9092 run : |
9193 rm -f spec/dummy/tmp/pids/server.pid
9294 bundle exec rspec
9395 continue-on-error : ${{ matrix.allowed_failure }}
9496
97+ - name : Upload coverage report
98+ if : always()
99+ uses : actions/upload-artifact@v4
100+ with :
101+ name : coverage-report-ruby-${{ matrix.ruby }}-rails-${{ matrix.rails }}
102+ path : |
103+ coverage/
104+
105+ - name : Generate coverage badge
106+ if : ${{ github.ref == 'refs/heads/main' && success() }}
107+ continue-on-error : true
108+ run : |
109+ COVERAGE=$(jq -r '.result.covered_percent' coverage/.last_run.json)
110+ COLOR=$(node -e "cov=parseFloat(process.argv[1]);console.log(cov>=90?'green':cov>=75?'orange':'red')" $COVERAGE)
111+ npx badgen-cli --subject coverage --status ${COVERAGE}% --color $COLOR > coverage.svg
112+
113+ - name : Commit badge
114+ if : ${{ github.ref == 'refs/heads/main' && success() }}
115+ continue-on-error : true
116+ uses : stefanzweifel/git-auto-commit-action@v5
117+ with :
118+ commit_message : " chore: update coverage badge"
119+ file_pattern : coverage.svg
120+
95121 # ── style & security jobs (unchanged) ───────────────────────────────────────
96122 rubocop :
97123 runs-on : ubuntu-latest
0 commit comments