diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..704fc5a --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,134 @@ +# Contributing to stream + +Thank you for your interest in contributing to stream! We welcome all +contributions, whether they're big or small. Here are some guidelines to get you +started. + +## Development Setup + +### Ruby + +We recommend [rbenv](https://github.com/rbenv/rbenv) with +[ruby-build](https://github.com/rbenv/ruby-build) to manage Ruby versions: + +```bash +# Install rbenv and ruby-build (see https://github.com/rbenv/rbenv#installation) +git clone https://github.com/rbenv/rbenv.git ~/.rbenv +git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build +echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc +echo 'eval "$(rbenv init - bash)"' >> ~/.bashrc +source ~/.bashrc + +# Install the required Ruby version (reads .ruby-version automatically) +rbenv install +``` + +### Dependencies + +```bash +gem install bundler +bundle install +``` + +### Running Tests + +```bash +bundle exec rake test # full test suite +bundle exec rake test TEST=test/stream_test.rb # single file +``` + +## How to Contribute + +1. Fork the repository. +2. Create a branch for your changes: `git checkout -b my-feature-branch` +3. Make your changes and commit them with descriptive commit messages. +4. Ensure that tests pass by running `bundle exec rake test` locally. +5. Push your changes to your fork: `git push origin my-feature-branch` +6. Submit a pull request with your changes. + +## Commit Guidelines + +We follow the [Conventional +Commits](https://www.conventionalcommits.org/en/v1.0.0/) guidelines for commit +messages in this repository. Please ensure that all commit messages follow the +format: + +``` +[optional scope]: + +[optional body] + +[optional footer(s)] +``` + +Where: + +- ``: The type of change being made (e.g. feat, fix, docs, style, refactor, test, chore) +- `` (optional): The scope of the change (e.g. component name, file name) +- ``: A brief description of the change +- `[optional body]`: A more detailed description of the change +- `[optional footer(s)]`: Any important information related to the change, such + as a breaking change note + +## Issue Tracker + +If you find a bug or want to request a new feature, please create an issue in +the GitHub issue tracker. Please provide as much detail as possible, including +steps to reproduce the issue (if applicable). + +## Code Reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult [GitHub +Help](https://help.github.com/articles/about-pull-requests/) for more +information on using pull requests. + +## Release Process + +Releases are managed by maintainers with push access to `master`. + +### How it works + +1. Merging a PR to `master` triggers the + [release-please](https://github.com/googleapis/release-please) workflow, + which automatically creates or updates a release PR. The release PR bumps + the version in `lib/stream/version.rb` and updates `CHANGELOG.md` based on + [Conventional Commits](https://www.conventionalcommits.org/). + +2. When ready to release, merge the release PR. + +3. Publish the gem to RubyGems.org: + + ```bash + gh workflow run publish-gem.yml + ``` + + No OTP or API key is needed. Publishing uses + [RubyGems Trusted Publishing (OIDC)](https://guides.rubygems.org/trusted-publishing/), + which grants a short-lived token automatically via GitHub Actions. + +### RubyGems ownership + +Current gem owners on RubyGems.org can be listed with: + +```bash +gem owner stream +``` + +To add a new owner (requires existing owner credentials): + +```bash +gem owner stream --add new-maintainer@example.com +``` + +### Trusted Publisher setup + +The `publish-gem.yml` workflow is registered as a Trusted Publisher on +RubyGems.org under the `monora/stream` repository. If the workflow file is ever +renamed, the Trusted Publisher entry at +`https://rubygems.org/gems/stream/trusted_publishers` must be updated accordingly. + +## License + +By contributing, you agree that your contributions will be licensed under the +[LICENSE](../LICENSE). diff --git a/.github/workflows/publish-gem.yml b/.github/workflows/publish-gem.yml new file mode 100644 index 0000000..b4b3b72 --- /dev/null +++ b/.github/workflows/publish-gem.yml @@ -0,0 +1,21 @@ +name: Push to rubygems.org + +on: + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - uses: rubygems/release-gem@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c946395 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: Prepare Release + +on: + push: + branches: + - master + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: GoogleCloudPlatform/release-please-action@v5 + id: release + with: + release-type: ruby + package-name: stream + bump-minor-pre-major: true + version-file: "lib/stream/version.rb" + + - uses: actions/checkout@v4 + if: ${{ steps.release.outputs.release_created }} + + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + if: ${{ steps.release.outputs.release_created }} + + - name: Run tests + run: bundle exec rake test + if: ${{ steps.release.outputs.release_created }} diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 8443f3b..f73e95d 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -15,19 +15,18 @@ jobs: strategy: matrix: ruby-version: - - '2.6' - - '2.7' - - '3.0' - - '3.1' + - '3.2' + - '3.3' + - '3.4' - ruby-head - jruby-head steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} - bundler-cache: true # runs 'bundle install' and caches installed gems automatically + bundler-cache: true - name: Run tests run: bundle exec rake test diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..b9b3b0d --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.3.11 diff --git a/lib/stream.rb b/lib/stream.rb index 9c9b314..9fb7fd0 100644 --- a/lib/stream.rb +++ b/lib/stream.rb @@ -1,4 +1,4 @@ -STREAM_VERSION = '0.5.5'.freeze +require 'stream/version' ## # Module Stream defines an interface for an external Iterator which diff --git a/lib/stream/version.rb b/lib/stream/version.rb new file mode 100644 index 0000000..8b310f3 --- /dev/null +++ b/lib/stream/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module Stream + VERSION = '0.5.5' +end diff --git a/stream.gemspec b/stream.gemspec index f80a627..130537b 100644 --- a/stream.gemspec +++ b/stream.gemspec @@ -1,9 +1,8 @@ -$:.unshift File.join(File.dirname(__FILE__), 'lib') -require 'stream' +require_relative 'lib/stream/version' Gem::Specification.new do |s| s.name = 'stream' - s.version = STREAM_VERSION + s.version = Stream::VERSION s.summary = "stream - Extended External Iterators" s.description = "Module Stream defines an interface for external iterators."