-
Notifications
You must be signed in to change notification settings - Fork 44
Cirrus CI #250
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
Merged
Merged
Cirrus CI #250
Changes from 51 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
03d60a9
Travis test with both Iris latest-release and latest-master. (#231)
pp-mo 85a5f4b
Cosmetic change : rename the travis iris-test-version options (#234)
pp-mo 9c6bea6
Version 0.16 release candidate (#232)
pp-mo 5a96b74
Fix RC date in release notes (about to cut). (#235)
pp-mo 9a5859f
Add 'main' conda-forge channel, needed for docs builds. (#240)
pp-mo e0ade8d
Update requirements to pick up Iris 3. (#243)
pp-mo 93fc344
Remove eccodes bug workaround added in #208. (#224)
pp-mo df97291
Docstest 0v16 (#244)
pp-mo d1df9f0
Added getting started .cirrus.yml
jamesp d0c01c0
Update cirrus to use miniconda image
jamesp ef1bd66
Update .cirrus.yml
jamesp c321c13
Update .cirrus.yml
jamesp b113b62
Added nox testing
jamesp ac410a6
Path fixes in cirrus.yml
jamesp f0dfef9
eccodes test added to noxfile
jamesp fd4f502
Added config and coverage
jamesp 86f81da
Trying to set SITE_CFG
jamesp 6bd2dba
syntax error
jamesp 5e8e0c5
taking the IRIS_DIR from Travis CI config
jamesp 75ee11d
Add allow_failures to the linux task for now
jamesp cc4c5cd
Dodgy r key...
jamesp 3f22294
Update .cirrus.yml
jamesp fab9bcf
Allow failures in linting
jamesp 8298d84
Force return error 0 for now
jamesp b75c7ab
Added eccodes test
jamesp 939d96e
moved matrix
jamesp 41f5a76
Yaml syntax error & * wrong way around
jamesp 15cae9c
Typo
jamesp d1c07e1
Update iris version dependency
jamesp 006ac83
Date fix
jamesp dce00e0
Configure Iris in nox
jamesp d2f6666
Merge branch 'master' of github.com:jamesp/iris-grib
jamesp 6eced74
Updated CI config
jamesp b550bad
correct site-packages path
jamesp 1615d75
Fix to iris test data path
jamesp d33cfff
force cache update
jamesp 4fb5ccd
refactored writing iris config in noxfile
jamesp d1b192e
Merge remote-tracking branch 'upstream/v0.16.x' into cirrus-16
jamesp 5258038
Fix pep8 and license test fails
jamesp 083f62b
Support for testing against packaged iris and building from source
jamesp 1a228d9
Adding yaml to list of cirrus container requirements
jamesp 5e97407
invalidate cirrus cache
jamesp 5854630
really invalidate cirrus cache...
jamesp 7e6d456
yaml -> pyyaml
jamesp d894ca1
missing iris_dir reference
jamesp ddb5600
call write_iris_config
jamesp 2d7f31a
docstrings and matrix testing
jamesp 8e21f0a
git syntax error
jamesp 0ce6db5
Merged cirrus ci and nox
jamesp c5d6778
eccodes selfcheck in basic tests
jamesp 0449696
Removed py3.8 testing for now
jamesp 289dd0e
Fixed regression in setup.py test
jamesp e895af6
Removed unused imports
jamesp a9d80d7
Disabled lint checking
jamesp f5e4703
Removed nox from test dependencies for python3.6 and python3.8
jamesp 40a448d
Removed python3.8 from noxfile
jamesp 69603d9
Removed nox from test requirements
jamesp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,106 @@ | ||
| # Reference: | ||
| # - https://cirrus-ci.org/guide/writing-tasks/ | ||
| # - https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks | ||
| # - https://cirrus-ci.org/guide/linux/ | ||
| # - https://cirrus-ci.org/guide/macOS/ | ||
| # - https://cirrus-ci.org/guide/windows/ | ||
| # - https://hub.docker.com/_/gcc/ | ||
| # - https://hub.docker.com/_/python/ | ||
|
|
||
| # | ||
| # Global defaults. | ||
| # | ||
| container: | ||
| image: python:3.8 | ||
| 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 conda cache upload. | ||
| CONDA_CACHE_BUILD: "98" | ||
| # Increment the build number to force new nox cache upload. | ||
| NOX_CACHE_BUILD: "98" | ||
| # Increment the build number to force new pip cache upload. | ||
| PIP_CACHE_BUILD: "98" | ||
| # Pip package to be upgraded/installed. | ||
| PIP_CACHE_PACKAGES: "pip setuptools wheel nox pyyaml" | ||
| # Base directory for the iris-test-data. | ||
| IRIS_TEST_DATA_DIR: ${HOME}/iris-test-data | ||
| # Git commit hash for iris test data. | ||
| IRIS_TEST_DATA_REF: "2.0.0" | ||
|
|
||
| # | ||
| # Linting | ||
| # | ||
| lint_task: | ||
| auto_cancellation: true | ||
| allow_failures: true | ||
| name: "${CIRRUS_OS}: flake8 and black" | ||
| pip_cache: | ||
| folder: ~/.cache/pip | ||
| fingerprint_script: | ||
| - echo "${CIRRUS_TASK_NAME}" | ||
| - 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 | ||
| - "nox --session flake8 || :" | ||
| - "nox --session black || :" | ||
|
|
||
|
|
||
| # | ||
| # Testing (Linux) | ||
| # | ||
| linux_task_template: &LINUX_TASK_TEMPLATE | ||
| auto_cancellation: true | ||
| env: | ||
| PATH: ${HOME}/miniconda/bin:${PATH} | ||
|
|
||
| container: | ||
| image: gcc:latest | ||
| cpu: 6 | ||
| memory: 8G | ||
| conda_cache: | ||
| folder: ${HOME}/miniconda | ||
| fingerprint_script: | ||
| - wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh | ||
| - echo "${CIRRUS_OS} $(sha256sum miniconda.sh)" | ||
| - echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${CONDA_CACHE_BUILD}" | ||
| populate_script: | ||
| - bash miniconda.sh -b -p ${HOME}/miniconda | ||
| - conda config --set always_yes yes --set changeps1 no | ||
| - conda config --set show_channel_urls True | ||
| - conda config --add channels conda-forge | ||
| - conda update --quiet --name base conda | ||
| - conda install --quiet --name base nox pip coverage pyyaml | ||
| nox_cache: | ||
| folder: ${CIRRUS_WORKING_DIR}/.nox | ||
| fingerprint_script: | ||
| - echo "${CIRRUS_TASK_NAME}" | ||
| - echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${NOX_CACHE_BUILD}" | ||
| - sha256sum ${CIRRUS_WORKING_DIR}/requirements/ci/py$(echo ${PY_VER} | tr -d ".").yml | ||
| - echo "IRIS ${IRIS_SOURCE}" | ||
| data_cache: | ||
| folder: ${IRIS_TEST_DATA_DIR} | ||
| fingerprint_script: | ||
| - echo "${IRIS_TEST_DATA_REF}" | ||
| populate_script: | ||
| - wget --quiet https://github.com/SciTools/iris-test-data/archive/v${IRIS_TEST_DATA_REF}.zip -O iris-test-data.zip | ||
| - unzip -q iris-test-data.zip | ||
| - mv iris-test-data-$(echo "${IRIS_TEST_DATA_REF}" | sed "s/^v//") ${IRIS_TEST_DATA_DIR} | ||
|
|
||
| tests_task: | ||
| matrix: | ||
| env: | ||
| PY_VER: 3.6 | ||
| env: | ||
| PY_VER: 3.7 | ||
| # env: | ||
| # PY_VER: 3.8 | ||
| name: "${CIRRUS_OS}: py${PY_VER} tests" | ||
| << : *LINUX_TASK_TEMPLATE | ||
| tests_script: | ||
| - nox --session tests -- --test-data-dir ${IRIS_TEST_DATA_DIR}/test_data | ||
This file contains hidden or 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 hidden or 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,9 @@ | ||
| # Copyright iris-grib contributors | ||
| # | ||
| # This file is part of iris-grib and is released under the LGPL license. | ||
| # See COPYING and COPYING.LESSER in the root of the repository for full | ||
| # licensing details. | ||
| """ | ||
| Empty file to allow import. | ||
|
|
||
| """ |
This file contains hidden or 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,40 @@ | ||
| # Copyright iris-grib contributors | ||
| # | ||
| # This file is part of iris-grib and is released under the LGPL license. | ||
| # See COPYING and COPYING.LESSER in the root of the repository for full | ||
| # licensing details. | ||
| """ | ||
| Provides testing capabilities for installed copies of iris-grib. | ||
|
|
||
| """ | ||
|
|
||
| import argparse | ||
|
|
||
| from ._runner import TestRunner | ||
|
|
||
|
|
||
| parser = argparse.ArgumentParser( | ||
| "iris_grib.tests", description=TestRunner.description | ||
| ) | ||
| for long_opt, short_opt, help_text in TestRunner.user_options: | ||
| long_opt = long_opt.strip("=") | ||
| if long_opt in TestRunner.boolean_options: | ||
| parser.add_argument( | ||
| "--" + long_opt, | ||
| "-" + short_opt, | ||
| action="store_true", | ||
| help=help_text, | ||
| ) | ||
| else: | ||
| parser.add_argument("--" + long_opt, "-" + short_opt, help=help_text) | ||
| args = parser.parse_args() | ||
|
|
||
| runner = TestRunner() | ||
|
|
||
| runner.initialize_options() | ||
| for long_opt, short_opt, help_text in TestRunner.user_options: | ||
| arg = long_opt.replace("-", "_").strip("=") | ||
| setattr(runner, arg, getattr(args, arg)) | ||
| runner.finalize_options() | ||
|
|
||
| runner.run() |
This file contains hidden or 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,145 @@ | ||
| # Copyright iris-grib contributors | ||
| # | ||
| # This file is part of iris-grib and is released under the LGPL license. | ||
| # See COPYING and COPYING.LESSER in the root of the repository for full | ||
| # licensing details. | ||
| """ | ||
| Provides testing capabilities for installed copies of iris-grib. | ||
|
|
||
| """ | ||
|
|
||
| # Because this file is imported by setup.py, there may be additional runtime | ||
| # imports later in the file. | ||
| import multiprocessing | ||
| import os | ||
| import sys | ||
|
|
||
|
|
||
| # NOTE: Do not inherit from object as distutils does not like it. | ||
| class TestRunner: | ||
| """Run the iris-grib tests under nose and multiprocessor for performance""" | ||
|
|
||
| description = ( | ||
| "Run tests under nose and multiprocessor for performance. " | ||
| "Specifying one or more test flags will run *only* those " | ||
| "tests." | ||
| ) | ||
| user_options = [ | ||
| ( | ||
| "no-data", | ||
| "n", | ||
| "Override the paths to the data repositories so it " | ||
| "appears to the tests that it does not exist.", | ||
| ), | ||
| ("stop", "x", "Stop running tests after the first error or failure."), | ||
| ("unit-tests", "s", "Run the limited subset of unit tests."), | ||
| ("integration-tests", "i", "Run the integration tests."), | ||
| ("default-tests", "d", "Run the default tests."), | ||
| ( | ||
| "coding-tests", | ||
| "c", | ||
| "Run the coding standards tests. (These are a " | ||
| "subset of the default tests.)", | ||
| ), | ||
| ( | ||
| "num-processors=", | ||
| "p", | ||
| "The number of processors used for running " "the tests.", | ||
| ), | ||
| ("create-missing", "m", "Create missing test result files."), | ||
| ] | ||
| boolean_options = [ | ||
| "no-data", | ||
| "unit-tests", | ||
| "stop", | ||
| "default-tests", | ||
| "integration-tests", | ||
| "create-missing", | ||
| ] | ||
|
|
||
| def initialize_options(self): | ||
| self.no_data = False | ||
| self.stop = False | ||
| self.unit_tests = False | ||
| self.default_tests = False | ||
| self.integration_tests = False | ||
| self.num_processors = None | ||
| self.create_missing = False | ||
|
|
||
| def finalize_options(self): | ||
| # These enviroment variables will be propagated to all the | ||
| # processes that nose.run creates. | ||
| if self.no_data: | ||
| print("Running tests in no-data mode...") | ||
| import iris.config | ||
|
|
||
| iris.config.TEST_DATA_DIR = None | ||
| if self.create_missing: | ||
| os.environ["IRIS_TEST_CREATE_MISSING"] = "true" | ||
|
|
||
| tests = [] | ||
| if self.unit_tests: | ||
| tests.append("unit") | ||
| if self.default_tests: | ||
| tests.append("default") | ||
| if self.integration_tests: | ||
| tests.append("integration") | ||
| if not tests: | ||
| tests.append("default") | ||
| print("Running test suite(s): {}".format(", ".join(tests))) | ||
| if self.stop: | ||
| print("Stopping tests after the first error or failure") | ||
| if self.num_processors is None: | ||
| # Choose a magic number that works reasonably well for the default | ||
| # number of processes. | ||
| self.num_processors = (multiprocessing.cpu_count() + 1) // 4 + 1 | ||
| else: | ||
| self.num_processors = int(self.num_processors) | ||
|
|
||
| def run(self): | ||
| import nose | ||
|
|
||
| if hasattr(self, "distribution") and self.distribution.tests_require: | ||
| self.distribution.fetch_build_eggs(self.distribution.tests_require) | ||
|
|
||
| tests = [] | ||
| if self.unit_tests: | ||
| tests.append("iris_grib.tests.unit") | ||
| if self.default_tests: | ||
| tests.append("iris_grib.tests") | ||
| if self.integration_tests: | ||
| tests.append("iris_grib.tests.integration") | ||
|
|
||
| if not tests: | ||
| tests.append("iris_grib.tests") | ||
|
|
||
| regexp_pat = r"--match=^([Tt]est(?![Mm]ixin)|[Ss]ystem)" | ||
|
|
||
| n_processors = max(self.num_processors, 1) | ||
|
|
||
| args = [ | ||
| "", | ||
| None, | ||
| "--processes=%s" % n_processors, | ||
| "--verbosity=2", | ||
| regexp_pat, | ||
| "--process-timeout=180", | ||
| ] | ||
|
|
||
| if self.stop: | ||
| args.append("--stop") | ||
|
|
||
| result = True | ||
| for test in tests: | ||
| args[1] = test | ||
| print() | ||
| print( | ||
| "Running test discovery on %s with %s processors." | ||
| % (test, n_processors) | ||
| ) | ||
| # run the tests at module level i.e. my_module.tests | ||
| # - test must start with test/Test and must not contain the | ||
| # word Mixin. | ||
| result &= nose.run(argv=args) | ||
| if result is False: | ||
| exit(1) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.