[Add] .circleci/config.yml

[Add] new environment variable that can effect setup.py: VNPY_BUILD_PARALLEL=no
This commit is contained in:
nanoric 2019-09-03 10:38:57 +08:00
parent 3aab7b13db
commit 36eebebca8
2 changed files with 135 additions and 2 deletions

132
.circleci/config.yml Normal file
View File

@ -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

View File

@ -182,6 +182,7 @@ parallel = os.environ.get('VNPY_BUILD_PARALLEL', None)
if parallel: if parallel:
if parallel == 'auto': if parallel == 'auto':
parallel = os.cpu_count() parallel = os.cpu_count()
if parallel != 'no':
from ci.parallel_build_distutils import patch_distutils from ci.parallel_build_distutils import patch_distutils
patch_distutils(int(parallel)) patch_distutils(int(parallel))