Skip to content

Commit

Permalink
add github action to run AR test with mssql adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseChavez committed Jul 23, 2024
1 parent 8c9fd86 commit 520b089
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
53 changes: 53 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,59 @@ jobs:
run: |
bundle exec rake ${{ matrix.test_targets }}
test-rails-pgsql:

name: Rails Tests (mssql)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version: [ 'jruby-9.4.8.0' ]
db: [ 'postgresql' ]
test_targets: [ "rails:test_mssql" ]
ar_version: ["7-1-stable-dev"]

services:
postgres:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
ACCEPT_EULA: Y
MSSQL_SA_PASSWORD: Password12!
ports:
- 1433:1433
options: >-
--health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P \"Password12!\" -l 30 -Q \"SELECT 1\""
--health-start-period 10s
--health-interval 10s
--health-timeout 5s
--health-retries 10
env:
DB: ${{ matrix.db }}
AR_VERSION: ${{ matrix.ar_version }}
JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
JDBC_SQLITE_VERSION: "3.32.3.3"
SQLUSER: SA
SQLPASS: Password12!

steps:
- uses: actions/checkout@v4
- 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: |
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password12!" -Q "CREATE DATABASE activerecord_unittest;"
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password12!" -Q "CREATE DATABASE activerecord_unittest2;"
- 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)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ elsif ENV['AR_VERSION'] # Use specific version of AR and not .gemspec version
opts = {branch: version}
end

git 'https://github.com/rails/rails.git', **opts do
git 'https://github.com/JesseChavez/rails.git', **opts do
gem 'activerecord', require: false
gem 'activemodel', require: false
gem 'activesupport', require: false
Expand Down

0 comments on commit 520b089

Please sign in to comment.