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

Move to CircleCI 2.0 #106

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
170 changes: 170 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
version: 2

references:
# Set up a cached virtualenv in which to install dependencies
build-combined-checksum: &build-combined-checksum
run:
name: Build combined checksum
command: |
cat setup.py >> .checksum
cat script/linting/requirements.txt >> .checksum
cat script/testing/requirements.txt >> .checksum

restore-build-dependency-cache: &restore-build-dependency-cache
restore_cache:
name: Restore build dependency cache
key: deps-venv-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum ".checksum" }}

install-dependencies: &install-dependencies
run:
name: Install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -U pip setuptools
pip install -r script/linting/requirements.txt -r script/testing/requirements.txt
pip install -e .

save-build-dependency-cache: &save-build-dependency-cache
save_cache:
name: Save build dependency cache
key: deps-venv-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum ".checksum" }}
paths:
- "venv"

workflows:
version: 2
build-and-test:
jobs:
- build-35:
filters:
tags:
only: /.*/

- build-36:
filters:
tags:
only: /.*/

- build-37:
filters:
tags:
only: /.*/

# - build-38:
# filters:
# tags:
# only: /.*/

- lint:
filters:
tags:
only: /.*/

- release:
requires:
- build-35
- build-36
- build-37
# - build-38
- lint
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/

jobs:
build-35: &build-template
docker:
- image: circleci/python:3.5

steps:
- checkout

- *build-combined-checksum
- *restore-build-dependency-cache
- *install-dependencies
- *save-build-dependency-cache

# Test & lint
- run:
name: Test
command: |
mkdir -p build/pytest
. venv/bin/activate
# TODO: we should put the coverage data somewhere
py.test -v --cov=jacquard --junit-xml=build/pytest/junit.xml jacquard

# Testing done, store results
- store_test_results:
path: build/pytest

build-36:
<<: *build-template
docker:
- image: circleci/python:3.6

build-37:
<<: *build-template
docker:
- image: circleci/python:3.7

build-38:
<<: *build-template
docker:
- image: circleci/python:3.8

lint:
docker:
- image: circleci/python:3.7

steps:
- checkout

- *build-combined-checksum
- *restore-build-dependency-cache
- *install-dependencies
- *save-build-dependency-cache

- run:
name: Lint
command: |
. venv/bin/activate
script/linting/lint

- run:
name: Typecheck
command: |
. venv/bin/activate
mypy -p jacquard --ignore-missing-imports --strict-optional

release:
docker:
- image: circleci/python:3.7

steps:
- checkout

- run:
name: Prepare environment
commands: |
python3 -m venv venv
. venv/bin/activate
pip install -U pip setuptools

# setup_requires
pip install pytest

# for packaging
pip install twine wheel

- run:
name: Release
commands: |
. venv/bin/activate
rm -rf dist

python setup.py sdist bdist_wheel

twine upload dist/*
36 changes: 0 additions & 36 deletions circle.yml

This file was deleted.

9 changes: 7 additions & 2 deletions script/linting/lint
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/sh
set -e

black --check jacquard
exec flake8 jacquard
result=$?

flake8 jacquard
result=$((result | $?))

exit $result
3 changes: 2 additions & 1 deletion script/linting/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
black
black; python_version >= '3.6'

flake8
flake8-docstrings
flake8-isort
Expand Down
5 changes: 5 additions & 0 deletions script/testing/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pytest
pytest-cov
fakeredis==0.16.0
hypothesis<4
networkx
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def debian_etc_hack(root):

install_requires=(
'redis',
'werkzeug',
'werkzeug<1',
'python-dateutil',
'pyyaml',
'sqlalchemy',
Expand All @@ -96,6 +96,7 @@ def debian_etc_hack(root):
'redis==2.10.6',
'fakeredis==0.16.0',
'hypothesis<4',
'networkx',
),

entry_points={
Expand Down