From 693944158bc9523f55f3c0d3b9e27f78b3f03b3e Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Thu, 25 May 2023 02:37:57 -0700 Subject: [PATCH] Add Github actions for individual modules and examples (#13) --- .github/workflows/examples-core_minitest.yml | 28 ++++++++++++++++ .github/workflows/examples-core_rspec.yml | 28 ++++++++++++++++ .github/workflows/examples-memcached.yml | 28 ++++++++++++++++ .github/workflows/examples-mysql_rspec.yml | 28 ++++++++++++++++ .github/workflows/examples-redis_rspec.yml | 28 ++++++++++++++++ .github/workflows/main.yml | 6 ++-- .github/workflows/module-core.yml | 34 ++++++++++++++++++++ .github/workflows/module-elasticsearch.yml | 34 ++++++++++++++++++++ .github/workflows/module-mariadb.yml | 34 ++++++++++++++++++++ .github/workflows/module-mongo.yml | 34 ++++++++++++++++++++ .github/workflows/module-mysql.yml | 34 ++++++++++++++++++++ .github/workflows/module-nginx.yml | 34 ++++++++++++++++++++ .github/workflows/module-postgres.yml | 34 ++++++++++++++++++++ .github/workflows/module-redis.yml | 34 ++++++++++++++++++++ examples/redis_backed_cache_minitest.rb | 1 + examples/redis_backed_cache_rspec.rb | 1 + 16 files changed, 417 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/examples-core_minitest.yml create mode 100644 .github/workflows/examples-core_rspec.yml create mode 100644 .github/workflows/examples-memcached.yml create mode 100644 .github/workflows/examples-mysql_rspec.yml create mode 100644 .github/workflows/examples-redis_rspec.yml create mode 100644 .github/workflows/module-core.yml create mode 100644 .github/workflows/module-elasticsearch.yml create mode 100644 .github/workflows/module-mariadb.yml create mode 100644 .github/workflows/module-mongo.yml create mode 100644 .github/workflows/module-mysql.yml create mode 100644 .github/workflows/module-nginx.yml create mode 100644 .github/workflows/module-postgres.yml create mode 100644 .github/workflows/module-redis.yml diff --git a/.github/workflows/examples-core_minitest.yml b/.github/workflows/examples-core_minitest.yml new file mode 100644 index 0000000..4232e43 --- /dev/null +++ b/.github/workflows/examples-core_minitest.yml @@ -0,0 +1,28 @@ +name: "Examples: Core module with Redis (Minitest)" + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.2.0' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run the example + working-directory: ./examples + run: ruby redis_backed_cache_minitest.rb diff --git a/.github/workflows/examples-core_rspec.yml b/.github/workflows/examples-core_rspec.yml new file mode 100644 index 0000000..73172f9 --- /dev/null +++ b/.github/workflows/examples-core_rspec.yml @@ -0,0 +1,28 @@ +name: "Examples: Core module with Redis (RSpec)" + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.2.0' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run the example + working-directory: ./examples + run: ruby redis_backed_cache_rspec.rb diff --git a/.github/workflows/examples-memcached.yml b/.github/workflows/examples-memcached.yml new file mode 100644 index 0000000..3caf16d --- /dev/null +++ b/.github/workflows/examples-memcached.yml @@ -0,0 +1,28 @@ +name: "Examples: Core module with Memcached (RSpec)" + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.2.0' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run the example + working-directory: ./examples + run: ruby memcached_rspec.rb diff --git a/.github/workflows/examples-mysql_rspec.yml b/.github/workflows/examples-mysql_rspec.yml new file mode 100644 index 0000000..cbfe7b6 --- /dev/null +++ b/.github/workflows/examples-mysql_rspec.yml @@ -0,0 +1,28 @@ +name: "Examples: MySQL module (ActiveRecord + RSpec)" + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.2.0' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run the example + working-directory: ./examples + run: ruby mysql_ar_rspec.rb diff --git a/.github/workflows/examples-redis_rspec.yml b/.github/workflows/examples-redis_rspec.yml new file mode 100644 index 0000000..09ad2eb --- /dev/null +++ b/.github/workflows/examples-redis_rspec.yml @@ -0,0 +1,28 @@ +name: "Examples: Redis module (RSpec)" + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.2.0' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run the example + working-directory: ./examples + run: ruby redis_container_rspec.rb diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9541344..5b27ff5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Ruby +name: "Ruby CI: Style Checks with Standard" on: push: @@ -23,5 +23,5 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Run the default task - run: bundle exec rake + - name: Run standard code style checks + run: bundle exec rake standard diff --git a/.github/workflows/module-core.yml b/.github/workflows/module-core.yml new file mode 100644 index 0000000..980308d --- /dev/null +++ b/.github/workflows/module-core.yml @@ -0,0 +1,34 @@ +name: "Modules: Core tests" + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.2.0' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Install development dependencies + working-directory: ./core + run: bundle install + - name: Run the tests + working-directory: ./core + run: bundle exec rake test + - name: Run standard code style checks + working-directory: ./core + run: bundle exec rake standard diff --git a/.github/workflows/module-elasticsearch.yml b/.github/workflows/module-elasticsearch.yml new file mode 100644 index 0000000..ce7d867 --- /dev/null +++ b/.github/workflows/module-elasticsearch.yml @@ -0,0 +1,34 @@ +name: "Modules: ElasticSearch tests" + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.2.0' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Install development dependencies + working-directory: ./elasticsearch + run: bundle install + - name: Run the tests + working-directory: ./elasticsearch + run: bundle exec rake test + - name: Run standard code style checks + working-directory: ./elasticsearch + run: bundle exec rake standard diff --git a/.github/workflows/module-mariadb.yml b/.github/workflows/module-mariadb.yml new file mode 100644 index 0000000..eb5249b --- /dev/null +++ b/.github/workflows/module-mariadb.yml @@ -0,0 +1,34 @@ +name: "Modules: MariaDB tests" + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.2.0' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Install development dependencies + working-directory: ./mariadb + run: bundle install + - name: Run the tests + working-directory: ./mariadb + run: bundle exec rake test + - name: Run standard code style checks + working-directory: ./mariadb + run: bundle exec rake standard diff --git a/.github/workflows/module-mongo.yml b/.github/workflows/module-mongo.yml new file mode 100644 index 0000000..696c32b --- /dev/null +++ b/.github/workflows/module-mongo.yml @@ -0,0 +1,34 @@ +name: "Modules: MongoDB tests" + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.2.0' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Install development dependencies + working-directory: ./mongo + run: bundle install + - name: Run the tests + working-directory: ./mongo + run: bundle exec rake test + - name: Run standard code style checks + working-directory: ./mongo + run: bundle exec rake standard diff --git a/.github/workflows/module-mysql.yml b/.github/workflows/module-mysql.yml new file mode 100644 index 0000000..033c3af --- /dev/null +++ b/.github/workflows/module-mysql.yml @@ -0,0 +1,34 @@ +name: "Modules: MySQL tests" + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.2.0' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Install development dependencies + working-directory: ./mysql + run: bundle install + - name: Run the tests + working-directory: ./mysql + run: bundle exec rake test + - name: Run standard code style checks + working-directory: ./mysql + run: bundle exec rake standard diff --git a/.github/workflows/module-nginx.yml b/.github/workflows/module-nginx.yml new file mode 100644 index 0000000..4fb6f11 --- /dev/null +++ b/.github/workflows/module-nginx.yml @@ -0,0 +1,34 @@ +name: "Modules: Nginx tests" + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.2.0' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Install development dependencies + working-directory: ./nginx + run: bundle install + - name: Run the tests + working-directory: ./nginx + run: bundle exec rake test + - name: Run standard code style checks + working-directory: ./nginx + run: bundle exec rake standard diff --git a/.github/workflows/module-postgres.yml b/.github/workflows/module-postgres.yml new file mode 100644 index 0000000..f5b9172 --- /dev/null +++ b/.github/workflows/module-postgres.yml @@ -0,0 +1,34 @@ +name: "Modules: Postgres tests" + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.2.0' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Install development dependencies + working-directory: ./postgres + run: bundle install + - name: Run the tests + working-directory: ./postgres + run: bundle exec rake test + - name: Run standard code style checks + working-directory: ./postgres + run: bundle exec rake standard diff --git a/.github/workflows/module-redis.yml b/.github/workflows/module-redis.yml new file mode 100644 index 0000000..8c8abbd --- /dev/null +++ b/.github/workflows/module-redis.yml @@ -0,0 +1,34 @@ +name: "Modules: Redis tests" + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.2.0' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Install development dependencies + working-directory: ./redis + run: bundle install + - name: Run the tests + working-directory: ./redis + run: bundle exec rake test + - name: Run standard code style checks + working-directory: ./redis + run: bundle exec rake standard diff --git a/examples/redis_backed_cache_minitest.rb b/examples/redis_backed_cache_minitest.rb index 5131c21..696a8f4 100644 --- a/examples/redis_backed_cache_minitest.rb +++ b/examples/redis_backed_cache_minitest.rb @@ -38,6 +38,7 @@ def before_all @redis_container = Testcontainers::DockerContainer.new("redis:6.2-alpine").with_exposed_ports(6379) @redis_container.start @redis_container.wait_for_tcp_port(6379) + @redis_container.wait_for_logs(/Ready to accept connections/) end def after_all diff --git a/examples/redis_backed_cache_rspec.rb b/examples/redis_backed_cache_rspec.rb index 03feb9e..30096ad 100644 --- a/examples/redis_backed_cache_rspec.rb +++ b/examples/redis_backed_cache_rspec.rb @@ -34,6 +34,7 @@ def clear config.redis = Testcontainers::DockerContainer.new("redis:6.2-alpine").with_exposed_ports("6379") config.redis.start config.redis.wait_for_tcp_port("6379") # wait for Redis to start + config.redis.wait_for_logs(/Ready to accept connections/) end config.after(:suite) do