diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 7884058..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,102 +0,0 @@ -# Ruby CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-ruby/ for more details -# -version: 2.1 - -commands: - build: - description: "Build and run the tests" - - steps: - - checkout - - restore_cache: - keys: - - bundle-{{ checksum "cucumber-wire.gemspec" }} - - run: - name: install dependencies - command: | - bundle install --jobs=4 --retry=3 --path vendor/bundle - - save_cache: - paths: - - ./vendor/bundle - key: bundle-{{ checksum "cucumber-wire.gemspec" }} - - test: - description: "Run tests" - steps: - - run: - name: run tests - command: | - bundle exec rake - - test_allow_failure: - description: "Run tests (allow failure so workflow is not marked as failed)" - steps: - - run: - name: run tests with allowed failure - command: | - set -o errexit - bundle exec rake - set -o errexit - -jobs: - build-ruby-2_5: - docker: - - image: circleci/ruby:2.5 - - working_directory: ~/repo - steps: - - build - - test - - build-ruby-2_6: - docker: - - image: circleci/ruby:2.6 - - working_directory: ~/repo - steps: - - build - - test - - build-ruby-2_7: - docker: - - image: circleci/ruby:2.7 - - working_directory: ~/repo - steps: - - build - - test - - build-ruby-latest: - docker: - - image: circleci/ruby:latest - - working_directory: ~/repo - steps: - - build - - test_allow_failure - -workflows: - version: 2 - - nightly-build: - triggers: - - schedule: - cron: "0 5 * * *" - filters: - branches: - only: - - main - - jobs: - - build-ruby-2_5 - - build-ruby-2_6 - - build-ruby-2_7 - - build: - jobs: - - build-ruby-2_5 - - build-ruby-2_6 - - build-ruby-2_7 - - build-ruby-latest diff --git a/.github/workflows/cucumber-ruby-wire.yml b/.github/workflows/cucumber-ruby-wire.yml new file mode 100644 index 0000000..f0d6518 --- /dev/null +++ b/.github/workflows/cucumber-ruby-wire.yml @@ -0,0 +1,43 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby + +name: Test cucumber-wire + +on: + push: + branches: + - main + pull_request: + branches: + - main + schedule: + - cron: "0 5 * * *" + +jobs: + test: + strategy: + matrix: + os: [ubuntu-latest] + # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0' + ruby: [2.5, 2.6, 2.7, '3.0'] + include: + - os: macos-latest + ruby: '3.0' + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, + # change this to (see https://github.com/ruby/setup-ruby#versioning): + uses: ruby/setup-ruby@v1 + # uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run tests + run: bundle exec rake diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 0000000..16c2c13 --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,90 @@ +name: Pre-release + +# Prepares a new releas +# +# To trigger it, simply change the CHANGELOG.md file, replacing the +# "Unreleased" header text with the new release's version number. +# +# The workflow will automatically prepare a pull request for the release. +# + +on: + push: + branches: [main] + +jobs: + + versions: + runs-on: ubuntu-latest + name: Get version numbers + outputs: + released-version: ${{ steps.current-release.outputs.number }} + next-version: ${{ steps.next-release.outputs.result }} + steps: + - uses: actions/checkout@v2 + - name: read the current release version from git tags + uses: cucumber-actions/get-released-version@v1.0.0 + id: current-release + - name: read latest version from the changelog + uses: cucumber-actions/changelog-action@v1.3 + with: + args: latest + id: next-release + - name: Report version numbers detected + run: | + echo "Released: ${{ steps.current-release.outputs.number }}" + echo "Next: ${{ steps.next-release.outputs.result }}" + + create-release-pr: + runs-on: ubuntu-latest + name: Create / Update Release PR + needs: versions + if: needs.versions.outputs.released-version != needs.versions.outputs.next-version + env: + next_version: ${{ needs.versions.outputs.next-version }} + released_version: ${{ needs.versions.outputs.released-version }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Create/update target branch for release, based on previous release + run: | + git checkout v${{ env.released_version }} + git checkout -b release/v${{ env.next_version }} + git push --force --set-upstream origin release/v${{ env.next_version }} + - name: Create/update a branch off `main` for the commit to be released + run: | + git checkout ${{ github.ref }} + git checkout -b pre-release/v${{ env.next_version }} + git push --force --set-upstream origin pre-release/v${{ env.next_version }} + - name: Check for existing PR for this release + id: pr-already-exists + run: | + output=$(gh pr list --base release/v${{ env.next_version }}) + exists=$([[ $output == *"Release v${{ env.next_version }}"* ]] && echo "exists" || echo "") + echo "::set-output name=result::$exists" + - name: Create Pull Request + if: ${{ !steps.pr-already-exists.outputs.result }} + run: | + ref="${{ github.ref }}" + branch=${ref/refs\/heads\//} + cat >${{ runner.temp }}/body < $GITHUB_ENV + - name: read latest version from the changelog + id: release-notes + uses: mattwynne/changelog-action@v1.3 + with: + args: show ${{ env.version }} + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cat >${{ runner.temp }}/notes < 10.0.0 and `cucumber-messages` ~> 17.0.0 - This brings breaking changes because of internal changes in Cucumber::Messages. - ([#44](https://github.com/cucumber/cucumber-ruby-wire/pull/44)) - -## [5.0.1](https://github.com/cucumber/cucumber-ruby-wire/compare/v5.0.0...v5.0.1) - -### Dependencies +This brings breaking changes because of internal changes in Cucumber::Messages. +([#44](https://github.com/cucumber/cucumber-ruby-wire/pull/44)) +## [5.0.1] +### Changed - Updated `cucumber-core` ~> 9.0.1 -## [5.0.0](https://github.com/cucumber/cucumber-ruby-wire/compare/v4.0.1...v5.0.0) - +## [5.0.0] ### Changed - - Update from cucumber-expressions 10 to 12 introduces significant underlying changes - in how step definitions are matched. This should be backward compatible but there - is a risk of regressions. - -### Dependencies - +in how step definitions are matched. This should be backward compatible but there +is a risk of regressions. - Updated dependencies (look at the diff for details) -## [4.0.1](https://github.com/cucumber/cucumber-ruby-wire/compare/v4.0.0...v4.0.1) - -### Dependencies - +## [4.0.1] +### Changed - Updated dependencies (look at the diff for details) -## [4.0.0](https://github.com/cucumber/cucumber-ruby-wire/compare/v3.1.0...v4.0.0) - -- Release failed - -## [3.1.0](https://github.com/cucumber/cucumber-ruby-wire/compare/v3.0.0...v3.1.0) - +## [3.1.0] ### Changed - +- `cucumber-core` ~> 7.1.0 +- `cucumber-messages` ~> 12.2.0 - Updated gems: - - `cucumber-core` ~> 7.1.0 - - `cucumber-messages` ~> 12.2.0 - -## [3.0.0](https://github.com/cucumber/cucumber-ruby-wire/compare/v2.0.1...v3.0.0) +## [3.0.0] ### Changed - - Use `cucumber-ruby-core` 7.0.0 - +- cucumber-cucumber-expressions ~> 10 +- cucumber-messages ~> 12 - Updated monorepo libraries: - - cucumber-cucumber-expressions ~> 10 - - cucumber-messages ~> 12 - -## [2.0.1](https://github.com/cucumber/cucumber-ruby-wire/compare/v2.0.0...v2.0.1) +## [2.0.1] ### Removed - - Replace use of `MultiJSON` to use native JSON gem -## [2.0.0](https://github.com/cucumber/cucumber-ruby-wire/compare/v1.2.0...v2.0.0) - +## [2.0.0] ### Changed - - Use `cucumber-ruby-core` 6.0.0 -## [1.2.0](https://github.com/cucumber/cucumber-ruby-wire/compare/v1.1.0...v1.2.0) - -### Removed - -- Multiline arguments do not need `Location` anymore - +## [1.2.0] ### Added - - Use `Cucumber:Messages::IdGenerator::UUID` to provide ids for `Hooks` -## [1.1.0](https://github.com/cucumber/cucumber-ruby-wire/compare/v1.0.0...v1.1.0) +### Removed +- Multiline arguments do not need `Location` anymore +## [1.1.0] ### Changed - - Update to cucumber-expressions 8.0.2 - Update to cucumber 4.0.0 -## [1.0.0](https://github.com/cucumber/cucumber-ruby-wire/compare/v0.0.1...v1.0.0) - +## [1.0.0] ### Added - - Added this CHANGELOG.md file per [cucumber/cucumber #251](https://github.com/cucumber/cucumber/issues/251) ([#13](https://github.com/cucumber/cucumber-ruby-wire/pull/13) [jaysonesmith](https://github.com/jaysonesmith)) ### Changed - - Changes to work with a modern Cucumber-Ruby ([#14](https://github.com/cucumber/cucumber-ruby-wire/pull/14) [brasmusson](https://github.com/brasmusson)) - Adapt to the move of Location to Cucumber::Core::Test ([#14](https://github.com/cucumber/cucumber-ruby-wire/pull/14) [brasmusson](https://github.com/brasmusson)) - - -[brasmusson]: https://github.com/brasmusson -[jaysonesmith]: https://github.com/jaysonesmith -[junaruga]: https://github.com/junaruga -[mattwynne]: https://github.com/mattwynne -[olleolleolle]: https://github.com/olleolleolle +[Unreleased]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.1.0...main +[6.1.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.0.1...v6.1.0 +[6.0.1]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.0.0...v6.0.1 +[6.0.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v5.0.1...v6.0.0 +[5.0.1]: https://github.com/cucumber/cucumber-ruby-wire/compare/v5.0.0...v5.0.1 +[5.0.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v4.0.1...v5.0.0 +[4.0.1]: https://github.com/cucumber/cucumber-ruby-wire/compare/v4.0.0...v4.0.1 +[3.1.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v3.0.0...v3.1.0 +[3.0.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v2.0.1...v3.0.0 +[2.0.1]: https://github.com/cucumber/cucumber-ruby-wire/compare/v2.0.0...v2.0.1 +[2.0.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v1.2.0...v2.0.0 +[1.2.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v1.1.0...v1.2.0 +[1.1.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v0.0.1...v1.0.0 +ire/compare/v6.1.0...main +[6.1.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.0.1...v6.1.0 +[6.0.1]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.0.0...v6.0.1 \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 63285ed..c5025da 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,11 +3,17 @@ Release Process * Upgrade gems with `scripts/update-gemspec` * Bump the version number in `lib/cucumber/wire/version` -* Update `CHANGELOG.md` with the upcoming version number and create a new `In Git` section +* Update `CHANGELOG.md` with the upcoming version number and create a new `Unreleased` section * Remove empty sections from `CHANGELOG.md` * Now release it: ``` git commit -am "Release X.Y.Z" -make release +git push ``` + +This will trigger the [`pre-release`](.github/workflows/pre-release.yml) workflow which creates a PR +to a `release/*` branch. + +Once a member of the [@cucumber/cucumber-ruby](https://github.com/orgs/cucumber/teams/cucumber-ruby) core team has approved the release by merging the PR, the new version of the gem will be released automatically +by the [`release`](.github/workflows/release.yml) workflow. diff --git a/Gemfile b/Gemfile index 32fdcc8..d67bbd9 100644 --- a/Gemfile +++ b/Gemfile @@ -13,5 +13,7 @@ end if ENV['CUCUMBER_RUBY'] gem 'cucumber', path: ENV['CUCUMBER_RUBY'] elsif !ENV['CUCUMBER_USE_RELEASED_GEMS'] - gem 'cucumber', github: 'cucumber/cucumber-ruby', branch: 'main' + gem 'cucumber', github: 'cucumber/cucumber-ruby', branch: 'deprecate-builtin-wire' end + +gem 'aruba', github: 'cucumber/aruba', branch: 'main' # Waiting for a new release of aruba \ No newline at end of file diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 0000000..b777e56 --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,53 @@ +# Upgrading from 6.0.1 to 6.1.0 + +Usage of **built-in** wire protocol with `cucumber-ruby` will be deprecated in cucumber +8.0.0, and removed in cucumber 9.0.0. + +The wire protocol will still be available by explicitely using the `cucumber-wire` +gem. + +### Before cucumber 8.0.0 + +Before cucumber 7.1.0, the wire protocol was automatically installed with cucumber, +and automatically activated when it had detected a `.wire` file. + +### With cucumber 8.0.0 + +The wire protocol will work as before, but you will notice a deprecation message. + +To prevent the deprecation message to be shown, add the gem `cucumber-wire` to your +Gemfile alongside the `cucumber` one: + +```ruby +# Gemfile + +# ... + +gem "cucumber" +gem "cucumber-wire" + +# ... + +``` + +Then install it: + +```shell +bundle install +``` + +And add `require 'cucumber/wire'` in your support code. If you do not have support +code yet, create a new one. For example `features/support/wire.rb`. + +```ruby +# features/support/wire.rb +require 'cucumber/wire' +``` + +The wire protocol will be installed, and no deprecation message will be shown anymore. + +### With cucumber 9.0.0 + +The usage of the built-in wire protocol will be removed. You will have to install +`cucumber-wire` and add `require 'cucumber/wire'` in your support code in order +to continue using it, as explained [above](#with-cucumber-800). diff --git a/cucumber-wire.gemspec b/cucumber-wire.gemspec index 65266e1..c39a42a 100644 --- a/cucumber-wire.gemspec +++ b/cucumber-wire.gemspec @@ -16,8 +16,8 @@ Gem::Specification.new do |s| s.add_dependency 'cucumber-cucumber-expressions', '~> 12.1', '>= 12.1.1' s.add_dependency 'cucumber-messages', '~> 17.0', '>= 17.0.1' - s.add_development_dependency 'aruba', '~> 1.1', '>= 1.1.2' - s.add_development_dependency 'cucumber', '~> 6.1', '>= 6.1.0' + s.add_development_dependency 'aruba', '~> 2.0', '>= 2.0.0' + s.add_development_dependency 'cucumber', '~> 7.0', '>= 7.0.0' s.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6' s.add_development_dependency 'rspec', '~> 3.10', '>= 3.10.0' diff --git a/features/docstring.feature b/features/docstring.feature index 6ff35c2..145b359 100644 --- a/features/docstring.feature +++ b/features/docstring.feature @@ -10,6 +10,10 @@ Feature: Wire protocol docstrings port: 54321 """ + And a file named "features/step_definitions/require_wire.rb" with: + """ + require 'cucumber/wire' + """ Scenario: Run a scenario Given a file named "features/wired.feature" with: diff --git a/features/erb_configuration.feature b/features/erb_configuration.feature index 25fed2e..13b795b 100644 --- a/features/erb_configuration.feature +++ b/features/erb_configuration.feature @@ -12,6 +12,10 @@ Feature: ERB configuration Given we're all wired """ + And a file named "features/step_definitions/require_wire.rb" with: + """ + require 'cucumber/wire' + """ Scenario: ERB is used in the wire file which references an environment variable that is not set Given a file named "features/step_definitions/server.wire" with: diff --git a/features/handle_unexpected_response.feature b/features/handle_unexpected_response.feature index 9b93a77..cb44ea4 100644 --- a/features/handle_unexpected_response.feature +++ b/features/handle_unexpected_response.feature @@ -16,6 +16,10 @@ Feature: Handle unexpected response port: 54321 """ + And a file named "features/step_definitions/require_wire.rb" with: + """ + require 'cucumber/wire' + """ Scenario: Unexpected response Given there is a wire server running on port 54321 which understands the following protocol: diff --git a/features/invoke_message.feature b/features/invoke_message.feature index fa1a35d..11dfb1d 100644 --- a/features/invoke_message.feature +++ b/features/invoke_message.feature @@ -30,7 +30,10 @@ Feature: Invoke message port: 54321 """ - + And a file named "features/step_definitions/require_wire.rb" with: + """ + require 'cucumber/wire' + """ @spawn Scenario: Invoke a step definition which is pending diff --git a/features/snippets_message.feature b/features/snippets_message.feature index d9dc837..08779af 100644 --- a/features/snippets_message.feature +++ b/features/snippets_message.feature @@ -17,6 +17,10 @@ Feature: Snippets message port: 54321 """ + And a file named "features/step_definitions/require_wire.rb" with: + """ + require 'cucumber/wire' + """ @spawn Scenario: Wire server returns snippets for a step that didn't match diff --git a/features/step_matches_message.feature b/features/step_matches_message.feature index 1ad69e3..97f1d43 100644 --- a/features/step_matches_message.feature +++ b/features/step_matches_message.feature @@ -28,6 +28,10 @@ Feature: Step matches message port: 54321 """ + And a file named "features/step_definitions/require_wire.rb" with: + """ + require 'cucumber/wire' + """ Scenario: Dry run finds no step match Given there is a wire server running on port 54321 which understands the following protocol: diff --git a/features/table_diffing.feature b/features/table_diffing.feature index 87278a5..066a5d3 100644 --- a/features/table_diffing.feature +++ b/features/table_diffing.feature @@ -18,6 +18,10 @@ Feature: Wire protocol table diffing port: 54321 """ + And a file named "features/step_definitions/require_wire.rb" with: + """ + require 'cucumber/wire' + """ @spawn Scenario: Invoke a step definition tries to diff the table and fails diff --git a/features/tags.feature b/features/tags.feature index 544e7a3..cdb8dff 100644 --- a/features/tags.feature +++ b/features/tags.feature @@ -10,6 +10,10 @@ Feature: Wire protocol tags port: 54321 """ + And a file named "features/step_definitions/require_wire.rb" with: + """ + require 'cucumber/wire' + """ Scenario: Run a scenario Given a file named "features/wired.feature" with: diff --git a/features/timeouts.feature b/features/timeouts.feature index 6dfde63..7e02d90 100644 --- a/features/timeouts.feature +++ b/features/timeouts.feature @@ -12,6 +12,10 @@ Feature: Wire protocol timeouts Given we're all wired """ + And a file named "features/step_definitions/require_wire.rb" with: + """ + require 'cucumber/wire' + """ Scenario: Try to talk to a server that's not there Given a file named "features/step_definitions/some_remote_place.wire" with: diff --git a/lib/cucumber/wire.rb b/lib/cucumber/wire.rb index 6b7493c..aef0b6b 100644 --- a/lib/cucumber/wire.rb +++ b/lib/cucumber/wire.rb @@ -1,5 +1,5 @@ require 'cucumber/wire/plugin' -AfterConfiguration do |config| - Cucumber::Wire::Plugin.new(config).install +AfterConfiguration do |config, registry| + Cucumber::Wire::Plugin.new(config, registry).install end diff --git a/lib/cucumber/wire/plugin.rb b/lib/cucumber/wire/plugin.rb index 79843cd..40aae66 100644 --- a/lib/cucumber/wire/plugin.rb +++ b/lib/cucumber/wire/plugin.rb @@ -8,6 +8,10 @@ class Plugin attr_reader :config, :registry private :config, :registry + def self.installed? + @@installed ||= false + end + def initialize(config, registry) @config = config @registry = registry @@ -18,6 +22,8 @@ def install config.filters << Filters::ActivateSteps.new(StepMatchSearch.new(connections.method(:step_matches), @config), @config) config.filters << AddHooksFilter.new(connections) unless @config.dry_run? config.register_snippet_generator Snippet::Generator.new(connections) + + @@installed = true end def create_connection(wire_file) diff --git a/lib/cucumber/wire/version b/lib/cucumber/wire/version index 5fe6072..dfda3e0 100644 --- a/lib/cucumber/wire/version +++ b/lib/cucumber/wire/version @@ -1 +1 @@ -6.0.1 +6.1.0