From a7a80e0e9ad8bd5afa6f85f41b6405d5dc763208 Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 15 Apr 2019 01:26:45 -0400 Subject: [PATCH] [Fix] try to fix errors --- .travis.yml | 86 +++++++-------------------------------------- install.sh | 2 +- tests/travis_env.sh | 40 ++++++++++++++------- 3 files changed, 41 insertions(+), 87 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6224b4a2..d9a7538f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,8 @@ services: - postgresql before_script: - - psql -d postgresql://postgres:@localhost -c "create database vnpy;" - - mysql -e 'CREATE DATABASE vnpy;' + - psql -d postgresql://postgres:${VNPY_TEST_POSTGRESQL_PASSWORD}@localhost -c "create database vnpy;" + - mysql -u root --password=${VNPY_TEST_MYSQL_PASSWORD} -e 'CREATE DATABASE vnpy;' script: # todo: use python unittest @@ -23,16 +23,6 @@ script: matrix: include: - - name: "code quality analysis: flake8" - services: [] # service is not need - before_script: [] - before_install: - - pip install flake8 - install: - - "" # prevent running "pip install -r requirements.txt" - script: - - flake8 - - name: "pip install under Windows" os: "windows" services: [] # service is unavailable under windows @@ -42,7 +32,9 @@ matrix: - PATH="/c/Python37:/c/Python37/Scripts:/c/tools/mysql/current/bin:/c/Program Files/PostgreSQL/10/bin:$PATH" before_install: - choco install -yf mysql mongodb - - choco install -yf postgresql10 --params '/Password:' + # I don't know how enable a "trust" auth method in choco installed psql + - choco install -yf postgresql10 --params '/Password:1234' + - export VNPY_TEST_POSTGRESQL_PASSWORD=1234 - choco install -yf python3 --version 3.7.2 install: - python -m pip install --upgrade pip wheel setuptools @@ -51,22 +43,15 @@ matrix: - pip install -r requirements.txt - pip install . - - name: "pip install under Ubuntu: gcc-7" - before_install: - # C++17 - - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - - sudo apt-get update -y + - name: "pip install under osx" + os: osx + services: [] + before_script: [] + language: shell # osx supports only shell + before_install: [] install: - # C++17 - - sudo apt-get install -y gcc-7 g++-7 - - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90 - - sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-7 90 - - sudo update-alternatives --install /usr/bin/gcc cc /usr/bin/gcc-7 90 - # update pip & setuptools - - python -m pip install --upgrade pip wheel setuptools - # Linux install script - - pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl - - bash ./install.sh + - pip3 install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl + - bash ./install.sh python3 pip3 - name: "pip install under Ubuntu: gcc-8" before_install: @@ -84,48 +69,3 @@ matrix: # Linux install script - pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl - bash ./install.sh - - - name: "sdist install under Windows" - os: "windows" - services: [] # service is not need - before_script: [] - # language : cpp is necessary for windows - language: "cpp" - env: - - PATH="/c/Python37:/c/Python37/Scripts:/c/tools/mysql/current/bin:/c/Program Files/PostgreSQL/10/bin:$PATH" - before_install: - - choco install -yf mysql mongodb - - choco install -yf postgresql10 --params '/Password:' - - choco install -yf python3 --version 3.7.2 - install: - - python -m pip install --upgrade pip wheel setuptools - - python setup.py sdist - - pip install https://pip.vnpy.com/colletion/TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl - - pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl - - pip install dist/`ls dist` - - - name: "sdist install under Ubuntu: gcc-8" - before_install: - # C++17 - - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - - sudo apt-get update -y - install: - # C++17 - - sudo apt-get install -y gcc-8 g++-8 - - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90 - - sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-8 90 - - sudo update-alternatives --install /usr/bin/gcc cc /usr/bin/gcc-8 90 - # Linux install script - - python -m pip install --upgrade pip wheel setuptools - - pushd /tmp - - wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz - - tar -xf ta-lib-0.4.0-src.tar.gz - - cd ta-lib - - ./configure --prefix=/usr - - make - - sudo make install - - popd - - pip install numpy - - pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl - - python setup.py sdist - - pip install dist/`ls dist` diff --git a/install.sh b/install.sh index 12a08096..3f445045 100644 --- a/install.sh +++ b/install.sh @@ -11,7 +11,7 @@ pushd /tmp wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz tar -xf ta-lib-0.4.0-src.tar.gz cd ta-lib -./configure --prefix=/usr +./configure --prefix=/usr/local make sudo make install popd diff --git a/tests/travis_env.sh b/tests/travis_env.sh index 030d79c5..e2e59613 100644 --- a/tests/travis_env.sh +++ b/tests/travis_env.sh @@ -1,16 +1,30 @@ #!/usr/bin/env bash -export VNPY_TEST_MYSQL_DATABASE=vnpy -export VNPY_TEST_MYSQL_HOST=127.0.0.1 -export VNPY_TEST_MYSQL_PORT=3306 -export VNPY_TEST_MYSQL_USER=root -export VNPY_TEST_MYSQL_PASSWORD= -export VNPY_TEST_POSTGRESQL_DATABASE=vnpy -export VNPY_TEST_POSTGRESQL_HOST=127.0.0.1 -export VNPY_TEST_POSTGRESQL_PORT=5432 -export VNPY_TEST_POSTGRESQL_USER=postgres -export VNPY_TEST_POSTGRESQL_PASSWORD= -export VNPY_TEST_MONGODB_DATABASE=vnpy -export VNPY_TEST_MONGODB_HOST=127.0.0.1 -export VNPY_TEST_MONGODB_PORT=27017 +[[ -z ${VNPY_TEST_MYSQL_DATABASE} ]] && VNPY_TEST_MYSQL_DATABASE=vnpy +[[ -z ${VNPY_TEST_MYSQL_HOST} ]] && VNPY_TEST_MYSQL_HOST=127.0.0.1 +[[ -z ${VNPY_TEST_MYSQL_PORT} ]] && VNPY_TEST_MYSQL_PORT=3306 +[[ -z ${VNPY_TEST_MYSQL_USER} ]] && VNPY_TEST_MYSQL_USER=root +[[ -z ${VNPY_TEST_MYSQL_PASSWORD} ]] && VNPY_TEST_MYSQL_PASSWORD= +[[ -z ${VNPY_TEST_POSTGRESQL_DATABASE} ]] && VNPY_TEST_POSTGRESQL_DATABASE=vnpy +[[ -z ${VNPY_TEST_POSTGRESQL_HOST} ]] && VNPY_TEST_POSTGRESQL_HOST=127.0.0.1 +[[ -z ${VNPY_TEST_POSTGRESQL_PORT} ]] && VNPY_TEST_POSTGRESQL_PORT=5432 +[[ -z ${VNPY_TEST_POSTGRESQL_USER} ]] && VNPY_TEST_POSTGRESQL_USER=postgres +[[ -z ${VNPY_TEST_POSTGRESQL_PASSWORD} ]] && VNPY_TEST_POSTGRESQL_PASSWORD= +[[ -z ${VNPY_TEST_MONGODB_DATABASE} ]] && VNPY_TEST_MONGODB_DATABASE=vnpy +[[ -z ${VNPY_TEST_MONGODB_HOST} ]] && VNPY_TEST_MONGODB_HOST=127.0.0.1 +[[ -z ${VNPY_TEST_MONGODB_PORT} ]] && VNPY_TEST_MONGODB_PORT=27017 + +export VNPY_TEST_MYSQL_DATABASE +export VNPY_TEST_MYSQL_HOST +export VNPY_TEST_MYSQL_PORT +export VNPY_TEST_MYSQL_USER +export VNPY_TEST_MYSQL_PASSWORD +export VNPY_TEST_POSTGRESQL_DATABASE +export VNPY_TEST_POSTGRESQL_HOST +export VNPY_TEST_POSTGRESQL_PORT +export VNPY_TEST_POSTGRESQL_USER +export VNPY_TEST_POSTGRESQL_PASSWORD +export VNPY_TEST_MONGODB_DATABASE +export VNPY_TEST_MONGODB_HOST +export VNPY_TEST_MONGODB_PORT