Skip to content

Commit

Permalink
Speed up CI by tweaking db configs (#3688)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximelkin committed Mar 6, 2020
1 parent 1ae9312 commit 2270c11
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Expand Up @@ -4,21 +4,22 @@ sudo: required
cache:
directories:
- 'node_modules'
# cache typescript libraries
- $HOME/.dts/

matrix:
fast_finish: true
include:
- node_js: '13'
env: DB="mssql mysql mysql2 postgres sqlite3" KNEX_TEST_TIMEOUT=60000
env: DB="oracledb mssql mysql mysql2 postgres sqlite3" KNEX_TEST_TIMEOUT=60000
- node_js: '12'
env: DB="mssql mysql mysql2 postgres sqlite3" KNEX_TEST_TIMEOUT=60000
env: TESTSCRIPT=test:everything DB="oracledb mssql mysql mysql2 postgres sqlite3" KNEX_TEST_TIMEOUT=60000
- node_js: '10'
env: DB="oracledb mssql mysql mysql2 postgres sqlite3" KNEX_TEST_TIMEOUT=60000
- node_js: '8'
env: TESTSCRIPT=test:everything DB="oracledb mssql mysql mysql2 postgres sqlite3" KNEX_TEST_TIMEOUT=60000
env: DB="oracledb mssql mysql mysql2 postgres sqlite3" KNEX_TEST_TIMEOUT=60000
install:
- npm i
- (echo $DB | grep oracledb) && npm install oracledb || true

before_script:
- npm run db:start
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -96,6 +96,7 @@
"mysql": "^2.18.1",
"mysql2": "^2.1.0",
"nyc": "^15.0.0",
"oracledb": "^4.2.0",
"pg": "^7.18.2",
"pg-query-stream": "^2.1.2",
"prettier": "1.18.2",
Expand Down
22 changes: 18 additions & 4 deletions scripts/docker-compose.yml
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
mssql:
image: microsoft/mssql-server-linux:2017-latest
image: mcr.microsoft.com/mssql/server:2017-latest
ports:
- '21433:1433'
environment:
Expand All @@ -11,19 +11,23 @@ services:
healthcheck:
test: /opt/mssql-tools/bin/sqlcmd -S mssql -U sa -P 'S0meVeryHardPassword' -Q 'select 1'
initmssqlknexdb:
image: microsoft/mssql-server-linux:2017-latest
image: mcr.microsoft.com/mssql/server:2017-latest
links:
- mssql
depends_on:
- mssql
entrypoint:
- bash
- -c
- 'until /opt/mssql-tools/bin/sqlcmd -S mssql -U sa -P S0meVeryHardPassword -d master -Q "CREATE DATABASE knex_test"; do sleep 5; done'
# https://docs.microsoft.com/en-us/sql/relational-databases/logs/control-transaction-durability?view=sql-server-ver15#bkmk_DbControl
- 'until /opt/mssql-tools/bin/sqlcmd -S mssql -U sa -P S0meVeryHardPassword -d master -Q "CREATE DATABASE knex_test; ALTER DATABASE knex_test SET DELAYED_DURABILITY = FORCED"; do sleep 5; done'

mysql:
image: mysql
command: --default-authentication-plugin=mysql_native_password
# https://dev.mysql.com/doc/refman/8.0/en/mysql-acid.html
# https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_flush_method
# nosync only for unix, edit for local start on other systems
command: --default-authentication-plugin=mysql_native_password --sync_binlog=0 --innodb_doublewrite=OFF --innodb-flush-log-at-trx-commit=0 --innodb-flush-method=nosync
ports:
- '23306:3306'
environment:
Expand All @@ -46,6 +50,8 @@ services:
timeout: 5s
retries: 3
restart: always
volumes:
- mysql_data:/var/lib/mysql
waitmysql:
image: mysql
links:
Expand All @@ -59,6 +65,8 @@ services:

postgres:
image: postgres:alpine
# see https://www.postgresql.org/docs/current/non-durability.html
command: '-c full_page_writes=off -c fsync=off -c synchronous_commit=off'
ports:
- '25432:5432'
environment:
Expand Down Expand Up @@ -95,3 +103,9 @@ services:
- bash
- -c
- 'until /opt/oracle/product/18c/dbhomeXE/bin/sqlplus -s sys/Oracle18@oracledbxe/XE as sysdba <<< "SELECT 13376411 FROM DUAL; exit;" | grep "13376411"; do echo "Could not connect to oracle... sleep for a while"; sleep 5; done'

volumes:
mysql_data:
driver_opts:
type: tmpfs
device: tmpfs

0 comments on commit 2270c11

Please sign in to comment.