Skip to content

Commit

Permalink
Move from Travis to Circle CI
Browse files Browse the repository at this point in the history
As an experiment, and due to uncertainty around future of Travis.

Some Travis config is left behind for now, and some of the Circle
jobs are still set up as a dry-run.
  • Loading branch information
rohanpm committed Feb 23, 2019
1 parent 910e989 commit 8201e2f
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 16 deletions.
128 changes: 128 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
version: 2.1

workflows:
version: 2
ci-cd:
jobs:
- tox:
name: Python 2.6 tests
toxenv: py26
install_py26: true
image_tag: 2.7.15-jessie
- tox:
name: Python 2.7 tests
toxenv: py27
image_tag: 2.7.15-stretch
- tox:
name: Python 3.6 tests
toxenv: py36
- tox:
name: Static checks
toxenv: static
- tox:
name: Coverage
toxenv: cov-circle-py27,cov-circle-py36
# For coveralls token.
# How to make it work for pull requests??
context: secrets
- tox:
name: Build docs
toxenv: docs
# For pushing to gh-pages
context: secrets
post-steps:
- run: scripts/push-docs
- release:
name: Release to PyPI
# For twine credentials
context: secrets
# Only release if all tests passed
requires:
- Python 2.6 tests
- Python 2.7 tests
- Python 3.6 tests
- Static checks
- Coverage
- Build docs
filters:
tags:
only: /^v.*/

