Skip to content

Commit d7c939d

Browse files
authored
CI migration and refresh (#41)
* CI migration and refresh * update * drop osx, add ci linting
1 parent a6749e6 commit d7c939d

22 files changed

+798
-405
lines changed

.cirrus.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Reference:
2+
# - https://cirrus-ci.org/guide/writing-tasks/
3+
# - https://cirrus-ci.org/guide/linux/
4+
# - https://hub.docker.com/_/gcc/
5+
# - https://hub.docker.com/_/python/
6+
7+
#
8+
# Global defaults.
9+
#
10+
container:
11+
image: python:3.8
12+
cpu: 2
13+
memory: 4G
14+
15+
env:
16+
# Maximum cache period (in weeks) before forcing a new cache upload.
17+
CACHE_PERIOD: "2"
18+
# Increment the build number to force new mambaforge cache upload.
19+
MAMBA_CACHE_BUILD: "0"
20+
# Increment the build number to force new stratify cache upload.
21+
STRATIFY_CACHE_BUILD: "0"
22+
# Base environment conda packages to be installed.
23+
MAMBA_CACHE_PACKAGES: "conda-lock"
24+
# Enable Cython code coverage.
25+
CYTHON_COVERAGE: "1"
26+
# Increment the build number to force new pip cache upload.
27+
PIP_CACHE_BUILD: "0"
28+
29+
30+
#
31+
# Linting
32+
#
33+
lint_task:
34+
auto_cancellation: true
35+
name: "${CIRRUS_OS}: black, flake8 and isort"
36+
pip_cache:
37+
folder: ~/.cache/pip
38+
fingerprint_script:
39+
- echo "${CIRRUS_TASK_NAME}"
40+
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${PIP_CACHE_BUILD}"
41+
lint_script:
42+
- pip list
43+
- python -m pip install --editable .[lint]
44+
- pip list
45+
- black .
46+
- flake8 .
47+
- isort .
48+
49+
50+
#
51+
# Testing (Linux)
52+
#
53+
linux_task:
54+
auto_cancellation: true
55+
matrix:
56+
env:
57+
PY_VER: "3.8"
58+
env:
59+
PY_VER: "3.9"
60+
COVERAGE: "1"
61+
name: "${CIRRUS_OS}: py${PY_VER}"
62+
container:
63+
image: gcc:latest
64+
env:
65+
PATH: ${HOME}/mambaforge/bin:${PATH}
66+
mamba_cache:
67+
folder: ${HOME}/mambaforge
68+
fingerprint_script:
69+
- wget --quiet https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh -O mambaforge.sh
70+
- echo "${CIRRUS_OS} $(sha256sum mambaforge.sh)"
71+
- echo "${MAMBA_CACHE_PACKAGES}"
72+
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${MAMBA_CACHE_BUILD}"
73+
populate_script:
74+
- bash mambaforge.sh -b -p ${HOME}/mambaforge
75+
- conda config --set always_yes yes --set changeps1 no
76+
- conda config --set show_channel_urls True
77+
- conda config --add channels conda-forge
78+
- conda install --quiet --name base ${MAMBA_CACHE_PACKAGES}
79+
check_script:
80+
- conda info --all
81+
- conda list --name base
82+
stratify_cache:
83+
folder: ${HOME}/mambaforge/envs/py${PY_VER}
84+
fingerprint_script:
85+
- echo "${CIRRUS_OS} py${PY_VER} tests"
86+
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${STRATIFY_CACHE_BUILD}"
87+
- cat ${CIRRUS_WORKING_DIR}/requirements/py$(echo ${PY_VER} | tr -d ".").yml
88+
populate_script:
89+
- conda-lock --mamba --platform linux-64 --file ${CIRRUS_WORKING_DIR}/requirements/py$(echo ${PY_VER} | tr -d ".").yml
90+
- mamba create --name py${PY_VER} --quiet --file conda-linux-64.lock
91+
- cp conda-linux-64.lock ${HOME}/mambaforge/envs/py${PY_VER}
92+
test_script:
93+
- cat ${HOME}/mambaforge/envs/py${PY_VER}/conda-linux-64.lock >&2
94+
- source ${HOME}/mambaforge/etc/profile.d/conda.sh >/dev/null 2>&1
95+
- conda activate py${PY_VER} >/dev/null 2>&1
96+
- python setup.py build_ext --inplace
97+
- python -m pip install --no-deps --editable .
98+
- if [ -n "${COVERAGE}" ]; then pytest --cov-report=xml --cov; else pytest; fi
99+
- if [ -n "${COVERAGE}" ]; then codecov; fi

.coveragerc

Lines changed: 0 additions & 18 deletions
This file was deleted.

.flake8

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[flake8]
2+
3+
# References:
4+
# https://flake8.readthedocs.io/en/latest/user/configuration.html
5+
# https://flake8.readthedocs.io/en/latest/user/error-codes.html
6+
# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
7+
8+
select = C,D,E,F,W,B,B950
9+
ignore =
10+
# E203: whitespace before ':'
11+
E203,
12+
# E226: missing whitespace around arithmetic operator
13+
E226,
14+
# E231: missing whitespace after ',', ';', or ':'
15+
E231,
16+
# E402: module level imports on one line
17+
E402,
18+
# E501: line too long
19+
E501,
20+
# E731: do not assign a lambda expression, use a def
21+
E731,
22+
# W503: line break before binary operator
23+
W503,
24+
# W504: line break after binary operator
25+
W504
26+
exclude =
27+
.eggs
28+
build

.gitignore

Lines changed: 132 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,136 @@
1+
# setuptools-scm
2+
_version.py
3+
4+
# Byte-compiled / optimized / DLL files
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
9+
# C extensions
110
*.so
2-
__pycache__
3-
*.egg-info
4-
build
5-
*.swp
6-
.ipynb_checkpoints
7-
*.pyc
811
*.c
912

13+
# Distribution / packaging
14+
.Python
15+
build/
16+
develop-eggs/
1017
dist/
18+
downloads/
19+
eggs/
20+
.eggs/
21+
lib/
22+
lib64/
23+
parts/
24+
sdist/
25+
var/
26+
wheels/
27+
pip-wheel-metadata/
28+
share/python-wheels/
29+
*.egg-info/
30+
.installed.cfg
31+
*.egg
32+
MANIFEST
33+
34+
# PyInstaller
35+
# Usually these files are written by a python script from a template
36+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
37+
*.manifest
38+
*.spec
39+
40+
# Installer logs
41+
pip-log.txt
42+
pip-delete-this-directory.txt
43+
44+
# Unit test / coverage reports
45+
htmlcov/
46+
.tox/
47+
.nox/
48+
.coverage
49+
.coverage.*
50+
.cache
51+
nosetests.xml
52+
coverage.xml
53+
*.cover
54+
*.py,cover
55+
.hypothesis/
56+
.pytest_cache/
57+
58+
# Translations
59+
*.mo
60+
*.pot
61+
62+
# Django stuff:
63+
*.log
64+
local_settings.py
65+
db.sqlite3
66+
db.sqlite3-journal
67+
68+
# Flask stuff:
69+
instance/
70+
.webassets-cache
71+
72+
# Scrapy stuff:
73+
.scrapy
74+
75+
# Sphinx documentation
76+
docs/_build/
77+
78+
# PyBuilder
79+
target/
80+
81+
# Jupyter Notebook
82+
.ipynb_checkpoints
83+
84+
# IPython
85+
profile_default/
86+
ipython_config.py
87+
88+
# pyenv
89+
.python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
99+
__pypackages__/
100+
101+
# Celery stuff
102+
celerybeat-schedule
103+
celerybeat.pid
104+
105+
# SageMath parsed files
106+
*.sage.py
107+
108+
# Environments
109+
.env
110+
.venv
111+
env/
112+
venv/
113+
ENV/
114+
env.bak/
115+
venv.bak/
116+
117+
# Spyder project settings
118+
.spyderproject
119+
.spyproject
120+
121+
# Rope project settings
122+
.ropeproject
123+
124+
# mkdocs documentation
125+
/site
126+
127+
# mypy
128+
.mypy_cache/
129+
.dmypy.json
130+
dmypy.json
131+
132+
# Pyre type checker
133+
.pyre/
134+
135+
# PyCharm
136+
.idea

.pre-commit-config.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: 'v4.0.1'
6+
hooks:
7+
# Prevent giant files from being committed.
8+
- id: check-added-large-files
9+
# Check whether files parse as valid Python.
10+
- id: check-ast
11+
# Check for file name conflicts on case-insensitive filesytems.
12+
- id: check-case-conflict
13+
# Check for files that contain merge conflict strings.
14+
- id: check-merge-conflict
15+
# Check for debugger imports and py37+ `breakpoint()` calls in Python source.
16+
- id: debug-statements
17+
# Don't commit to master branch.
18+
- id: no-commit-to-branch
19+
- repo: https://github.com/psf/black
20+
rev: '21.5b0'
21+
hooks:
22+
- id: black
23+
# Force black to run on whole repo, using settings from pyproject.toml
24+
pass_filenames: false
25+
args: [--config=./pyproject.toml, .]
26+
- repo: https://github.com/PyCQA/flake8
27+
rev: '3.9.2'
28+
hooks:
29+
# Run flake8.
30+
- id: flake8
31+
args: [--config=./.flake8]
32+
- repo: https://github.com/pycqa/isort
33+
rev: 5.8.0
34+
hooks:
35+
- id: isort
36+
name: isort (python)
37+
args: ["--profile", "black", "--filter-files"]
38+
- id: isort
39+
name: isort (cython)
40+
types: [cython]

.stickler.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)