Skip to content

Commit 77abe09

Browse files
committed
Harden CI and add trusted publishing
Bring akami's workflows and tooling to the savonrb standard. * SHA-pin GitHub actions, drop GITHUB_TOKEN to read-only, persist-credentials: false, and add audit (bundle-audit + ruby-audit), zizmor and standardrb jobs * Extend the test matrix to 3.4/4.0/truffleruby and add a provisional jruby-9.4.8 build * upload coverage to Coveralls from the 3.4 build * gem_push.yml: publish via trusted publishing * dependabot.yml: track the github-actions ecosystem weekly with a 7-day cooldown
1 parent e05faca commit 77abe09

5 files changed

Lines changed: 113 additions & 16 deletions

File tree

.github/dependabot.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
# To get started with Dependabot version updates, you'll need to specify which
2-
# package ecosystems to update and where the package manifests are located.
3-
# Please see the documentation for more information:
4-
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5-
# https://containers.dev/guide/dependabot
6-
71
version: 2
82
updates:
9-
- package-ecosystem: "devcontainers"
10-
directory: "/"
11-
schedule:
12-
interval: weekly
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
cooldown:
8+
default-days: 7
9+
- package-ecosystem: "devcontainers"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"
13+
cooldown:
14+
default-days: 7

.github/workflows/ci.yml

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,86 @@
1-
name: Ruby
1+
name: CI
22

33
on:
44
- push
55
- pull_request
66

7+
permissions:
8+
contents: read # checkout only, nothing else
9+
710
jobs:
11+
audit:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
15+
with:
16+
persist-credentials: false
17+
- uses: ruby/setup-ruby@d45b1a4e94b71acab930e56e79c6aa188764e7f9 # v1.316.0
18+
with:
19+
ruby-version: "3.4"
20+
bundler-cache: true
21+
- name: Audit dependencies
22+
run: bundle exec bundle-audit check --update
23+
- name: Audit Ruby runtime
24+
# CVE-2026-41316 is an ERB flaw fixed in Ruby 4.0.3 and not yet backported.
25+
# Ignored on affected rubies only. See:
26+
# https://www.ruby-lang.org/en/news/2026/04/21/erb-cve-2026-41316/
27+
# https://github.com/advisories/GHSA-q339-8rmv-2mhv
28+
run: |
29+
ignore=""
30+
if ruby -e 'exit 1 unless Gem::Version.new(RUBY_VERSION) < Gem::Version.new("4.0.3")'; then
31+
ignore="--ignore CVE-2026-41316"
32+
fi
33+
bundle exec ruby-audit check $ignore
34+
35+
zizmor:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
39+
with:
40+
persist-credentials: false
41+
- name: Audit workflows
42+
uses: zizmorcore/zizmor-action@192e21d79ab29983730a13d1382995c2307fbcaa # v0.5.7
43+
with:
44+
advanced-security: false # fail the build on findings instead of uploading SARIF
45+
46+
lint:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
50+
with:
51+
persist-credentials: false
52+
- uses: ruby/setup-ruby@d45b1a4e94b71acab930e56e79c6aa188764e7f9 # v1.316.0
53+
with:
54+
ruby-version: "3.4"
55+
bundler-cache: true
56+
- name: Standard
57+
run: bundle exec standardrb
58+
859
test:
960
runs-on: ubuntu-latest
1061
strategy:
1162
fail-fast: false
1263
matrix:
13-
ruby: [3.0, 3.1, 3.2, 3.3, head, truffleruby-head]
14-
env:
15-
RAILS_ENV: test
64+
ruby: ['3.0', 3.1, 3.2, 3.3, 3.4, '4.0', truffleruby, head, truffleruby-head, jruby-9.4.8]
65+
# Head builds surface upstream regressions early and should not block.
66+
# jruby is included provisionally: akami's OpenSSL-based signing and GOST
67+
# engine make its jruby support unverified, so it does not block either
68+
# until a green run proves it can be promoted to a required build.
69+
continue-on-error: ${{ matrix.ruby == 'head' || matrix.ruby == 'truffleruby-head' || matrix.ruby == 'jruby-9.4.8' }}
1670
steps:
17-
- uses: actions/checkout@v4
71+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
72+
with:
73+
persist-credentials: false
1874
- name: Set up Ruby
19-
uses: ruby/setup-ruby@v1
75+
uses: ruby/setup-ruby@d45b1a4e94b71acab930e56e79c6aa188764e7f9 # v1.316.0
2076
with:
2177
ruby-version: ${{ matrix.ruby }}
2278
bundler-cache: true # bundle installs and caches dependencies
2379
- name: Run tests
2480
run: bundle exec rake --trace
81+
- name: Upload coverage to Coveralls
82+
if: matrix.ruby == '3.4'
83+
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
84+
with:
85+
file: coverage/.resultset.json
86+
format: simplecov

.github/workflows/gem_push.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Push gem
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
push:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
id-token: write
10+
contents: write
11+
environment: release
12+
steps:
13+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
14+
with:
15+
persist-credentials: false
16+
- uses: ruby/setup-ruby@d45b1a4e94b71acab930e56e79c6aa188764e7f9 # v1.316.0
17+
with:
18+
ruby-version: "3"
19+
bundler-cache: false
20+
- name: Install dependencies
21+
run: bundle install
22+
- uses: rubygems/release-gem@052cc82692552de3ef2b81fd670e41d13cba8092 # v1.4.0

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
source "https://rubygems.org"
22
gemspec
33

4+
gem "bundler-audit", "~> 0.9.3", require: false
5+
# ruby_audit 3.x requires Ruby >= 3.1. Only the CI audit job needs it.
6+
gem "ruby_audit", "~> 3.1", require: false if RUBY_VERSION >= "3.1.0"
7+
gem "simplecov", require: false
48
gem "standard", require: false

spec/spec_helper.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
unless RUBY_PLATFORM.match?(/java/)
2+
require "simplecov"
3+
SimpleCov.start do
4+
add_filter "spec"
5+
end
6+
end
7+
18
require "bundler"
29
Bundler.require :default, :development
310

0 commit comments

Comments
 (0)