Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from pyomeca/dev
Merge dev to master
- Loading branch information
Showing
86 changed files
with
95,373 additions
and
3,281 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
schedule: | ||
# every sunday at 14:00 UTC | ||
- cron: '0 14 * * SUN' | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: [3.6, 3.7, 3.8] | ||
name: ${{ matrix.os }} - Python ${{ matrix.python-version }} | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Setup conda | ||
uses: s-weigand/setup-conda@v1 | ||
with: | ||
activate-conda: true | ||
update-conda: true | ||
python-version: ${{ matrix.python-version }} | ||
conda-channels: conda-forge | ||
|
||
- name: Add path DLL to windows path (windows only) | ||
if: startsWith(matrix.os, 'windows') | ||
run: echo "##[add-path]C:\Miniconda\Library\bin" | ||
|
||
- name: Install Dependencies | ||
run: | | ||
conda env update -f environment.yml -n base | ||
pip install -r requirements-dev.txt | ||
conda info -a | ||
- name: Lint (ubuntu only) | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: black --check . | ||
|
||
- name: Test | ||
run: | | ||
cp README.md docs/index.md | ||
python -m pytest --cov-report term-missing --color=yes --cov=pyomeca tests | ||
- name: Coverage (ubuntu only) | ||
if: startsWith(matrix.os, 'ubuntu') | ||
env: | ||
COVERALLS_REPO_TOKEN: PZM3oz4Z1NbKgI9rvS7Of89vA7KdHsDAE | ||
run: | | ||
pip install coveralls | ||
coveralls |
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 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
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,112 +1,26 @@ | ||
.PHONY: test cover clean lint create_env | ||
.PHONY : test lint doc nb_to_md clean all | ||
|
||
################################################################################# | ||
# GLOBALS # | ||
################################################################################# | ||
|
||
REPO_NAME = pyomeca | ||
EXCLUDES_LINT = --exclude=bin/,src/rebuydsutils/,docs/conf.py | ||
EXCLUDES_PYTEST = --ignore src/rebuydsutils | ||
SHELL=/bin/bash | ||
|
||
ifeq (,$(shell which conda)) | ||
$(error conda must be installed) | ||
endif | ||
|
||
# Define utility variable to help calling Python from the virtual environment | ||
ifeq ($(CONDA_DEFAULT_ENV),$(REPO_NAME)) | ||
ACTIVATE_ENV := true | ||
else | ||
ACTIVATE_ENV := source activate $(REPO_NAME) | ||
endif | ||
|
||
# Execute python related functionalities from within the project's environment | ||
define execute_in_env | ||
$(ACTIVATE_ENV) && $1 | ||
endef | ||
|
||
################################################################################# | ||
# PROJECT RULES # | ||
################################################################################# | ||
lint: | ||
isort -rc . ;\ | ||
autoflake -r --in-place --remove-unused-variables . ;\ | ||
black . | ||
|
||
## Run pytest on the project | ||
test: | ||
$(call execute_in_env, python -m pytest --color=yes tests $(EXCLUDES_PYTEST)) | ||
pytest --cov-report term-missing --color=yes --cov=pyomeca tests -rxXs | ||
|
||
## Run coverage test on the project | ||
cover: | ||
$(call execute_in_env, python -m pytest --color=yes --cov=pyomeca tests $(EXCLUDES_PYTEST)) | ||
nb_to_md: | ||
jupyter nbconvert --to markdown notebooks/getting-started.ipynb --output-dir='./docs' --template=docs/nbconvert.tpl | ||
|
||
## Delete all compiled Python files | ||
clean: | ||
find . -name "*.pyc" -exec rm {} \; | ||
|
||
## Lint using flake8; Excluding $EXCLUDES_LINT | ||
lint: | ||
$(call execute_in_env, flake8 $(EXCLUDES_LINT) .) | ||
doc: | ||
# copy readme, correct path and delete link to documentation | ||
sed 's,docs/,,g' README.md > docs/index.md; \ | ||
sed -i -z "s,\n## Pyomeca documentation\n\nSee Pyomeca's \[documentation site\](https://pyomeca.github.io).\n,,g" docs/index.md; \ | ||
sed -i -z "s,\nSee \[the documentation\](https://pyomeca.github.io) for more details and examples.\n,,g" docs/index.md; \ | ||
cd ../pyomeca.github.io; \ | ||
mkdocs gh-deploy --config-file ../pyomeca/mkdocs.yml --remote-branch master | ||
rm -rf site | ||
|
||
## Set up python interpreter environment | ||
create_env: | ||
conda env create -n $(REPO_NAME) -f environment.yml | ||
rm -rf *.egg-info | ||
|
||
################################################################################# | ||
# Self Documenting Commands # | ||
################################################################################# | ||
|
||
.DEFAULT_GOAL := help | ||
clean: | ||
rm -rf .pytest_cache .coverage site notebooks/.ipynb_checkpoints | ||
|
||
# Inspired by <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html> | ||
# sed script explained: | ||
# /^##/: | ||
# * save line in hold space | ||
# * purge line | ||
# * Loop: | ||
# * append newline + line to hold space | ||
# * go to next line | ||
# * if line starts with doc comment, strip comment character off and loop | ||
# * remove target prerequisites | ||
# * append hold space (+ newline) to line | ||
# * replace newline plus comments by `---` | ||
# * print line | ||
# Separate expressions are necessary because labels cannot be delimited by | ||
# semicolon; see <http://stackoverflow.com/a/11799865/1968> | ||
.PHONY: help | ||
help: | ||
@echo "$$(tput bold)Available rules:$$(tput sgr0)" | ||
@echo | ||
@sed -n -e "/^## / { \ | ||
h; \ | ||
s/.*//; \ | ||
:doc" \ | ||
-e "H; \ | ||
n; \ | ||
s/^## //; \ | ||
t doc" \ | ||
-e "s/:.*//; \ | ||
G; \ | ||
s/\\n## /---/; \ | ||
s/\\n/ /g; \ | ||
p; \ | ||
}" ${MAKEFILE_LIST} \ | ||
| LC_ALL='C' sort --ignore-case \ | ||
| awk -F '---' \ | ||
-v ncol=$$(tput cols) \ | ||
-v indent=19 \ | ||
-v col_on="$$(tput setaf 6)" \ | ||
-v col_off="$$(tput sgr0)" \ | ||
'{ \ | ||
printf "%s%*s%s ", col_on, -indent, $$1, col_off; \ | ||
n = split($$2, words, " "); \ | ||
line_length = ncol - indent; \ | ||
for (i = 1; i <= n; i++) { \ | ||
line_length -= length(words[i]) + 1; \ | ||
if (line_length <= 0) { \ | ||
line_length = ncol - indent - length(words[i]) - 1; \ | ||
printf "\n%*s ", -indent, " "; \ | ||
} \ | ||
printf "%s ", words[i]; \ | ||
} \ | ||
printf "\n"; \ | ||
}' \ | ||
| more $(shell test $(shell uname) = Darwin && echo '--no-init --raw-control-chars') | ||
all: lint nb_to_md test doc clean |
Oops, something went wrong.