Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speed up circleci builds #164

Merged
merged 27 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 92 additions & 58 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,106 +1,90 @@
version: 2.1
workflows:
build_and_deploy:
jobs:
- build:
filters:
tags:
only: /.*/
- test-python-install:
version: "3.6"
requires:
- build
- test-python-install:
version: "3.7"
requires:
- build
# don't test python 3.8 since we are already (build)
- deploy:
requires:
- build
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/

orbs:
codecov: codecov/codecov@1.0.2

jobs:
build:
parameters:
version:
type: string
docker:
- image: cimg/python:3.8
- image: cimg/python:<< parameters.version >>
steps:
- checkout
- restore_cache:
key: v1-deps-{{ checksum "requirements.txt" }}
key: v1-<< parameters.version >>-min-dependency-cache-{{ checksum "dev-requirements.txt" }}
- run:
name: install python dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install pytest pytest-cov codecov black
pip install -r requirements.txt
pip install -e .
pip install --upgrade pip
pip install -r dev-requirements.txt
- save_cache:
key: v1-deps-{{ checksum "requirements.txt" }}
key: v1-<< parameters.version >>-min-dependency-cache-{{ checksum "dev-requirements.txt" }}
paths:
- "venv"
- run:
name: run tests
name: test if package installs
command: |
. venv/bin/activate
pytest hyppo/
black --check --diff ./hyppo
codecov
- store_artifacts:
path: htmlcov/
test-python-install:
# test at minimum package levels
python3 setup.py install
test-module:
parameters:
version:
module:
type: string
default: latest
docker:
- image: cimg/python:<< parameters.version >>
- image: cimg/python:3.8
steps:
- checkout
- restore_cache:
key: v1-3.8-dependency-cache-{{ checksum "dev-requirements.txt" }}
- run:
name: install python dependencies
# llvmlite version set for numba
command: |
python3 -m venv venv
. venv/bin/activate
pip install pytest pytest-cov codecov black
pip install numpy==1.17 scipy==1.4.0 llvmlite==0.30.0 numba==0.46 scikit-learn==0.22 joblib==0.17.0
pip install -r dev-requirements.txt
pip install -e .
- save_cache:
key: v1-3.8-dependency-cache-{{ checksum "dev-requirements.txt" }}
paths:
- "venv"
- run:
name: run tests
name: run code linting
command: |
. venv/bin/activate
pytest hyppo/
black --check --diff ./hyppo
codecov
black --check --diff ./hyppo/<< parameters.module >>
- run:
name: run tests and coverage
command: |
. venv/bin/activate
pytest --junitxml=test-reports/junit.xml --cov-report=html:htmlcov --cov=hyppo/<< parameters.module >> hyppo/<< parameters.module >>
- store_test_results:
path: test-reports
- store_artifacts:
path: htmlcov/
integration:
docker:
- image: cimg/python:3.8
steps:
- run: echo "It works!"
path: test-reports
- store_artifacts:
path: htmlcov
- codecov/upload:
file: "./htmlcov/index.html"
deploy:
docker:
- image: cimg/python:3.8
steps:
- checkout
- restore_cache:
key: v1-deps-{{ checksum "requirements.txt" }}
key: v1-3.8-dependency-cache-{{ checksum "dev-requirements.txt" }}
- run:
name: install python dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
pip install -r dev-requirements.txt
pip install -e .
- save_cache:
key: v1-deps-{{ checksum "requirements.txt" }}
key: v1-3.8-dependency-cache-{{ checksum "dev-requirements.txt" }}
paths:
- "venv"
- run:
Expand All @@ -123,4 +107,54 @@ jobs:
name: upload to pypi
command: |
. venv/bin/activate
twine upload dist/*
twine upload dist/*

workflows:
build-test-deploy:
jobs:
- build:
name: "v3.6"
version: "3.6"
- build:
name: "v3.7"
version: "3.7"
- build:
name: "v3.8"
version: "3.8"
- test-module:
name: "independence"
module: "independence"
requires:
- "v3.8"
- test-module:
name: "ksample"
module: "ksample"
requires:
- "v3.8"
- test-module:
name: "time_series"
module: "time_series"
requires:
- "v3.8"
- test-module:
name: "discrim"
module: "discrim"
requires:
- "v3.8"
- test-module:
name: "tools"
module: "tools"
requires:
- "v3.8"
- deploy:
requires:
- "independence"
- "ksample"
- "time_series"
- "discrim"
- "tools"
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
8 changes: 8 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-r requirements.txt
numba==0.49.1; python_version < '3.7'
pytest
coverage
pytest-cov
codecov
black
twine
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[pytest]
addopts = --cov=hyppo --doctest-modules
addopts = --doctest-modules
deselect = "hyppo/independence/kmerf.py"


Expand Down