Run pre-commit hooks on travis

pull/699/head
Tim Head 2019-05-31 09:58:37 +02:00
rodzic 32b32bf1d9
commit 00d1258c07
1 zmienionych plików z 32 dodań i 9 usunięć

Wyświetl plik

@ -15,21 +15,44 @@ install:
- pip install dist/*.whl - pip install dist/*.whl
- pip freeze - pip freeze
script: script:
# cd into tests so CWD being repo2docker does not hide - |
# possible issues with MANIFEST.in # run autoformat
- pushd tests; if [[ "$REPO_TYPE" == "lint" ]]; then
if [ ${REPO_TYPE} == "r" ] || [ ${REPO_TYPE} == "stencila-r" ] || [ ${REPO_TYPE} == "stencila-py" ]; then pre-commit run --all-files
travis_wait 30 pytest --durations 10 --cov repo2docker -v ${REPO_TYPE} || exit 1; fi
else - |
travis_retry pytest --durations 10 --cov repo2docker -v ${REPO_TYPE} || exit 1; # run any of the other tests
fi; if [[ "$REPO_TYPE" != "lint" ]]; then
popd; # cd into tests so CWD being repo2docker does not hide
# possible issues with MANIFEST.in
pushd tests;
if [ ${REPO_TYPE} == "r" ] || [ ${REPO_TYPE} == "stencila-r" ] || [ ${REPO_TYPE} == "stencila-py" ]; then
travis_wait 30 pytest --durations 10 --cov repo2docker -v ${REPO_TYPE} || exit 1;
else
travis_retry pytest --durations 10 --cov repo2docker -v ${REPO_TYPE} || exit 1;
fi;
popd;
fi
after_success: after_success:
- pip install codecov - pip install codecov
- pushd tests && codecov && popd - pushd tests && codecov && popd
after_failure:
- |
# point to auto-lint-fix
if [[ "$REPO_TYPE" == "lint" ]]; then
echo "You can install pre-commit hooks to automatically run formatting"
echo "on each commit with:"
echo " pre-commit install"
echo "or you can run by hand on staged files with"
echo " pre-commit run"
echo "or after-the-fact on already committed files with"
echo " pre-commit run --all-files"
fi
env: env:
matrix: matrix:
- REPO_TYPE=lint
- REPO_TYPE=unit - REPO_TYPE=unit
- REPO_TYPE=base - REPO_TYPE=base
- REPO_TYPE=conda - REPO_TYPE=conda