-
Notifications
You must be signed in to change notification settings - Fork 11
Update CI workflow matrix #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,30 +12,46 @@ jobs: | |
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| ruby: ['2.4', '2.5', '2.6', '2.7', '3.0', jruby-head, truffleruby-head] | ||
| redis: ['4'] | ||
| search: [['opensearch-ruby:2.1.0', 'opensearchproject/opensearch:2.2.1']] | ||
| include: | ||
| # Redis 3 | ||
| - ruby: '2.7' | ||
| redis: '3' | ||
| search: ['opensearch-ruby:2.1.0', 'opensearchproject/opensearch:2.2.1'] | ||
| # Opensearch 1.0 | ||
| - ruby: '2.7' | ||
| redis: '4' | ||
| search: ['opensearch-ruby:1.0.1', 'opensearchproject/opensearch:1.0.1'] | ||
| # Elasticsearch 7.13 | ||
| - ruby: '2.7' | ||
| redis: '4' | ||
| search: ['elasticsearch:7.13.3', 'elasticsearch:7.13.4'] | ||
| # Redis 5 | ||
| - ruby: '2.7' | ||
| ruby: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4', head, jruby-head, truffleruby-head] | ||
| redis: ['4', '5'] | ||
| search: [ | ||
| ['opensearch-ruby:1', 'opensearchproject/opensearch:1'], | ||
| ['opensearch-ruby:2', 'opensearchproject/opensearch:2'], | ||
| ['opensearch-ruby:3', 'opensearchproject/opensearch:3'], | ||
| ['elasticsearch:7', 'elasticsearch:7.17.28'], | ||
| ['elasticsearch:8', 'elasticsearch:8.18.2'], | ||
| ['elasticsearch:9', 'elasticsearch:9.0.2'] | ||
| ] | ||
| exclude: | ||
| # redis 5.x requires ruby >= 2.5 | ||
| - ruby: '2.3' | ||
| redis: '5' | ||
| - ruby: '2.4' | ||
| redis: '5' | ||
| search: ['opensearch-ruby:2.1.0', 'opensearchproject/opensearch:2.2.1'] | ||
| # Ruby 2.3 & Elasticsearch 7.5 | ||
| # opensearch-ruby 1.x requires ruby >= 2.4 | ||
| - ruby: '2.3' | ||
| search: ['opensearch-ruby:1', 'opensearchproject/opensearch:1'] | ||
| - ruby: '2.3' | ||
| search: ['opensearch-ruby:2', 'opensearchproject/opensearch:2'] | ||
| - ruby: '2.3' | ||
| search: ['opensearch-ruby:3', 'opensearchproject/opensearch:3'] | ||
| # opensearch-ruby 3.x requires ruby >= 2.5 | ||
| - ruby: '2.3' | ||
| search: ['opensearch-ruby:3', 'opensearchproject/opensearch:3'] | ||
| - ruby: '2.4' | ||
| search: ['opensearch-ruby:3', 'opensearchproject/opensearch:3'] | ||
| # elasticsearch 8.x requires ruby >= 2.5 | ||
| - ruby: '2.3' | ||
| search: ['elasticsearch:8', 'elasticsearch:8.18.2'] | ||
| - ruby: '2.4' | ||
| search: ['elasticsearch:8', 'elasticsearch:8.18.2'] | ||
| # elasticsearch 9.x requires ruby >= 2.6 | ||
| - ruby: '2.3' | ||
| redis: '4' | ||
| search: ['elasticsearch:7.5.0', 'elasticsearch:7.13.4'] | ||
| search: ['elasticsearch:9', 'elasticsearch:9.0.2'] | ||
| - ruby: '2.4' | ||
| search: ['elasticsearch:9', 'elasticsearch:9.0.2'] | ||
| - ruby: '2.5' | ||
| search: ['elasticsearch:9', 'elasticsearch:9.0.2'] | ||
| services: | ||
| redis: | ||
| image: redis | ||
|
|
@@ -47,7 +63,12 @@ jobs: | |
| - 9200:9200 | ||
| env: | ||
| discovery.type: single-node | ||
| # Disable security for OpenSearch | ||
| plugins.security.disabled: ${{ contains(matrix.search[1], 'opensearch') && 'true' || '' }} | ||
| # OpenSearch 2.12.0 removed the default admin password | ||
| OPENSEARCH_INITIAL_ADMIN_PASSWORD: ${{secrets.OPENSEARCH_INITIAL_ADMIN_PASSWORD}} | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something to keep in mind when setting the secret:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can just choose something and stick it in the file directly right? There's no reason it needs to be secret. |
||
| # Disable security for Elasticsearch 8.x and 9.x | ||
| xpack.security.enabled: ${{ contains(matrix.search[1], 'elasticsearch') && 'false' || '' }} | ||
| options: >- | ||
| --health-cmd="curl http://localhost:9200/_cluster/health" | ||
| --health-interval=3s | ||
|
|
@@ -81,7 +102,7 @@ jobs: | |
| - uses: actions/checkout@v3 | ||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: '2.7' | ||
| ruby-version: '3.4' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather keep these on the lower supported versions I think. Is there a reason you want to change it?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just thought I'd use the latest ruby, happy to revert back to 2.7.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My thinking is that unless it's unreasonable, we should support dev tooling on our supported ruby versions. One way to check if that's the case is by using the older ruby to run it in CI. I think there's a limitation of Rubocop that prevents using the oldest version, and that's how I ended up with 2.7. Of course, we might consider dropping support for some older ones, but hasn't been important yet since older support has been trivial. |
||
| bundler-cache: true | ||
| - run: bundle exec rubocop | ||
|
|
||
|
|
@@ -91,7 +112,7 @@ jobs: | |
| - uses: actions/checkout@v3 | ||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: '2.7' | ||
| ruby-version: '3.4' | ||
| bundler-cache: true | ||
| - run: bin/yardoc --fail-on-warning | ||
|
|
||
|
|
@@ -102,7 +123,7 @@ jobs: | |
| - uses: actions/checkout@v3 | ||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: '2.7' | ||
| ruby-version: '3.4' | ||
| bundler-cache: true | ||
| - run: bin/check-version | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec| | |
| # Other non-essential development dependencies go in the Gemfile. | ||
| spec.add_development_dependency 'connection_pool', '~> 2.0' | ||
| spec.add_development_dependency 'json' | ||
| spec.add_development_dependency 'redis', '>= 3.0' | ||
| spec.add_development_dependency 'redis', '>= 4.0' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to drop support for 3? That's going to be a breaking change.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3 wasn't running in CI, so I opted to drop it instead of adding it there. But you're right, that would warrant a separate PR. |
||
| spec.add_development_dependency 'rspec', '~> 3.8' | ||
| spec.add_development_dependency 'timecop', '>= 0.9' | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,11 @@ | |
| end | ||
|
|
||
| def build_client(**options) | ||
| patched_module::Client.new(options) | ||
| if Gem.loaded_specs['opensearch-ruby'] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks reasonable, but |
||
| ::OpenSearch::Client.new(options) | ||
| else | ||
| ::Elasticsearch::Client.new(options) | ||
| end | ||
| end | ||
|
|
||
| it 'captures patched transport error' do | ||
|
|
@@ -24,7 +28,13 @@ def build_client(**options) | |
| expect(error).to be_a(patched_module::Transport::Transport::Error) | ||
| expect(error.class).to eq(Faulty::Patch::Elasticsearch::Error::CircuitFailureError) | ||
| expect(error).to be_a(Faulty::CircuitErrorBase) | ||
| expect(error.cause).to be_a(Faraday::ConnectionFailed) | ||
| expect(error.cause).to be_a( | ||
| if Gem.loaded_specs['elastic-transport'] | ||
| Elastic::Transport::Transport::Error | ||
| else | ||
| Faraday::ConnectionFailed | ||
| end | ||
| ) | ||
| end | ||
| expect(faulty.circuit('elasticsearch').status.failure_rate).to eq(1) | ||
| end | ||
|
|
@@ -43,15 +53,27 @@ def build_client(**options) | |
|
|
||
| it 'does not capture transport error for unpatched client' do | ||
| expect { unpatched_bad_client.perform_request('GET', '_cluster/state') } | ||
| .to raise_error(Faraday::ConnectionFailed) | ||
| .to raise_error( | ||
| if Gem.loaded_specs['elastic-transport'] | ||
| Elastic::Transport::Transport::Error | ||
| else | ||
| Faraday::ConnectionFailed | ||
| end | ||
| ) | ||
| expect(faulty.circuit('elasticsearch').status.failure_rate).to eq(0) | ||
| end | ||
|
|
||
| it 'raises unpatched errors if configured to' do | ||
| expect { bad_client_unpatched_errors.perform_request('GET', '_cluster/state') } | ||
| .to raise_error do |error| | ||
| expect(error.class).to eq(Faulty::CircuitFailureError) | ||
| expect(error.cause).to be_a(Faraday::ConnectionFailed) | ||
| expect(error.cause).to be_a( | ||
| if Gem.loaded_specs['elastic-transport'] | ||
| Elastic::Transport::Transport::Error | ||
| else | ||
| Faraday::ConnectionFailed | ||
| end | ||
| ) | ||
| end | ||
| expect(faulty.circuit('elasticsearch').status.failure_rate).to eq(1) | ||
| end | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still going to be a pretty big matrix with a lot of CI time, as opposed to the
includeapproach, that just takes a sample of the combinations of supported versions. I'm going to run CI and see what it looks like.