diff --git a/.travis.yml b/.travis.yml index ba07732..c4d38d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,30 +22,27 @@ notifications: sudo: false addons: - mariadb: '10.4' - -script: - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then . ./ci/travis/before_install-osx.sh; fi - - export OLD_PATH=$LD_LIBRARY_PATH - - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`mariadb_config --libs | cut -d ' ' -f1 | sed 's/-L//'` -after_script: - - export LD_LIBRARY_PATH=$OLD_PATH - - unset OLD_PATH + apt: + packages: + - mariadb-server + homebrew: + packages: + - mariadb + after_success: - julia -e 'import Pkg; Pkg.instantiate(); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' jobs: - - stage: tests + include: + - stage: test os: osx julia: 1.1 - env: GROUP=Test script: - julia -e 'import Pkg; Pkg.build(); Pkg.test(coverage=false);' after_success: skip - - stage: examples + - stage: example os: linux julia: 1.1 - env: GROUP=Examples script: - julia -e 'import Pkg; Pkg.instantiate(); include(joinpath(@__DIR__, "examples", "runexamples.jl"))' - stage: deploy documentation diff --git a/src/DBUtils/mysql_db_utils.jl b/src/DBUtils/mysql_db_utils.jl index 5dde4f1..97e2b28 100644 --- a/src/DBUtils/mysql_db_utils.jl +++ b/src/DBUtils/mysql_db_utils.jl @@ -21,11 +21,11 @@ Create a MySQL database using the code inside mysql_code """ function init_mysql_database(host="127.0.0.1", - user="root", pwd="", dbname="test"; overwrite=false, opts = Dict()) + user="root", pswd="", dbname="test"; overwrite=false, opts = Dict()) opts[MySQL.API.MYSQL_SET_CHARSET_NAME] = "utf8mb4" - con = MySQL.connect(host, user, pwd, opts=opts) + con = MySQL.connect(host, user, pswd, opts=opts) init_mysql_database(con, dbname, overwrite) end diff --git a/test/dbutils_mysql.jl b/test/dbutils_mysql.jl index ab81f54..55fcc33 100644 --- a/test/dbutils_mysql.jl +++ b/test/dbutils_mysql.jl @@ -5,7 +5,7 @@ using MySQL dbname="pubmed_test" - conn = DBUtils.init_mysql_database("127.0.0.1", "root", "", dbname) + conn = DBUtils.init_mysql_database(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, dbname) PubMed.create_tables!(conn) println(conn) diff --git a/test/processes_mysql.jl b/test/processes_mysql.jl index 9b5f744..a6bbe36 100644 --- a/test/processes_mysql.jl +++ b/test/processes_mysql.jl @@ -13,9 +13,9 @@ const verbose = false #************************ MYSQL ********************************************** -const host="127.0.0.1" #If want to hide - use enviroment variables instead -const mysql_usr="root" -const mysql_pswd="" +const host=MYSQL_HOST #If want to hide - use enviroment variables instead +const mysql_usr=MYSQL_USER +const mysql_pswd=MYSQL_PASSWORD const dbname="pubmed_processes_test" const dbname_pmid ="pmid_processes_test" const medline_file = 1 diff --git a/test/pubmed.jl b/test/pubmed.jl index e957013..484bd87 100644 --- a/test/pubmed.jl +++ b/test/pubmed.jl @@ -56,11 +56,11 @@ import Base.parse println("-----------------------------------------") println(" Test Save PMID MySQL ") dbname = "entrez_test" - host = "127.0.0.1"; - user = "root" - pwd = "" + host = MYSQL_HOST + user = MYSQL_USER + pswd = MYSQL_PASSWORD - conn = DBUtils.init_mysql_database(host, user, pwd, dbname) + conn = DBUtils.init_mysql_database(host, user, pswd, dbname) PubMed.create_pmid_table!(conn) PubMed.save_pmids!(conn, ids) @@ -78,11 +78,11 @@ import Base.parse println(" Testing MySQL Saving") dbname = "efetch_test" - host = "127.0.0.1"; - user = "root" - pwd = "" + host = MYSQL_HOST + user = MYSQL_USER + pswd = MYSQL_PASSWORD - conn = DBUtils.init_mysql_database(host, user, pwd, dbname) + conn = DBUtils.init_mysql_database(host, user, pswd, dbname) PubMed.create_tables!(conn) @time PubMed.save_efetch!(conn, efetch_doc, false, true) diff --git a/test/runtests.jl b/test/runtests.jl index 3d33a67..5745c5e 100755 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -17,7 +17,6 @@ using MySQL using SQLite using DataStreams - #For now this corresponds to JULIACIBot... since we aren't testing anywhere else global CI = get(ENV, "CI", "false")=="true" global TRAVIS = get(ENV, "TRAVIS", "false")=="true" @@ -39,6 +38,21 @@ all_tests = [ ("processes_df.jl", " Testing: Processes DataFrame") ] if !CI_SKIP_MYSQL + # on MacOS host name must be localhost + if Sys.isapple() + global const MYSQL_HOST = "localhost" + else + global const MYSQL_HOST = "127.0.0.1" + end + + if Sys.isapple() + global const MYSQL_USER = get(ENV, "MYSQL_USER", get(ENV, "LOGNAME", "root")) + else + global const MYSQL_USER = get(ENV, "MYSQL_USER", "root") + end + + global const MYSQL_PASSWORD = get(ENV, "MYSQL_PASSWORD", "") + push!(all_tests, ("dbutils_mysql.jl", " Testing: DBUtils MySQL")) push!(all_tests, ("processes_mysql.jl", " Testing: Processes MySQL")) end