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

migrate travis-ci to cirrus-ci #66

Merged
merged 4 commits into from
Jun 10, 2021
Merged
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
101 changes: 101 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Reference:
# - https://cirrus-ci.org/guide/writing-tasks/
# - https://cirrus-ci.org/guide/linux/
# - https://hub.docker.com/_/gcc/
# - https://hub.docker.com/_/python/

#
# Global defaults.
#
container:
image: python:latest
cpu: 2
memory: 4G


env:
# Maximum cache period (in weeks) before forcing a new cache upload.
CACHE_PERIOD: "2"
# Increment the build number to force new mambaforge cache upload.
MAMBA_CACHE_BUILD: "0"
# Increment the build number to force new mint cache upload.
NCTA_CACHE_BUILD: "0"
# Base environment conda packages to be installed
MAMBA_CACHE_PACKAGES: "pip conda-lock"
# Increment the build number to forve new pip cache upload.
PIP_CACHE_BUILD: "0"
# Linting packages to be installed.
PIP_CACHE_PACKAGES: "black flake8 isort"


#
# Linting
#
lint_task:
auto_cancellation: true
name: "${CIRRUS_OS}: linting"
pip_cache:
folder: ~/.cache/pip
fingerprint_script:
- echo "${CIRRUS_TASK_NAME} py${PYTHON_VERSION}"
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${PIP_CACHE_BUILD} ${PIP_CACHE_PACKAGES}"
lint_script:
- pip list
- python -m pip install --retries 3 --upgrade ${PIP_CACHE_PACKAGES}
- pip list
- black --check ${CIRRUS_WORKING_DIR}
- flake8 ${CIRRUS_WORKING_DIR}
- isort --check ${CIRRUS_WORKING_DIR}


#
# Testing (Linux)
#
linux_task:
auto_cancellation: true
matrix:
env:
PY_VER: "3.7"
env:
PY_VER: "3.8"
env:
PY_VER: "3.9"
COVERAGE: "codecov"
name: "${CIRRUS_OS}: py${PY_VER}"
container:
image: gcc:latest
env:
PATH: ${HOME}/mambaforge/bin:${PATH}
mamba_cache:
folder: ${HOME}/mambaforge
fingerprint_script:
- wget --quiet https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh -O mambaforge.sh
- echo "${CIRRUS_OS} $(sha256sum mambaforge.sh)"
- echo "${MAMBA_CACHE_PACKAGES}"
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${MAMBA_CACHE_BUILD}"
populate_script:
- bash mambaforge.sh -b -p ${HOME}/mambaforge
- conda config --set always_yes yes --set changeps1 no
- conda config --set show_channel_urls True
- conda config --add channels conda-forge
- conda install --quiet --name base ${MAMBA_CACHE_PACKAGES}
check_script:
- conda info --all
- conda list --name base
ncta_cache:
folder: ${HOME}/mambaforge/envs/py${PY_VER}
fingerprint_script:
- echo "${CIRRUS_OS} py${PY_VER} tests"
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${NCTA_CACHE_BUILD}"
- cat ${CIRRUS_WORKING_DIR}/requirements/py$(echo ${PY_VER} | tr -d ".").yml
populate_script:
- conda-lock --mamba --platform linux-64 --file ${CIRRUS_WORKING_DIR}/requirements/py$(echo ${PY_VER} | tr -d ".").yml
- mamba create --name py${PY_VER} --quiet --file conda-linux-64.lock
- cp conda-linux-64.lock ${HOME}/mambaforge/envs/py${PY_VER}
test_script:
- cat ${HOME}/mambaforge/envs/py${PY_VER}/conda-linux-64.lock >&2
- source ${HOME}/mambaforge/etc/profile.d/conda.sh >/dev/null 2>&1
- conda activate py${PY_VER} >/dev/null 2>&1
- pip install --no-deps --editable .
- pytest --cov-report=xml --cov
- ${COVERAGE}
4 changes: 2 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#

[run]
source = nc_time_axis
branch = True
source = nc_time_axis
omit =
nc_time_axis/_version.py
nc_time_axis/tests/*

setup.py

[report]
exclude_lines =
Expand Down
28 changes: 28 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[flake8]

# References:
# https://flake8.readthedocs.io/en/latest/user/configuration.html
# https://flake8.readthedocs.io/en/latest/user/error-codes.html
# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes

lbdreyer marked this conversation as resolved.
Show resolved Hide resolved
select = C,E,F,W,B,B950
ignore =
# E203: whitespace before ':'
E203,
# E226: missing whitespace around arithmetic operator
E226,
# E231: missing whitespace after ',', ';', or ':'
E231,
# E402: module level imports on one line
E402,
# E501: line too long
E501,
# E731: do not assign a lambda expression, use a def
E731,
# W503: line break before binary operator
W503,
# W504: line break after binary operator
W504
exclude =
.eggs
build
93 changes: 86 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,43 @@
# Directory-based project format:
.idea/

# Created by editors
*~
\#*
\.\#*
*.swp

# setuptools-scm
_version.py

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -35,28 +52,90 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Created by editiors
*~
\#*
\.\#*
*.swp
# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
37 changes: 37 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.0.1'
hooks:
# Prevent giant files from being committed.
- id: check-added-large-files
# Check whether files parse as valid Python.
- id: check-ast
# Check for file name conflicts on case-insensitive filesytems.
- id: check-case-conflict
# Check for files that contain merge conflict strings.
- id: check-merge-conflict
# Check for debugger imports and py37+ `breakpoint()` calls in Python source.
- id: debug-statements
# Don't commit to master branch.
- id: no-commit-to-branch
- repo: https://github.com/psf/black
rev: '21.5b2'
hooks:
- id: black
# Force black to run on whole repo, using settings from pyproject.toml
pass_filenames: false
args: [--config=./pyproject.toml, .]
- repo: https://github.com/PyCQA/flake8
rev: '3.9.2'
hooks:
# Run flake8.
- id: flake8
args: [--config=./.flake8]
- repo: https://github.com/pycqa/isort
rev: '5.8.0'
lbdreyer marked this conversation as resolved.
Show resolved Hide resolved
hooks:
- id: isort
name: isort
args: ["--profile", "black", "--filter-files"]
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include LICENSE
include versioneer.py
include nc_time_axis/_version.py

recursive-include nc_time_axis/tests *.py
graft requirements
Loading