From 897d15fb61b3c76807b03a51272eabb5c8ad342e Mon Sep 17 00:00:00 2001 From: Carlos Palhares Date: Thu, 9 May 2024 18:15:56 -0300 Subject: [PATCH] Add multi-adapter workflow --- .github/workflows/audiences-pg.yml | 70 ++++++++++++++++++++++++ audiences/spec/dummy/config/database.yml | 20 +++---- 2 files changed, 80 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/audiences-pg.yml diff --git a/.github/workflows/audiences-pg.yml b/.github/workflows/audiences-pg.yml new file mode 100644 index 00000000..fc85353f --- /dev/null +++ b/.github/workflows/audiences-pg.yml @@ -0,0 +1,70 @@ +name: audiences + +on: + push: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }} + strategy: + fail-fast: false + matrix: + ruby: + - 3.0 + - 3.1 + - 3.2 + - 3.3 + gemfile: + - gemfiles/rails_6_1.gemfile + - gemfiles/rails_7_0.gemfile + - gemfiles/rails_7_1.gemfile + exclude: + - ruby: 3.2 + gemfile: gemfiles/rails_6_1.gemfile + - ruby: 3.3 + gemfile: gemfiles/rails_6_1.gemfile + services: + postgres: + image: postgres:latest + env: + POSTGRES_DB: test + POSTGRES_USER: pguser + POSTGRES_PASSWORD: pgpass + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + steps: + - uses: actions/checkout@v3 + - name: Install non-ruby dependencies + run: sudo apt-get install libpq-dev + - name: 'mysql2 adapter' + uses: powerhome/github-actions-workflows/ruby-gem@rubygem-action + env: + DATABASE_ADAPTER: mysql2 + DATABASE_USER: root + DATABASE_PASS: root + DATABASE_HOST: 127.0.0.1 + DATABASE_PORT: 3306 + with: + workdir: audiences + ruby: ${{ matrix.ruby }} + gemfile: ${{ matrix.gemfile }} + - name: 'postgresql adapter' + uses: powerhome/github-actions-workflows/ruby-gem@rubygem-action + env: + DATABASE_ADAPTER: postgresql + DATABASE_USER: pguser + DATABASE_PASS: pgpass + DATABASE_HOST: 127.0.0.1 + DATABASE_PORT: 5432 + with: + workdir: audiences + ruby: ${{ matrix.ruby }} + gemfile: ${{ matrix.gemfile }} + + license-compliance: + uses: ralexander-phi/license_approval@master + with: + working_directory: audiences + license_finder_version: 7.2.1 \ No newline at end of file diff --git a/audiences/spec/dummy/config/database.yml b/audiences/spec/dummy/config/database.yml index c8bab574..5f2bba20 100644 --- a/audiences/spec/dummy/config/database.yml +++ b/audiences/spec/dummy/config/database.yml @@ -1,19 +1,19 @@ development: - adapter: mysql2 + adapter: <%= ENV.fetch("DATABASE_ADAPTER", "mysql2") %> pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 - username: <%= ENV.fetch("MYSQL_USER", "root") %> - password: <%= ENV.fetch("MYSQL_PASS", "root") %> - host: <%= ENV.fetch("MYSQL_HOST", "127.0.0.1") %> - port: 3306 + username: <%= ENV.fetch("DATABASE_USER", "root") %> + password: <%= ENV.fetch("DATABASE_PASS", "root") %> + host: <%= ENV.fetch("DATABASE_HOST", "127.0.0.1") %> + port: <%= ENV.fetch("DATABASE_PORT", "3306") %> database: development test: - adapter: mysql2 + adapter: <%= ENV.fetch("DATABASE_ADAPTER", "mysql2") %> pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 - username: <%= ENV.fetch("MYSQL_USER", "root") %> - password: <%= ENV.fetch("MYSQL_PASS", "root") %> - host: <%= ENV.fetch("MYSQL_HOST", "127.0.0.1") %> - port: 3306 + username: <%= ENV.fetch("DATABASE_USER", "root") %> + password: <%= ENV.fetch("DATABASE_PASS", "root") %> + host: <%= ENV.fetch("DATABASE_HOST", "127.0.0.1") %> + port: <%= ENV.fetch("DATABASE_PORT", "3306") %> database: test