Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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:

```
<type>[optional scope]: <description>

[optional body]

[optional footer(s)]
```

Where:

- `<type>`: The type of change being made (e.g. feat, fix, docs, style, refactor, test, chore)
- `<scope>` (optional): The scope of the change (e.g. component name, file name)
- `<description>`: 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).
21 changes: 21 additions & 0 deletions .github/workflows/publish-gem.yml
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
11 changes: 5 additions & 6 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.11
2 changes: 1 addition & 1 deletion lib/stream.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
STREAM_VERSION = '0.5.5'.freeze
require 'stream/version'

##
# Module Stream defines an interface for an external Iterator which
Expand Down
5 changes: 5 additions & 0 deletions lib/stream/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

module Stream
VERSION = '0.5.5'
end
5 changes: 2 additions & 3 deletions stream.gemspec
Original file line number Diff line number Diff line change
@@ -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."

Expand Down
Loading