8000 CircleCI updates (#15) · devgithvb/python-backend-flask@b203526 · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit b203526

Browse files
committed
CircleCI updates (#15)
1 parent c55afa9 commit b203526

File tree

1 file changed

+56
-24
lines changed

1 file changed

+56
-24
lines changed

.circleci/config.yml

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,40 @@
11
version: 2.1
22

3+
parameters:
4+
run_integration_tests:
5+
type: boolean
6+
default: false
7+
8+
run_unit_tests:
9+
type: boolean
10+
default: true
11+
12+
313
executors:
414
app:
5-
working_directory: ~/app
15+
working_directory: /mnt/ramdisk
616
docker:
7-
- image: circleci/python:3.8.1
17+
- image: circleci/python:3.9
818
environment:
919
PIPENV_VENV_IN_PROJECT: true
1020
DATABASE_URL: postgres://root:@localhost/alvinchow_backend_test
1121
REDIS_URL: redis://localhost:6379
1222

13-
- image: circleci/postgres:11-alpine-ram
23+
- image: circleci/postgres:12-alpine-ram
1424
environment:
1525
POSTGRES_USER: root
1626
POSTGRES_DB: alvinchow_backend_test
17-
- image: circleci/redis:5.0.3
27+
- image: circleci/redis:6-alpine
1828

1929

2030
commands:
21-
unit_tests_build:
31+
build:
2232
description: "Install and build the app, anything common for all unit test runs"
2333
steps:
2434
- checkout # checkout source code to working directory
35+
- run:
36+
name: Install submodules
37+
command: git submodule update --init
2538
- run:
2639
name: Install dockerize
2740
command: wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
@@ -36,17 +49,21 @@ commands:
3649

3750
- restore_cache:
3851
keys:
39-
- pip-packages-v1-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
40-
- pip-packages-v1-{{ .Branch }}-
41-
- pip-packages-v1-
52+
- pip-packages-v1-{{ checksum "Pipfile.lock" }}
4253
- run:
4354
name: Install dependencies
4455
command: |
4556
pipenv sync --dev
57+
source /mnt/ramdisk/.venv/bin/activate
58+
pip install -e alvin-python-lib -e alvin-grpc-py -e .
4659
- save_cache:
4760
paths:
48-
- ~/app/.venv
49-
key: pip-packages-v3-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
61+
- /mnt/ramdisk/.venv
62+
key: pip-packages-v1-{{ checksum "Pipfile.lock" }}
63+
64+
65+
lint:
66+
steps:
5067
- run:
5168
name: Linting
5269
command:
@@ -57,41 +74,56 @@ jobs:
5774
unit-tests:
5875
executor: app
5976
steps:
60-
- unit_tests_build
77+
- build
78+
- lint
6179
- run:
62-
name: Run tests
80+
name: Run unit tests
6381
command: |
64-
pipenv run python runtests.py --coverage
82+
pipenv run python runtests.py --coverage
6583
66-
unit-tests-with-coverage-html:
84+
unit-tests-with-cov-html:
6785
executor: app
6886
steps:
69-
- unit_tests_build
87+
- build
88+
- lint
7089
- run:
71-
name: Run tests
90+
name: Run unit tests with coverage html
7291
command: |
7392
pipenv run python runtests.py --coverage-html
74-
pipenv run coverage-badge -o coverage.svg
75-
- store_artifacts:
76-
path: ~/app/htmlcov
93+
# pipenv run coverage-badge -o coverage.svg
7794
- store_artifacts:
78-
path: ~/app/coverage.svg
79-
95+
path: /mnt/ramdisk/htmlcov
96+
# - store_artifacts:
97+
# path: ~/app/coverage.svg
8098

99+
integration-tests:
100+
executor: app
101+
steps:
102+
- build
103+
- run:
104+
name: Run integration tests
105+
command: |
106+
pipenv run python runtests.py --integration-only -vs
81107
82108
workflows:
83109
version: 2
84-
test:
110+
unit-tests:
111+
when: << pipeline.parameters.run_unit_tests >>
85112
jobs:
86113
# Run normal tests for normal branches
87114
- unit-tests:
88115
filters:
89116
branches:
90117
ignore: master
91118

92-
# Also generate HTML coverage report for master commits
93-
- unit-tests-with-coverage-html:
119+
# Also run integration tests generate HTML coverage report for master commits
120+
- unit-tests-with-cov-html:
94121
filters:
95122
branches:
96123
only:
97124
- master
125+
126+
integration-tests:
127+
when: << pipeline.parameters.run_integration_tests >>
128+
jobs:
129+
- integration-tests

0 commit comments

Comments
 (0)
0