jobs:
release:
docker:
- image: circleci/python:3.6.8-stretch
working_directory: ~/repo
steps:
- checkout
- run: sudo apt-get install twine
- run: python ./setup.py sdist bdist_wheel
- run: >-
if ! test -z "${TWINE_USERNAME}" && ! test -z "${CIRCLE_TAG}"; then
echo twine upload --skip-existing dist/*.tar.gz dist/*.whl
fi
tox:
parameters:
toxenv:
description: "tox environment to execute"
type: string
image_tag:
description: tag of circleci/python image
default: 3.6.8-stretch
type: string
install_py26:
default: false
type: boolean

docker:
- image: circleci/python:<< parameters.image_tag >>

working_directory: ~/repo

steps:
- when:
condition: <<parameters.install_py26>>
steps:
- run: >-
sudo /bin/sh -c '
echo "deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu trusty main" >
/etc/apt/sources.list.d/deadsnakes.list'
- run: gpg --keyserver keyserver.ubuntu.com --recv-keys 'FF39 97E8 3CD9 69B4 09FB 24BC 5BB9 2C09 DB82 666C'
- run: gpg --export DB82666C | sudo apt-key add -
- run: sudo apt-get update
- run: sudo apt-get remove python2.7
- run: sudo rm -rf /usr/local
- run: sudo apt-get install python2.6
- run: >-
curl -L https://github.com/pypa/get-pip/raw/3de61057f0037f4a12b4a3c6936e9ee91d07a811/2.6/get-pip.py -o /tmp/get-pip.py &&
echo '02b9553a4fc36740ff183c40ce413d4ae840d17099e16a43ef4f7996230ea173 /tmp/get-pip.py' | sha256sum --check
- run: sudo python2.6 /tmp/get-pip.py -vvv

- restore_cache:
key: v1-local-venv-<< parameters.image_tag >>

- checkout

- restore_cache:
key: v1-cache-pip-{{ checksum "requirements.txt" }}-{{ checksum "test-requirements.txt" }}

- run:
name: install tox
command: |
pip install --user tox
- save_cache:
key: v1-local-venv-<< parameters.image_tag >>
paths:
- "~/.local"

- run:
name: run tests
command: |
~/.local/bin/tox -e << parameters.toxenv >>
- save_cache:
key: v1-cache-pip-{{ checksum "requirements.txt" }}-{{ checksum "test-requirements.txt" }}
paths:
- "~/.cache/pip"
28 changes: 14 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ matrix:
env: TOX_ENV=static
- python: "3.6"
env: TOX_ENV=docs
- python: "3.6"
env: TOX_ENV=cov-travis-py27,cov-travis-py36
# - python: "3.6"
# env: TOX_ENV=cov-travis-py27,cov-travis-py36
- python: "2.6"
env: TOX_ENV=py26 ITER=1
- python: "2.6"
Expand All @@ -31,15 +31,15 @@ matrix:
- python: "3.6"
env: TOX_ENV=py36 ITER=1
script: tox -e $TOX_ENV
after_success:
- test $TOX_ENV = docs && scripts/push-docs
deploy:
provider: pypi
user: rohanpm
password:
secure: AYK5kq8zbBcpnhZPWwO6xxMh/FvMpUMBrC31xrNi+e8z607MW+VnF4b5B/x8j2Ls722nCodg6Ms+PHOY6CD+8DDyAkqOthhJlrAeJrhrY0JPQ3nwnMheENi0yHimKm+XX7u9gKV/1/DNs5Pt9YvnxXq1QFifLCvbagcwvAAu0US+IgVR9erfZdw2FsV6fLMi/+ZkUFmvgidRx79AFfeIJcc81bK5s85YNXxL4plrgatbx4NXbvjtX5uI3n68xHhZod2IlLL7WSff38/K+LRTDTNiiOvNEcIVEidNICeKD8a3wE1PesRpfCdeGsJe7bGi3GqZKgDn7dr1gok/9cjpCyZ4QuDYHoP63qCOfku4F8QLV/A26TvDGMlOMrbfJWUCw3/7nzKYeW+Dd5siZmDGLCw6z9lR1epp1OJ+RGC/w8Yhh3eZ3VblX50VL7O1qJH/AMw44Z9tfzKQm3e3XwPZuxr1xq7e/ko76DBznEWfYSYAahAwEqNu7s725jnfBeFKnjqbTw+C0LvELei6/t1XYeEAGNv29CNgxi2MctQfHJfuD847E3K+vKaGtkKfHaDgfffJw2gJ/wzKMBNwEE3OHGDrmeFxaUMT4SoEkewb00HX0QbjqJhGiYVLuRj/MLgWP+SRdUes0j8xi9zzwJTTkPWzty+HoyTkBQFTYrWFlUk=
on:
tags: true
condition: $TOX_ENV = py36
distributions: sdist bdist_wheel
skip_existing: true
#after_success:
#- test $TOX_ENV = docs && scripts/push-docs
# deploy:
# provider: pypi
# user: rohanpm
# password:
# secure: AYK5kq8zbBcpnhZPWwO6xxMh/FvMpUMBrC31xrNi+e8z607MW+VnF4b5B/x8j2Ls722nCodg6Ms+PHOY6CD+8DDyAkqOthhJlrAeJrhrY0JPQ3nwnMheENi0yHimKm+XX7u9gKV/1/DNs5Pt9YvnxXq1QFifLCvbagcwvAAu0US+IgVR9erfZdw2FsV6fLMi/+ZkUFmvgidRx79AFfeIJcc81bK5s85YNXxL4plrgatbx4NXbvjtX5uI3n68xHhZod2IlLL7WSff38/K+LRTDTNiiOvNEcIVEidNICeKD8a3wE1PesRpfCdeGsJe7bGi3GqZKgDn7dr1gok/9cjpCyZ4QuDYHoP63qCOfku4F8QLV/A26TvDGMlOMrbfJWUCw3/7nzKYeW+Dd5siZmDGLCw6z9lR1epp1OJ+RGC/w8Yhh3eZ3VblX50VL7O1qJH/AMw44Z9tfzKQm3e3XwPZuxr1xq7e/ko76DBznEWfYSYAahAwEqNu7s725jnfBeFKnjqbTw+C0LvELei6/t1XYeEAGNv29CNgxi2MctQfHJfuD847E3K+vKaGtkKfHaDgfffJw2gJ/wzKMBNwEE3OHGDrmeFxaUMT4SoEkewb00HX0QbjqJhGiYVLuRj/MLgWP+SRdUes0j8xi9zzwJTTkPWzty+HoyTkBQFTYrWFlUk=
# on:
# tags: true
# condition: $TOX_ENV = py36
# distributions: sdist bdist_wheel
# skip_existing: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A library of composable Python executors and futures.

[![Build Status](https://travis-ci.org/rohanpm/more-executors.svg?branch=master)](https://travis-ci.org/rohanpm/more-executors)
[![Build Status](https://circleci.com/gh/rohanpm/more-executors/tree/master.svg?style=svg)](https://circleci.com/gh/rohanpm/more-executors/tree/master)
[![Coverage Status](https://coveralls.io/repos/github/rohanpm/more-executors/badge.svg?branch=master)](https://coveralls.io/github/rohanpm/more-executors?branch=master)

- [API documentation](https://rohanpm.github.io/more-executors/)
Expand Down
2 changes: 1 addition & 1 deletion scripts/push-docs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

if [ "$TRAVIS_BRANCH" != "master" ] || [ $TRAVIS_PULL_REQUEST != "false" ]; then
if [ "${TRAVIS_BRANCH:-${CIRCLE_BRANCH}}" != "master" ] || [ $TRAVIS_PULL_REQUEST != "false" ] || [ "${CIRCLE_PULL_REQUEST}" != "" ]; then
echo "Docs would now be pushed, if this were submitted to master."
exit 0
fi
Expand Down
28 changes: 28 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ deps=-rtest-requirements.txt
commands=pytest -v {posargs}
whitelist_externals=sh

[testenv:py26]
basepython=python2.6

[testenv:py27]
basepython=python2.7

[testenv:static]
deps=
flake8
Expand All @@ -26,6 +32,28 @@ usedevelop=true
commands=
pytest --cov-report=html --cov=more_executors {posargs}

[testenv:cov-circle-py27]
passenv = COVERALLS_REPO_TOKEN CIRCLECI CIRCLE_* CI_PULL_REQUEST
deps=
-rtest-requirements.txt
pytest-cov
coveralls
usedevelop=true
commands=
pytest --cov=more_executors {posargs}
coveralls --output=coverage.json

[testenv:cov-circle-py36]
passenv = COVERALLS_REPO_TOKEN CIRCLECI CIRCLE_* CI_PULL_REQUEST
deps=
-rtest-requirements.txt
pytest-cov
coveralls
usedevelop=true
commands=
pytest --cov=more_executors {posargs}
sh -c 'if ! test -z "$\{COVERALLS_REPO_TOKEN\}"; then coveralls --merge=coverage.json; fi'

[testenv:cov-travis-py27]
passenv = TRAVIS TRAVIS_*
deps=
Expand Down

0 comments on commit 8201e2f

Please sign in to comment.