Skip to content

Commit b3bc7f4

Browse files
authored
ci: add packaging quality gate (#17)
1 parent cbf0956 commit b3bc7f4

3 files changed

Lines changed: 35 additions & 5 deletions

File tree

.github/workflows/ruby.yml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ on:
1010

1111
jobs:
1212
test:
13-
14-
runs-on: ubuntu-latest
13+
# Ruby 2.6/2.7 are still in the compatibility matrix and need the older Ubuntu image.
14+
runs-on: ubuntu-22.04
1515

1616
strategy:
17+
fail-fast: false
1718
matrix:
18-
ruby-version: [2.6, 2.7, 3.0, 3.1]
19+
ruby-version: ['2.6', '2.7', '3.0', '3.1']
1920

2021
steps:
2122
- name: Checkout code
22-
uses: actions/checkout@v2
23+
uses: actions/checkout@v4
2324

2425
- name: Set up Ruby
2526
uses: ruby/setup-ruby@v1
@@ -29,3 +30,31 @@ jobs:
2930

3031
- name: Run tests
3132
run: bundle exec rspec
33+
34+
quality:
35+
runs-on: ubuntu-22.04
36+
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
40+
41+
- name: Set up Ruby
42+
uses: ruby/setup-ruby@v1
43+
with:
44+
ruby-version: '3.1'
45+
bundler-cache: true
46+
47+
- name: Run RuboCop
48+
run: bundle exec rubocop
49+
50+
- name: Build gem package
51+
run: |
52+
mkdir -p pkg
53+
gem build irt_ruby.gemspec -o pkg/irt_ruby.gem
54+
55+
- name: Verify built gem installs
56+
run: |
57+
set -euo pipefail
58+
gem install pkg/irt_ruby.gem --no-document
59+
cd "$(mktemp -d)"
60+
env -u BUNDLE_GEMFILE -u BUNDLE_PATH ruby -e "require 'irt_ruby'; result = IrtRuby::RaschModel.new([[1, 0], [0, 1]]).fit; raise 'missing abilities' unless result[:abilities].size == 2"

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ All notable changes to this project are documented in this file.
88
- Added executable specs for README usage examples to keep the documented Rasch, 2PL, 3PL, and missing-data flows aligned with the public API.
99

1010
### Changed
11+
- Added CI RuboCop and gem package build/install verification, and documented the local quality and packaging commands for contributors.
1112
- Clarified that response data must be a `Matrix` or array of arrays containing only integer `0`, integer `1`, or `nil`; floats, strings, booleans, and other values are rejected.
1213

1314
---

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ See `benchmarks/README.md` for detailed information about interpreting results.
157157

158158
## Development
159159

160-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
160+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake spec` for the test suite or `bundle exec rake` for the default local quality gate: the RSpec suite and RuboCop. Before tagging a release, run `bundle exec rake build` to verify the gemspec packages cleanly from the current file list; CI also installs the built gem and smoke-tests `require 'irt_ruby'`. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
161161

162162
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
163163

0 commit comments

Comments
 (0)