Skip to content

Commit e761ae4

Browse files
committed
Not Part Of Course - Add CI
1 parent 59aa0fd commit e761ae4

File tree

4 files changed

+148
-1
lines changed

4 files changed

+148
-1
lines changed

.circleci/config.yml

+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
version: 2.1
2+
3+
jobs:
4+
test_gradient_model_py36:
5+
docker:
6+
- image: circleci/python:3.6.9
7+
working_directory: ~/project/packages/gradient_boosting_model
8+
steps:
9+
- checkout:
10+
path: ~/project
11+
- run:
12+
name: Run tests with Python 3.6
13+
command: |
14+
sudo pip install --upgrade pip
15+
pip install --user tox
16+
tox -e py36
17+
test_gradient_model_py37:
18+
docker:
19+
- image: circleci/python:3.7.6
20+
working_directory: ~/project/packages/gradient_boosting_model
21+
steps:
22+
- checkout:
23+
path: ~/project
24+
- run:
25+
name: Run tests with Python 3.7
26+
command: |
27+
sudo pip install --upgrade pip
28+
pip install --user tox
29+
tox -e py37
30+
test_gradient_model_py38:
31+
docker:
32+
- image: circleci/python:3.8.0
33+
working_directory: ~/project/packages/gradient_boosting_model
34+
steps:
35+
- checkout:
36+
path: ~/project
37+
- run:
38+
name: Run tests with Python 3.8
39+
command: |
40+
sudo pip install --upgrade pip
41+
pip install --user tox
42+
tox -e py38
43+
test_ml_api_py36:
44+
docker:
45+
- image: circleci/python:3.6.9
46+
- image: postgres
47+
environment:
48+
POSTGRES_USER: test_user
49+
POSTGRES_PASSWORD: password
50+
POSTGRES_DB: ml_api_test
51+
environment:
52+
DB_HOST: localhost
53+
DB_PORT: 5432
54+
DB_USER: test_user
55+
DB_PASSWORD: password
56+
DB_NAME: ml_api_test
57+
SHADOW_MODE_ACTIVE: true
58+
working_directory: ~/project/packages/ml_api
59+
steps:
60+
- checkout:
61+
path: ~/project
62+
- run:
63+
name: Run API tests with Python 3.6
64+
command: |
65+
sudo pip install --upgrade pip
66+
pip install --user tox
67+
tox -e py36
68+
test_ml_api_py37:
69+
docker:
70+
- image: circleci/python:3.7.6
71+
- image: postgres
72+
environment:
73+
POSTGRES_USER: test_user
74+
POSTGRES_PASSWORD: password
75+
POSTGRES_DB: ml_api_test
76+
environment:
77+
DB_HOST: localhost
78+
DB_PORT: 5432
79+
DB_USER: test_user
80+
DB_PASSWORD: password
81+
DB_NAME: ml_api_test
82+
SHADOW_MODE_ACTIVE: true
83+
working_directory: ~/project/packages/ml_api
84+
steps:
85+
- checkout:
86+
path: ~/project
87+
- run:
88+
name: Run API tests with Python 3.7
89+
command: |
90+
sudo pip install --upgrade pip
91+
pip install --user tox
92+
tox -e py37
93+
test_ml_api_py38:
94+
docker:
95+
- image: circleci/python:3.8.1
96+
- image: postgres
97+
environment:
98+
POSTGRES_USER: test_user
99+
POSTGRES_PASSWORD: password
100+
POSTGRES_DB: ml_api_test
101+
environment:
102+
DB_HOST: localhost
103+
DB_PORT: 5432
104+
DB_USER: test_user
105+
DB_PASSWORD: password
106+
DB_NAME: ml_api_test
107+
SHADOW_MODE_ACTIVE: true
108+
working_directory: ~/project/packages/ml_api
109+
steps:
110+
- checkout:
111+
path: ~/project
112+
- run:
113+
name: Run API tests with Python 3.8
114+
command: |
115+
sudo pip install --upgrade pip
116+
pip install --user tox
117+
tox -e py38
118+
workflows:
119+
version: 2
120+
test-all:
121+
jobs:
122+
- test_gradient_model_py36
123+
- test_gradient_model_py37
124+
- test_gradient_model_py38
125+
- test_ml_api_py36
126+
- test_ml_api_py37
127+
- test_ml_api_py38

packages/gradient_boosting_model/test_requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ tid-regression-model>=2.0.20,<2.1.0
1111
black>=19.10b0,<20.0
1212
flake8>=3.7.9,<4.0
1313
mypy>=0.740
14+
15+
# kaggle cli
16+
kaggle>=1.5.6,<1.6.0

packages/gradient_boosting_model/tox.ini

+15-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,22 @@ install_command = pip install {opts} {packages}
88
deps =
99
-rtest_requirements.txt
1010

11+
passenv =
12+
KAGGLE_USERNAME
13+
KAGGLE_KEY
14+
15+
setenv =
16+
PYTHONPATH=.
17+
1118
commands=
12-
py.test
19+
kaggle competitions download -c house-prices-advanced-regression-techniques -p gradient_boosting_model/datasets/
20+
unzip -o gradient_boosting_model/datasets/house-prices-advanced-regression-techniques.zip -d gradient_boosting_model/datasets
21+
mv gradient_boosting_model/datasets/train.csv gradient_boosting_model/datasets/houseprice.csv
22+
python gradient_boosting_model/train_pipeline.py
23+
pytest \
24+
-s \
25+
-vv \
26+
{posargs:tests/}
1327

1428

1529
[testenv:unit_tests]

packages/ml_api/tox.ini

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ install_command = pip install {opts} {packages}
99
deps =
1010
-rrequirements/test_requirements.txt
1111

12+
setenv =
13+
PYTHONPATH=.
14+
1215
passenv =
1316
# A list of wildcard environment variable names which shall be copied from
1417
# the tox invocation environment to the test environment when executing test commands

0 commit comments

Comments
 (0)