Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Setup CI
  • Loading branch information
Carlos Silva
Carlos Silva committed Aug 31, 2023
commit 677cbdee5301588c46dd95a2502ffec1cdca0cb7
17 changes: 13 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@ jobs:
test:
name: "Run tests (${{ matrix.ruby }})"
runs-on: ubuntu-latest
env:
MYSQL_HOST: '127.0.0.1'
MYSQL_USER: gql
MYSQL_PASSWORD: gqlpassword
services:
mysql:
image: mysql:8.0
env:
MYSQL_HOST: '127.0.0.1'
MYSQL_HOST: ${{ env.MYSQL_HOST }}
MYSQL_DB: starwars
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ROOT_PASSWORD: ''
MYSQL_USER: ${{ env.MYSQL_USER }}
MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }}
MYSQL_RANDOM_ROOT_PASSWORD: yes
ports:
- "3306:3306"
options: >-
Expand All @@ -47,11 +52,15 @@ jobs:
bundler-cache: false
- run: sudo apt-get install libsqlite3-dev -y
name: Setup Sqlite
- run: mysql -h 127.0.0.1 --user=root --execute="show databases;"
name: List Databases
- run: bundle install
- run: bundle exec rake compile
- run: bundle exec rake test
env:
GQL_MYSQL_HOST: '127.0.0.1'
GQL_MYSQL_HOST: ${{ env.MYSQL_HOST }}
GQL_MYSQL_USERNAME: ${{ env.MYSQL_USER }}
GQL_MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }}
GQL_MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}

mac_compile:
Expand Down
6 changes: 3 additions & 3 deletions test/integration/schemas/mysql.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
require 'active_record'

puts '****************************************************'
puts ENV.inspect
puts ENV.to_json

class MySQLRecord < ActiveRecord::Base
self.abstract_class = true

establish_connection(
name: 'mysql',
adapter: 'mysql2',
host: ENV.fetch('GQL_MYSQL_HOST', '127.0.0.1'),
host: ENV.fetch('GQL_MYSQL_HOST', 'localhost'),
database: ENV.fetch('GQL_MYSQL_DATABASE', 'starwars'),
username: ENV.fetch('GQL_MYSQL_USERNAME', 'root'),
password: ENV['GQL_MYSQL_PASSWORD'],
port: ENV.fetch('GQL_MYSQL_PORT', '3306'),
port: ENV['GQL_MYSQL_PORT'],
)
end

Expand Down