diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..fa3c5a2a --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,132 @@ +version: 2 +jobs: + flake8: + docker: + - image: circleci/python:3.7 + steps: + - checkout + - restore_cache: + keys: + - flake8-dependencies + - run: + name: "create venv for caching" + command: | + python3 -m venv venv + - run: + name: "install flake8" + command: | + . venv/bin/activate + pip install flake8 + - save_cache: + paths: + - ./venv + key: flake8-dependencies + - run: + name: "run flake8" + command: | + . venv/bin/activate + flake8 + + build_ctp_gcc8: + <<: &build_spec + docker: + - image: registry.cn-shanghai.aliyuncs.com/vnpy-ci/gcc-8-python-3.7:1.0 + - image: circleci/postgres:latest + environment: + POSTGRES_DB: &db_name "vnpy" + POSTGRES_USER: "postgres" + POSTGRES_PASSWORD: &db_password "1234" + - image: circleci/mysql:latest + environment: + MYSQL_DATABASE: *db_name + MYSQL_ROOT_PASSWORD: *db_password + - image: circleci/mongo:latest + environment: + <<: &build_environment + VNPY_TEST_POSTGRESQL_PASSWORD: *db_password + VNPY_TEST_MYSQL_PASSWORD: *db_password + VNPY_BUILD_CTP: "1" + VNPY_BUILD_OES: "0" + # best suit for circle-ci + VNPY_BUILD_PARALLEL: "2" + steps: + - checkout + - run: + name: "create venv for caching" + command: | + python3 -m venv venv + + - restore_cache: + keys: + - v2-dependencies-{{ checksum "requirements.txt" }} + # fallback to using the latest cache if no exact match is found + - v2-dependencies- + + - run: + name: "showing environments" + command: | + . venv/bin/activate + source ci/env.sh + echo $PWD + python -V + pip list + gcc --version + free + cat /proc/cpuinfo|grep -P "(processor|cpu MHz|model name)" + set + - run: + name: "install some special pip packages" + command: | + . venv/bin/activate + source ci/env.sh + python -m pip --version + python -m pip install --upgrade pip wheel setuptools + python -m pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl + bash ci/gitlab_pre_install.sh + + - run: + name: "install vnpy and its dependents" + command: | + . venv/bin/activate + source ci/env.sh + bash ./install.sh + - save_cache: + paths: + - ./venv + key: v2-dependencies-{{ checksum "requirements.txt" }} + + - run: + name: "test" + command: | + . venv/bin/activate + source ci/env.sh + set + cd tests + python test_all.py + build_oes_gcc8: + <<: *build_spec + environment: + <<: *build_environment + VNPY_BUILD_CTP: "0" + VNPY_BUILD_OES: "1" + python_only: + <<: *build_spec + environment: + <<: *build_environment + VNPY_BUILD_CTP: "0" + VNPY_BUILD_OES: "0" + +workflows: + version: 2 + build_ctp_gcc8: + jobs: + - build_ctp_gcc8 + build_oes_gcc8: + jobs: + - build_oes_gcc8 + flake8: + jobs: + - flake8 + python_only: + jobs: + - python_only diff --git a/setup.py b/setup.py index b2c52b23..5f07d6cb 100644 --- a/setup.py +++ b/setup.py @@ -182,9 +182,10 @@ parallel = os.environ.get('VNPY_BUILD_PARALLEL', None) if parallel: if parallel == 'auto': parallel = os.cpu_count() - from ci.parallel_build_distutils import patch_distutils + if parallel != 'no': + from ci.parallel_build_distutils import patch_distutils - patch_distutils(int(parallel)) + patch_distutils(int(parallel)) setup( name="vnpy",