-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
266 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,266 @@ | ||
name: Run ARJDBC and Rails tests | ||
|
||
on: | ||
push: | ||
branches: [ 60-stable, master ] | ||
pull_request: | ||
branches: [ 60-stable, master ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test-rails-mysql: | ||
|
||
name: Rails Tests (MySQL) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ruby-version: ['jruby-9.3.13.0'] | ||
db: ['mysql2'] | ||
test_targets: ["rails:test_mysql2"] | ||
ar_version: ["6-0-stable"] | ||
prepared_statements: ['false', 'true'] | ||
driver: ['MySQL'] | ||
|
||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
ports: | ||
- 3306 | ||
|
||
env: | ||
DB: ${{ matrix.db }} | ||
AR_VERSION: ${{ matrix.ar_version }} | ||
PREPARED_STATEMENTS: ${{ matrix.prepared_statements }} | ||
DRIVER: ${{ matrix.driver }} | ||
JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- name: Setup database | ||
run: | | ||
sudo service mysql start | ||
mysql --version || true # to see if we're using MySQL or MariaDB | ||
mysql -u root -proot -e "CREATE USER rails@localhost;" | ||
mysql -u root -proot -e "grant all privileges on activerecord_unittest.* to rails@localhost;" | ||
mysql -u root -proot -e "grant all privileges on activerecord_unittest2.* to rails@localhost;" | ||
mysql -u root -proot -e "grant all privileges on inexistent_activerecord_unittest.* to rails@localhost;" | ||
mysql -u root -proot -e "CREATE DATABASE activerecord_unittest DEFAULT CHARACTER SET utf8mb4;" | ||
mysql -u root -proot -e "CREATE DATABASE activerecord_unittest2 DEFAULT CHARACTER SET utf8mb4;" | ||
- name: Build | ||
run: | | ||
echo "JAVA_OPTS=$JAVA_OPTS" | ||
rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar | ||
- name: Run tests | ||
run: | | ||
bundle exec rake ${{ matrix.test_targets }} | ||
test-rails-pgsql: | ||
|
||
name: Rails Tests (Postgres) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ruby-version: ['jruby-9.3.13.0'] | ||
db: [ 'postgresql' ] | ||
test_targets: [ "rails:test_postgresql" ] | ||
ar_version: ["6-1-stable"] | ||
prepared_statements: [ 'false', 'true' ] | ||
|
||
services: | ||
postgres: | ||
image: postgres:10 | ||
env: | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_HOST_AUTH_METHOD: trust | ||
ports: | ||
- 5432:5432 | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
env: | ||
DB: ${{ matrix.db }} | ||
AR_VERSION: ${{ matrix.ar_version }} | ||
JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" | ||
PREPARED_STATEMENTS: ${{ matrix.prepared_statements }} | ||
PGHOST: localhost | ||
PGPORT: 5432 | ||
PGUSER: postgres | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- name: Setup database | ||
run: | | ||
psql -c "create database activerecord_unittest;" -U postgres | ||
psql -c "create database activerecord_unittest2;" -U postgres | ||
- name: Build | ||
run: | | ||
rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar | ||
- name: Run tests | ||
run: | | ||
bundle exec rake ${{ matrix.test_targets }} | ||
test-rails-sqlite: | ||
|
||
name: Rails Tests (SQLite) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ruby-version: ['jruby-9.3.13.0'] | ||
db: ['sqlite3'] | ||
test_targets: ["rails:test_sqlite3"] | ||
ar_version: ["6-1-stable"] | ||
|
||
env: | ||
DB: ${{ matrix.db }} | ||
AR_VERSION: ${{ matrix.ar_version }} | ||
JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- name: Build | ||
run: | | ||
echo "JAVA_OPTS=$JAVA_OPTS" | ||
rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar | ||
- name: Run tests | ||
run: | | ||
bundle exec rake ${{ matrix.test_targets }} | ||
test-arjdbc-mysql: | ||
|
||
name: ARJDBC Tests (MySQL) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ruby-version: ['jruby-9.3.13.0'] | ||
db: ['mysql2'] | ||
test_targets: ["db:mysql test_mysql2"] | ||
prepared_statements: ['false', 'true'] | ||
driver: ['MySQL'] | ||
|
||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
ports: | ||
- 3306 | ||
|
||
env: | ||
DB: ${{ matrix.db }} | ||
DRIVER: ${{ matrix.driver }} | ||
JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" | ||
MY_USER: root | ||
MY_PASSWORD: root | ||
PREPARED_STATEMENTS: ${{ matrix.prepared_statements }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- name: Setup database | ||
run: | | ||
sudo service mysql start | ||
mysql --version || true # to see if we're using MySQL or MariaDB | ||
- name: Build | ||
run: | | ||
rake jar | ||
- name: Run tests | ||
run: | | ||
bundle exec rake ${{ matrix.test_targets }} | ||
test-arjdbc-pgsql: | ||
|
||
name: ARJDBC Tests (Postgres) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ruby-version: ['jruby-9.3.13.0'] | ||
db: ['postgresql'] | ||
test_targets: ["db:postgresql test_postgresql"] | ||
prepared_statements: ['false', 'true'] | ||
insert_returning: ['false', 'true'] | ||
|
||
services: | ||
postgres: | ||
image: postgres:10 | ||
env: | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_HOST_AUTH_METHOD: trust | ||
ports: | ||
- 5432:5432 | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
env: | ||
DB: ${{ matrix.db }} | ||
DRIVER: ${{ matrix.driver }} | ||
JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" | ||
PREPARED_STATEMENTS: ${{ matrix.prepared_statements }} | ||
INSERT_RETURNING: ${{ matrix.insert_returning }} | ||
PGHOST: localhost | ||
PGPORT: 5432 | ||
PGUSER: postgres | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- name: Build | ||
run: | | ||
rake jar | ||
- name: Run tests | ||
run: | | ||
bundle exec rake ${{ matrix.test_targets }} | ||
test-arjdbc-sqlite: | ||
|
||
name: ARJDBC Tests (SQLite) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ruby-version: ['jruby-9.3.13.0'] | ||
db: ['sqlite3'] | ||
test_targets: ['test_sqlite3'] | ||
|
||
env: | ||
DB: ${{ matrix.db }} | ||
JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- name: Build | ||
run: | | ||
rake jar | ||
- name: Run tests | ||
run: | | ||
bundle exec rake ${{ matrix.test_targets }} |