-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate travis-ci to cirrus-ci (#66)
* refresh ncta * update readme * review actions * review actions
- Loading branch information
Showing
28 changed files
with
902 additions
and
3,028 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
hooks: | ||
- id: isort | ||
name: isort | ||
args: ["--profile", "black", "--filter-files"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.