Skip to content

Commit

Permalink
Merge c69a2bd into 6a66f6e
Browse files Browse the repository at this point in the history
  • Loading branch information
jakirkham committed Aug 3, 2018
2 parents 6a66f6e + c69a2bd commit ec6b1d6
Show file tree
Hide file tree
Showing 50 changed files with 4,292 additions and 10 deletions.
27 changes: 27 additions & 0 deletions .circleci/checkout_merge_commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash


# Update PR refs for testing.
if [[ -n "${CIRCLE_PR_NUMBER}" ]]
then
FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head"
FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge"
fi

# Retrieve the refs.
if [[ -n "${CIRCLE_PR_NUMBER}" ]]
then
git fetch -u origin ${FETCH_REFS}
fi

# Checkout the PR merge ref.
if [[ -n "${CIRCLE_PR_NUMBER}" ]]
then
git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge"
fi

# Check for merge conflicts.
if [[ -n "${CIRCLE_PR_NUMBER}" ]]
then
git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null
fi
126 changes: 116 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,128 @@
version: 2

jobs:
build:
build_py36:
working_directory: ~/test
machine: true
branches:
ignore:
- /.*/
environment:
- PYVER: "36"
steps:
- checkout
- run:
command: exit 0
name: Fast finish outdated PRs and merge PRs
command: |
./.circleci/fast_finish_ci_pr_build.sh
./.circleci/checkout_merge_commit.sh
- run:
name: Install and Configure Miniconda
command: |
source .circleci/install_miniconda.sh
- run:
name: Create the test environment
command: |
export CONDA_ENV_TYPE="tst_py${PYVER}"
source .circleci/create_env.sh
echo "conda activate ${CONDA_ENV_PATH}" >> ~/.bashrc
- run:
name: Install the package and dependencies
command: |
pip install -e .
- run:
name: Run tests and measure test coverage
command: |
coverage erase
coverage run --source . setup.py test
coverage report -m
- run:
name: Report coverage
command: |
export CONDA_ENV_TYPE="dpl"
source .circleci/create_env.sh
coveralls
build_py35:
working_directory: ~/test
machine: true
environment:
- PYVER: "35"
steps:
- checkout
- run:
name: Fast finish outdated PRs and merge PRs
command: |
./.circleci/fast_finish_ci_pr_build.sh
./.circleci/checkout_merge_commit.sh
- run:
name: Install and Configure Miniconda
command: |
source .circleci/install_miniconda.sh
- run:
name: Create the test environment
command: |
export CONDA_ENV_TYPE="tst_py${PYVER}"
source .travis_support/create_env.sh
echo "conda activate ${CONDA_ENV_PATH}" >> ~/.bashrc
- run:
name: Install the package and dependencies
command: |
pip install -e .
- run:
name: Run tests and measure test coverage
command: |
coverage erase
coverage run --source . setup.py test
coverage report -m
- run:
name: Report coverage
command: |
export CONDA_ENV_TYPE="dpl"
source .travis_support/create_env.sh
coveralls
build_py27:
working_directory: ~/test
machine: true
environment:
- PYVER: "27"
steps:
- checkout
- run:
name: Fast finish outdated PRs and merge PRs
command: |
./.circleci/fast_finish_ci_pr_build.sh
./.circleci/checkout_merge_commit.sh
- run:
name: Install and Configure Miniconda
command: |
source .circleci/install_miniconda.sh
- run:
name: Create the test environment
command: |
export CONDA_ENV_TYPE="tst_py${PYVER}"
source .travis_support/create_env.sh
echo "conda activate ${CONDA_ENV_PATH}" >> ~/.bashrc
- run:
name: Install the package and dependencies
command: |
pip install -e .
- run:
name: Run tests and measure test coverage
command: |
coverage erase
coverage run --source . setup.py test
coverage report -m
- run:
name: Report coverage
command: |
export CONDA_ENV_TYPE="dpl"
source .travis_support/create_env.sh
coveralls
workflows:
version: 2
build_and_test:
jobs:
- build:
filters:
branches:
ignore:
- /.*/
- build_py36
- build_py35
- build_py27
24 changes: 24 additions & 0 deletions .circleci/create_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# Some reasonable bash constraints.
set -xeuo pipefail

