|
| 1 | +name: Run ARJDBC and Rails tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 60-stable, master ] |
| 6 | + pull_request: |
| 7 | + branches: [ 60-stable, master ] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + test-rails-mysql: |
| 14 | + |
| 15 | + name: Rails Tests (MySQL) |
| 16 | + runs-on: ubuntu-latest |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + ruby-version: ['jruby-9.3.13.0'] |
| 21 | + db: ['mysql2'] |
| 22 | + test_targets: ["rails:test_mysql2"] |
| 23 | + ar_version: ["6-0-stable"] |
| 24 | + prepared_statements: ['false', 'true'] |
| 25 | + driver: ['MySQL'] |
| 26 | + |
| 27 | + services: |
| 28 | + mysql: |
| 29 | + image: mysql:5.7 |
| 30 | + ports: |
| 31 | + - 3306 |
| 32 | + |
| 33 | + env: |
| 34 | + DB: ${{ matrix.db }} |
| 35 | + AR_VERSION: ${{ matrix.ar_version }} |
| 36 | + PREPARED_STATEMENTS: ${{ matrix.prepared_statements }} |
| 37 | + DRIVER: ${{ matrix.driver }} |
| 38 | + JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" |
| 39 | + |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v3 |
| 42 | + - name: Set up Ruby |
| 43 | + uses: ruby/setup-ruby@v1 |
| 44 | + with: |
| 45 | + ruby-version: ${{ matrix.ruby-version }} |
| 46 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 47 | + - name: Setup database |
| 48 | + run: | |
| 49 | + sudo service mysql start |
| 50 | + mysql --version || true # to see if we're using MySQL or MariaDB |
| 51 | + mysql -u root -proot -e "CREATE USER rails@localhost;" |
| 52 | + mysql -u root -proot -e "grant all privileges on activerecord_unittest.* to rails@localhost;" |
| 53 | + mysql -u root -proot -e "grant all privileges on activerecord_unittest2.* to rails@localhost;" |
| 54 | + mysql -u root -proot -e "grant all privileges on inexistent_activerecord_unittest.* to rails@localhost;" |
| 55 | + mysql -u root -proot -e "CREATE DATABASE activerecord_unittest DEFAULT CHARACTER SET utf8mb4;" |
| 56 | + mysql -u root -proot -e "CREATE DATABASE activerecord_unittest2 DEFAULT CHARACTER SET utf8mb4;" |
| 57 | + - name: Build |
| 58 | + run: | |
| 59 | + echo "JAVA_OPTS=$JAVA_OPTS" |
| 60 | + rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar |
| 61 | + - name: Run tests |
| 62 | + run: | |
| 63 | + bundle exec rake ${{ matrix.test_targets }} |
| 64 | +
|
| 65 | + test-rails-pgsql: |
| 66 | + |
| 67 | + name: Rails Tests (Postgres) |
| 68 | + runs-on: ubuntu-latest |
| 69 | + strategy: |
| 70 | + fail-fast: false |
| 71 | + matrix: |
| 72 | + ruby-version: ['jruby-9.3.13.0'] |
| 73 | + db: [ 'postgresql' ] |
| 74 | + test_targets: [ "rails:test_postgresql" ] |
| 75 | + ar_version: ["6-1-stable"] |
| 76 | + prepared_statements: [ 'false', 'true' ] |
| 77 | + |
| 78 | + services: |
| 79 | + postgres: |
| 80 | + image: postgres:10 |
| 81 | + env: |
| 82 | + POSTGRES_PASSWORD: postgres |
| 83 | + POSTGRES_HOST_AUTH_METHOD: trust |
| 84 | + ports: |
| 85 | + - 5432:5432 |
| 86 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 87 | + |
| 88 | + env: |
| 89 | + DB: ${{ matrix.db }} |
| 90 | + AR_VERSION: ${{ matrix.ar_version }} |
| 91 | + JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" |
| 92 | + PREPARED_STATEMENTS: ${{ matrix.prepared_statements }} |
| 93 | + PGHOST: localhost |
| 94 | + PGPORT: 5432 |
| 95 | + PGUSER: postgres |
| 96 | + |
| 97 | + steps: |
| 98 | + - uses: actions/checkout@v3 |
| 99 | + - name: Set up Ruby |
| 100 | + uses: ruby/setup-ruby@v1 |
| 101 | + with: |
| 102 | + ruby-version: ${{ matrix.ruby-version }} |
| 103 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 104 | + - name: Setup database |
| 105 | + run: | |
| 106 | + psql -c "create database activerecord_unittest;" -U postgres |
| 107 | + psql -c "create database activerecord_unittest2;" -U postgres |
| 108 | + - name: Build |
| 109 | + run: | |
| 110 | + rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar |
| 111 | + - name: Run tests |
| 112 | + run: | |
| 113 | + bundle exec rake ${{ matrix.test_targets }} |
| 114 | +
|
| 115 | + test-rails-sqlite: |
| 116 | + |
| 117 | + name: Rails Tests (SQLite) |
| 118 | + runs-on: ubuntu-latest |
| 119 | + strategy: |
| 120 | + fail-fast: false |
| 121 | + matrix: |
| 122 | + ruby-version: ['jruby-9.3.13.0'] |
| 123 | + db: ['sqlite3'] |
| 124 | + test_targets: ["rails:test_sqlite3"] |
| 125 | + ar_version: ["6-1-stable"] |
| 126 | + |
| 127 | + env: |
| 128 | + DB: ${{ matrix.db }} |
| 129 | + AR_VERSION: ${{ matrix.ar_version }} |
| 130 | + JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" |
| 131 | + |
| 132 | + steps: |
| 133 | + - uses: actions/checkout@v3 |
| 134 | + - name: Set up Ruby |
| 135 | + uses: ruby/setup-ruby@v1 |
| 136 | + with: |
| 137 | + ruby-version: ${{ matrix.ruby-version }} |
| 138 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 139 | + - name: Build |
| 140 | + run: | |
| 141 | + echo "JAVA_OPTS=$JAVA_OPTS" |
| 142 | + rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar |
| 143 | + - name: Run tests |
| 144 | + run: | |
| 145 | + bundle exec rake ${{ matrix.test_targets }} |
| 146 | +
|
| 147 | + test-arjdbc-mysql: |
| 148 | + |
| 149 | + name: ARJDBC Tests (MySQL) |
| 150 | + runs-on: ubuntu-latest |
| 151 | + strategy: |
| 152 | + fail-fast: false |
| 153 | + matrix: |
| 154 | + ruby-version: ['jruby-9.3.13.0'] |
| 155 | + db: ['mysql2'] |
| 156 | + test_targets: ["db:mysql test_mysql2"] |
| 157 | + prepared_statements: ['false', 'true'] |
| 158 | + driver: ['MySQL'] |
| 159 | + |
| 160 | + services: |
| 161 | + mysql: |
| 162 | + image: mysql:5.7 |
| 163 | + ports: |
| 164 | + - 3306 |
| 165 | + |
| 166 | + env: |
| 167 | + DB: ${{ matrix.db }} |
| 168 | + DRIVER: ${{ matrix.driver }} |
| 169 | + JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" |
| 170 | + MY_USER: root |
| 171 | + MY_PASSWORD: root |
| 172 | + PREPARED_STATEMENTS: ${{ matrix.prepared_statements }} |
| 173 | + |
| 174 | + steps: |
| 175 | + - uses: actions/checkout@v3 |
| 176 | + - name: Set up Ruby |
| 177 | + uses: ruby/setup-ruby@v1 |
| 178 | + with: |
| 179 | + ruby-version: ${{ matrix.ruby-version }} |
| 180 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 181 | + - name: Setup database |
| 182 | + run: | |
| 183 | + sudo service mysql start |
| 184 | + mysql --version || true # to see if we're using MySQL or MariaDB |
| 185 | + - name: Build |
| 186 | + run: | |
| 187 | + rake jar |
| 188 | + - name: Run tests |
| 189 | + run: | |
| 190 | + bundle exec rake ${{ matrix.test_targets }} |
| 191 | +
|
| 192 | + test-arjdbc-pgsql: |
| 193 | + |
| 194 | + name: ARJDBC Tests (Postgres) |
| 195 | + runs-on: ubuntu-latest |
| 196 | + strategy: |
| 197 | + fail-fast: false |
| 198 | + matrix: |
| 199 | + ruby-version: ['jruby-9.3.13.0'] |
| 200 | + db: ['postgresql'] |
| 201 | + test_targets: ["db:postgresql test_postgresql"] |
| 202 | + prepared_statements: ['false', 'true'] |
| 203 | + insert_returning: ['false', 'true'] |
| 204 | + |
| 205 | + services: |
| 206 | + postgres: |
| 207 | + image: postgres:10 |
| 208 | + env: |
| 209 | + POSTGRES_PASSWORD: postgres |
| 210 | + POSTGRES_HOST_AUTH_METHOD: trust |
| 211 | + ports: |
| 212 | + - 5432:5432 |
| 213 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 214 | + |
| 215 | + env: |
| 216 | + DB: ${{ matrix.db }} |
| 217 | + DRIVER: ${{ matrix.driver }} |
| 218 | + JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" |
| 219 | + PREPARED_STATEMENTS: ${{ matrix.prepared_statements }} |
| 220 | + INSERT_RETURNING: ${{ matrix.insert_returning }} |
| 221 | + PGHOST: localhost |
| 222 | + PGPORT: 5432 |
| 223 | + PGUSER: postgres |
| 224 | + |
| 225 | + steps: |
| 226 | + - uses: actions/checkout@v3 |
| 227 | + - name: Set up Ruby |
| 228 | + uses: ruby/setup-ruby@v1 |
| 229 | + with: |
| 230 | + ruby-version: ${{ matrix.ruby-version }} |
| 231 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 232 | + - name: Build |
| 233 | + run: | |
| 234 | + rake jar |
| 235 | + - name: Run tests |
| 236 | + run: | |
| 237 | + bundle exec rake ${{ matrix.test_targets }} |
| 238 | +
|
| 239 | + test-arjdbc-sqlite: |
| 240 | + |
| 241 | + name: ARJDBC Tests (SQLite) |
| 242 | + runs-on: ubuntu-latest |
| 243 | + strategy: |
| 244 | + fail-fast: false |
| 245 | + matrix: |
| 246 | + ruby-version: ['jruby-9.3.13.0'] |
| 247 | + db: ['sqlite3'] |
| 248 | + test_targets: ['test_sqlite3'] |
| 249 | + |
| 250 | + env: |
| 251 | + DB: ${{ matrix.db }} |
| 252 | + JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" |
| 253 | + |
| 254 | + steps: |
| 255 | + - uses: actions/checkout@v3 |
| 256 | + - name: Set up Ruby |
| 257 | + uses: ruby/setup-ruby@v1 |
| 258 | + with: |
| 259 | + ruby-version: ${{ matrix.ruby-version }} |
| 260 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 261 | + - name: Build |
| 262 | + run: | |
| 263 | + rake jar |
| 264 | + - name: Run tests |
| 265 | + run: | |
| 266 | + bundle exec rake ${{ matrix.test_targets }} |
0 commit comments