33# Check https://circleci.com/docs/2.0/language-python/ for more details
44#
55version : 2
6-
7- defaults : &defaults
8- docker :
9- # https://circleci.com/docs/2.0/circleci-images/
10- - image : circleci/python:3.7.2-stretch
11-
12- working_directory : ~/bankroll
13-
146jobs :
15- shellcheck :
7+ build :
168 docker :
17- - image : koalaman/shellcheck-alpine:stable
18- steps :
19- - checkout
20- - run :
21- name : Check Scripts
22- command : shellcheck --external-sources script/*
9+ # specify the version you desire here
10+ # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
11+ - image : circleci/python:3.7.4
2312
24- test :
25- << : *defaults
13+ # Specify service dependencies here if necessary
14+ # CircleCI maintains a library of pre-built images
15+ # documented at https://circleci.com/docs/2.0/circleci-images/
16+ # - image: circleci/postgres:9.4
2617
27- parallelism : 4
18+ working_directory : ~/repo
2819
2920 steps :
3021 - checkout
3122
32- # Note that race conditions between workflows are possible here:
33- # https://circleci.com/docs/2.0/caching/#writing-to-the-cache-in-workflows
34- #
35- # As long as the caching is deterministic, this _should_ be OK.
36- - restore_cache : &default_restore_cache
23+ - restore_cache :
24+ keys :
25+ - v1-pip-cache-{{ checksum "setup.py" }}
26+ - v1-pip-cache-
27+
28+ - restore_cache :
3729 keys :
38- # When requirements change, use increasingly general patterns to restore cache.
3930 - v2-dependencies-{{ checksum "requirements.txt" }}
4031 - v2-dependencies-
4132
42- - run : &bootstrap
33+ - run :
4334 name : install dependencies
44- command : script/bootstrap
35+ command : |
36+ python3 -m venv venv
37+ . venv/bin/activate
38+ pip install -r requirements.txt
4539
46- - save_cache : &default_save_cache
40+ - save_cache :
4741 paths :
4842 - ./venv
4943 key : v2-dependencies-{{ checksum "requirements.txt" }}
44+
45+ - run :
46+ name : typecheck
47+ command : |
48+ . venv/bin/activate
49+ mypy --namespace-packages --strict --implicit-reexport bankroll
50+ mypy --namespace-packages --strict --implicit-reexport -p tests
5051
5152 - run :
5253 name : run tests
53- command : script/test
54+ command : |
55+ . venv/bin/activate
56+ python -m unittest -v
5457
55- test installing :
56- << : *defaults
58+ - store_artifacts :
59+ path : test-reports
60+ destination : test-reports
5761
58- steps :
59- - checkout
60-
6162 - run :
62- command : script/test_install
63-
64- contribution guidelines :
65- << : *defaults
66-
67- steps :
68- - checkout
69-
70- - restore_cache : *default_restore_cache
71- - run : *bootstrap
72- - save_cache : *default_save_cache
63+ name : linting
64+ command : |
65+ . venv/bin/activate
66+ black --check bankroll tests
7367
7468 - run :
75- name : typecheck
76- command : script/typecheck
77-
69+ name : test ibkr install
70+ command : |
71+ python3 -m venv --clear venv
72+ . venv/bin/activate
73+ pip install .[ibkr]
74+ bankroll -h | grep ibkr
75+
7876 - run :
79- name : check formatting
80- when : always
81- command : script/reformat --diff
82-
83- deploy :
84- << : *defaults
77+ name : test schwab install
78+ command : |
79+ python3 -m venv --clear venv
80+ . venv/bin/activate
81+ pip install .[schwab]
82+ bankroll -h | grep schwab
8583
86- steps :
87- - checkout
88-
8984 - run :
90- name : deploy
91- command : script/deploy
92-
93- versiontags : &versiontags
94- tags :
95- only : /^v.*/
85+ name : test fidelity install
86+ command : |
87+ python3 -m venv --clear venv
88+ . venv/bin/activate
89+ pip install .[fidelity]
90+ bankroll -h | grep fidelity
9691
97- workflows :
98- version : 2
99- workflow :
100- jobs :
101- - shellcheck :
102- filters :
103- << : *versiontags
104- - test :
105- filters :
106- << : *versiontags
107- - test installing :
108- filters :
109- << : *versiontags
110- - contribution guidelines :
111- filters :
112- << : *versiontags
113- - deploy :
114- requires :
115- - test
116- - test installing
117- - contribution guidelines
118- filters :
119- << : *versiontags
120- branches :
121- ignore : /.*/
92+ - run :
93+ name : test vanguard install
94+ command : |
95+ python3 -m venv --clear venv
96+ . venv/bin/activate
97+ pip install .[vanguard]
98+ bankroll -h | grep vanguard
99+
100+ - run :
101+ name : test installing all extras
102+ command : |
103+ python3 -m venv --clear venv
104+ . venv/bin/activate
105+ pip install .[ibkr,schwab,fidelity,vanguard]
106+ bankroll -h | grep ibkr
107+ bankroll -h | grep schwab
108+ bankroll -h | grep fidelity
109+ bankroll -h | grep vanguard
110+
111+ - save_cache :
112+ paths :
113+ - ~/.cache/pip
114+ key : v1-pip-cache-{{ checksum "setup.py" }}
0 commit comments