# Check CONDA_ENV_TYPE was set.
if [ -z "${CONDA_ENV_TYPE}" ]; then
echo "Set $CONDA_ENV_TYPE externally."
exit 1
fi

# Create a temporary directory for the environment.
export SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export CONDA_ENV_PREFIX="$(mktemp -d)"
export CONDA_ENV_PATH="${CONDA_ENV_PREFIX}/${CONDA_ENV_TYPE}"
export CONDA_ENV_SPEC="${SCRIPT_DIR}/environments/${CONDA_ENV_TYPE}.yml"

# Fill the temporary directory.
conda activate
conda env create -p "${CONDA_ENV_PATH}" -f "${CONDA_ENV_SPEC}"
conda activate "${CONDA_ENV_PATH}"

# Unset all bash constraints.
set +xeuo pipefail
11 changes: 11 additions & 0 deletions .circleci/environments/dpl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: pysharedmem_env

channels:
- conda-forge

dependencies:
- python==3.6
- pip==18.0
- wheel==0.31.1
- coverage==4.5.1
- coveralls==1.3.0
9 changes: 9 additions & 0 deletions .circleci/environments/tst_py27.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: pysharedmem_env

channels:
- conda-forge

dependencies:
- pip==18.0
- wheel==0.31.1
- coverage==4.5.1
9 changes: 9 additions & 0 deletions .circleci/environments/tst_py35.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: pysharedmem_env

channels:
- conda-forge

dependencies:
- pip==18.0
- wheel==0.31.1
- coverage==4.5.1
9 changes: 9 additions & 0 deletions .circleci/environments/tst_py36.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: pysharedmem_env

channels:
- conda-forge

dependencies:
- pip==18.0
- wheel==0.31.1
- coverage==4.5.1
7 changes: 7 additions & 0 deletions .circleci/fast_finish_ci_pr_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

python .gen_ci_support/ff_ci_pr_build.py -v \
--ci "circle" \
"${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" \
"${CIRCLE_BUILD_NUM}" \
"${CIRCLE_PR_NUMBER}"
36 changes: 36 additions & 0 deletions .circleci/install_miniconda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Some reasonable bash constraints.
set -xeuo pipefail

# Miniconda Config:
export MINICONDA_VERSION="4.5.4"
export MINICONDA_MD5="a946ea1d0c4a642ddf0c3a26a18bb16d"
export MINICONDA_INSTALLER="${HOME}/miniconda.sh"
export MINICONDA_DIR="${HOME}/miniconda"

# Install Miniconda.
curl -L "https://repo.continuum.io/miniconda/Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh" > "${MINICONDA_INSTALLER}"
openssl md5 "${MINICONDA_INSTALLER}" | grep "${MINICONDA_MD5}"
bash "${MINICONDA_INSTALLER}" -b -p "${MINICONDA_DIR}"
rm -f "${MINICONDA_INSTALLER}"

# Activate conda.
source "${MINICONDA_DIR}/etc/profile.d/conda.sh"
conda activate base

# Configure conda.
conda config --set show_channel_urls true

# Update conda.
conda update -y -n root --all
conda install -y -n root conda-build
conda clean -tipsy

# Activate conda in bashrc
echo "" >> ~/.bashrc
echo "source ${MINICONDA_DIR}/etc/profile.d/conda.sh" >> ~/.bashrc
echo "conda activate base" >> ~/.bashrc

# Unset all bash constraints.
set +xeuo pipefail
23 changes: 23 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[run]
branch = True
source = pysharedmem
[report]
exclude_lines =
# Ignore coverage of code that requires the module to be executed.
if __name__ == .__main__.:

# Ignore continue statement in code as it can't be detected as covered
# due to an optimization by the Python interpreter. See coverage issue
# ( https://bitbucket.org/ned/coveragepy/issue/198/continue-marked-as-not-covered )
# and Python issue ( http://bugs.python.org/issue2506 ).
continue
omit =
*/python?.?/*
*/site-packages/*
*/eggs/*
*/.eggs/*
*tests/*
*/travis_pypi_setup.py
*/versioneer.py
*/_version.py
*/_vendor/*
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf

[*.bat]
indent_style = tab
end_of_line = crlf

[LICENSE]
insert_final_newline = false

[Makefile]
indent_style = tab
Loading

0 comments on commit ec6b1d6

Please sign in to comment.