-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved tests.yml and added notebook previews (#142)
* Improved tests and added notebook previews
- Loading branch information
Showing
1 changed file
with
93 additions
and
9 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 |
---|---|---|
|
@@ -11,27 +11,58 @@ jobs: | |
image: 'rootproject/root:latest' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Test with pytest | ||
|
||
# Install dependencies | ||
- name: Install dependencies | ||
run: | | ||
yum install -y python-pip ghostscript | ||
python -m pip install pytest_pylint configparser astroid pyyml papermill | ||
python -m pip install pytest_pylint configparser astroid pyyml papermill nbconvert | ||
# Run pytest | ||
- name: Run pytest | ||
run: | | ||
python -m pip install -e . | ||
python setup.py test | ||
# Save notebooks | ||
- name: Save notebooks | ||
if: ${{ always() }} | ||
run: | | ||
python -m jupyter nbconvert --ExecutePreprocessor.timeout=600 --ExecutePreprocessor.allow_errors=True --to html --execute examples/*.ipynb | ||
# Upload notebooks | ||
- name: Upload notebooks | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: notebooks py3 | ||
path: examples/*.html | ||
|
||
# Run pylint | ||
- name: Run pylint | ||
if: ${{ always() }} | ||
run: | | ||
python -m pip install -e . | ||
python -m pylint hepdata_lib/*.py | ||
python -m pylint tests/*.py --rcfile=tests/pylintrc | ||
# This is a job for macOS python3 tests | ||
macospy3: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Test with pytest | ||
|
||
# Install dependencies | ||
- name: Install dependencies | ||
run: | | ||
ROOT_VERSION=6.20.04_1 | ||
brew update | ||
brew install fontconfig gd gettext libffi glib jasper netpbm gts graphviz gsl libxml2 openblas numpy tbb xrootd || true | ||
brew install [email protected] [email protected] || true | ||
# Run pytest | ||
- name: Run pytest | ||
run: | | ||
ROOT_VERSION=6.20.04_1 | ||
curl -O https://clange.web.cern.ch/clange/root-v${ROOT_VERSION}.tar.gz | ||
tar xzf root-v${ROOT_VERSION}.tar.gz | ||
mkdir -p /usr/local/Cellar/root | ||
|
@@ -42,18 +73,46 @@ jobs: | |
export LD_LIBRARY_PATH=${PWD}/lib/root:${LD_LIBRARY_PATH} | ||
echo ${PYTHONPATH} | ||
cd - | ||
python3 -m pip install pytest ipykernel papermill | ||
python3 -m pip install pytest ipykernel papermill jupyter_client nbconvert | ||
python3 setup.py test | ||
# Save notebooks | ||
- name: Save notebooks | ||
if: ${{ always() }} | ||
run: | | ||
cd /usr/local/Cellar/root/${ROOT_VERSION} | ||
export PATH=${PWD}/bin:$(brew --cellar [email protected])/$(ls $(brew --cellar [email protected]))/bin:${PATH} | ||
export PYTHONPATH=${PWD}/lib/root:${PYTHONPATH} | ||
export LD_LIBRARY_PATH=${PWD}/lib/root:${LD_LIBRARY_PATH} | ||
echo ${PYTHONPATH} | ||
cd - | ||
python3 -m jupyter nbconvert --ExecutePreprocessor.timeout=600 --ExecutePreprocessor.kernel_name=python3 --ExecutePreprocessor.allow_errors=True --to html --execute examples/*.ipynb | ||
# Upload notebooks | ||
- name: Upload notebooks | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: notebooks macOS | ||
path: examples/*.html | ||
|
||
# Run Pylint | ||
- name: Run Pylint | ||
if: ${{ always() }} | ||
run: | | ||
python3 -m pip install pytest ipykernel papermill | ||
python3 -m pip install -e . | ||
python3 -m pylint hepdata_lib/*.py | ||
python3 -m pylint tests/*.py --rcfile=tests/pylintrc | ||
# This is a job for linux python2.7 tests | ||
linuxpy27: | ||
runs-on: ubuntu-16.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Test with pytest | ||
|
||
# Install dependencies | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get install python2.7 | ||
python -m pip install --upgrade pip | ||
|
@@ -64,10 +123,35 @@ jobs: | |
sudo sed -i '/MVG/d' /etc/ImageMagick-6/policy.xml | ||
sudo sed -i '/PDF/{s/none/read|write/g}' /etc/ImageMagick-6/policy.xml | ||
sudo sed -i '/PDF/ a <policy domain="coder" rights="read|write" pattern="LABEL" />' /etc/ImageMagick-6/policy.xml | ||
python -m pip install --upgrade enum34 pytest_pylint configparser astroid future ipykernel papermill | ||
python -m pip install --upgrade enum34 pytest_pylint configparser astroid future ipykernel papermill nbconvert | ||
sudo apt update | ||
sudo apt install -y ghostscript | ||
# Run pytest | ||
- name: Run pytest | ||
run: | | ||
source root/bin/thisroot.sh | ||
python setup.py test | ||
# Save notebooks | ||
- name: Save notebooks | ||
if: ${{ always() }} | ||
run: | | ||
source root/bin/thisroot.sh | ||
export PATH=$PATH:~/.local/bin | ||
source ~/.bash_profile | ||
jupyter nbconvert --ExecutePreprocessor.timeout=600 --ExecutePreprocessor.kernel_name=python2 --ExecutePreprocessor.allow_errors=True --to html --execute examples/*.ipynb | ||
# Upload notebooks | ||
- name: Upload notebooks | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: notebooks py27 | ||
path: examples/*.html | ||
|
||
# Run pylint | ||
- name: Run Pylint | ||
if: ${{ always() }} | ||
run: | | ||
python -m pylint hepdata_lib/*.py | ||
python -m pylint tests/*.py --rcfile=tests/pylintrc |