-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CDAT Migration Phase 2: Add CDAT regression test notebook template an…
…d fix GH Actions build (#743) - Add Makefile for quick access to multiple Python-based commands such as linting, testing, cleaning up cache and build files - Fix some lingering unit tests failure - Update `xcdat=0.6.0rc1` to `xcdat >=0.6.0` in `ci.yml`, `dev.yml` and `dev-nompi.yml` - Add `xskillscore` to `ci.yml` - Fix `pre-commit` issues
- Loading branch information
1 parent
a27fb53
commit c1332db
Showing
43 changed files
with
1,478 additions
and
256 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
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,82 @@ | ||
.PHONY: clean clean-test clean-pyc clean-build docs help | ||
.DEFAULT_GOAL := help | ||
|
||
define BROWSER_PYSCRIPT | ||
import os, webbrowser, sys | ||
|
||
from urllib.request import pathname2url | ||
|
||
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) | ||
endef | ||
export BROWSER_PYSCRIPT | ||
|
||
define PRINT_HELP_PYSCRIPT | ||
import re, sys | ||
|
||
for line in sys.stdin: | ||
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line) | ||
if match: | ||
target, help = match.groups() | ||
print("%-20s %s" % (target, help)) | ||
endef | ||
export PRINT_HELP_PYSCRIPT | ||
|
||
BROWSER := python -c "$$BROWSER_PYSCRIPT" | ||
|
||
# To run these commands: make <COMMAND> | ||
# ================================================== | ||
|
||
help: | ||
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) | ||
|
||
# Clean local repository | ||
# ---------------------- | ||
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts | ||
|
||
clean-build: ## remove build artifacts | ||
rm -fr build/ | ||
rm -fr conda-build/ | ||
rm -fr dist/ | ||
rm -fr .eggs/ | ||
find . -name '*.egg-info' -exec rm -fr {} + | ||
find . -name '*.egg' -exec rm -f {} + | ||
|
||
clean-pyc: ## remove Python file artifacts | ||
find . -name '*.pyc' -exec rm -f {} + | ||
find . -name '*.pyo' -exec rm -f {} + | ||
find . -name '*~' -exec rm -f {} + | ||
find . -name '__pycache__' -exec rm -fr {} + | ||
|
||
clean-test: ## remove test and coverage artifacts | ||
rm -fr tests_coverage_reports/ | ||
rm -f .coverage | ||
rm -fr htmlcov/ | ||
rm -f coverage.xml | ||
rm -fr .pytest_cache | ||
rm -rf .mypy_cache | ||
|
||
# Quality Assurance | ||
# ---------------------- | ||
pre-commit: # run pre-commit quality assurance checks | ||
pre-commit run --all-files | ||
|
||
lint: ## check style with flake8 | ||
flake8 e3sm_diags tests | ||
|
||
test: ## run tests quickly with the default Python and produces code coverage report | ||
pytest | ||
$(BROWSER) tests_coverage_reports/htmlcov/index.html | ||
|
||
# Documentation | ||
# ---------------------- | ||
docs: ## generate Sphinx HTML documentation, including API docs | ||
rm -rf docs/generated | ||
cd docs && make html | ||
$(MAKE) -C docs clean | ||
$(MAKE) -C docs html | ||
$(BROWSER) docs/_build/html/index.html | ||
|
||
# Build | ||
# ---------------------- | ||
install: clean ## install the package to the active Python's site-packages | ||
python setup.py install |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.