redis-clustering support
#3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: CI | |
| on: | |
| push: | |
| tags: ['v*'] | |
| branches: [master] | |
| pull_request: | |
| branches: ['**'] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| 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'] | |
| redis_cluster: [false, true] | |
| search: [ | |
| ['opensearch-ruby:2', 'opensearchproject/opensearch:2'], | |
| ['opensearch-ruby:3', 'opensearchproject/opensearch:3'], | |
| ['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' | |
| # redis-clustering first release is 5.x | |
| - redis: '4' | |
| redis_cluster: true | |
| # redis-clustering 5.x requires ruby >= 2.7 | |
| - ruby: '2.3' | |
| redis_cluster: true | |
| - ruby: '2.4' | |
| redis_cluster: true | |
| - ruby: '2.5' | |
| redis_cluster: true | |
| - ruby: '2.6' | |
| redis_cluster: true | |
| # our usage of redis-cluster-client suffers from https://bugs.ruby-lang.org/issues/18991 in ruby <= 3.0 | |
| - ruby: '2.7' | |
| redis_cluster: true | |
| - ruby: '3.0' | |
| redis_cluster: true | |
| # opensearch-ruby 2.x requires ruby >= 2.4 | |
| - 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' | |
| 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: | |
| search: | |
| image: ${{ matrix.search[1] }} | |
| ports: | |
| - 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: M7$thunder9K # this doesn't need to be a 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 | |
| --health-timeout=5s | |
| --health-retries=20 | |
| env: | |
| REDIS_VERSION: ${{ matrix.redis }} | |
| REDIS_CLUSTER: ${{ matrix.redis_cluster && 'true' || '' }} | |
| SEARCH_GEM: ${{ matrix.search[0] }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler-cache: true | |
| - name: Start Redis (single instance) | |
| if: ${{ !matrix.redis_cluster }} | |
| run: | | |
| docker run -d --name redis -p 6379:6379 redis | |
| - name: Start Redis Cluster | |
| if: ${{ matrix.redis_cluster }} | |
| run: | | |
| docker compose -f docker-compose.redis-cluster.yml up -d --wait | |
| - name: start MySQL | |
| run: sudo /etc/init.d/mysql start | |
| - run: bundle exec rspec --format doc | |
| env: | |
| MYSQL_USER: root | |
| MYSQL_PASSWORD: root | |
| - uses: codecov/codecov-action@v3 | |
| if: matrix.ruby == '2.7' | |
| with: | |
| files: coverage/coverage.xml | |
| rubocop: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.4' | |
| bundler-cache: true | |
| - run: bundle exec rubocop | |
| yard: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.4' | |
| bundler-cache: true | |
| - run: bin/yardoc --fail-on-warning | |
| check_version: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.4' | |
| bundler-cache: true | |
| - run: bin/check-version | |
| release: | |
| needs: [test, rubocop, yard, check_version] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: dawidd6/action-publish-gem@v1 | |
| with: | |
| api_key: ${{secrets.RUBYGEMS_API_KEY}} |