Skip to content

Update usage.rst

Update usage.rst #589

Workflow file for this run

name: tests
#Running tests on all branches
on:
push:
pull_request:
branches:
- main
workflow_dispatch:
# Needed for micromamba pickup
defaults:
run:
shell: bash -l {0}
jobs:
test:
# Setup the Python that the ROOT binary was built against
runs-on: ${{ matrix.os }}
# On push events run the CI only on main by default, but run on any branch if the commit message contains '[ci all]'
if: >-
github.event_name != 'push'
|| (github.event_name == 'push' && github.ref == 'refs/heads/main')
|| (github.event_name == 'push' && github.ref != 'refs/heads/main' && contains(github.event.head_commit.message, '[ci all]'))
strategy:
matrix:
os: [ubuntu-latest]
root-version: ["", "6.24", "6.26", "6.28", "6.30"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
exclude:
- root-version: "6.24"
python-version: "3.10"
- root-version: "6.24"
python-version: "3.11"
- root-version: "6.26"
python-version: "3.6"
- root-version: "6.26"
python-version: "3.7"
- root-version: "6.26"
python-version: "3.11"
- root-version: "6.28"
python-version: "3.6"
- root-version: "6.28"
python-version: "3.7"
- root-version: "6.30"
python-version: "3.6"
- root-version: "6.30"
python-version: "3.7"
include:
- os: macos-latest
root-version: "6.30"
python-version: "3.11"
steps:
- uses: actions/checkout@v4
- name: Setup Micromamba environment
if: ${{ matrix.root-version }}
uses: mamba-org/setup-micromamba@v1
with:
environment-name: ci
create-args: >-
python=${{ matrix.python-version }}
root=${{ matrix.root-version }}
imagemagick
ghostscript
pip
condarc: |
channels:
- conda-forge
- name: Setup Micromamba environment without ROOT
if: ${{ !matrix.root-version }}
uses: mamba-org/setup-micromamba@v1
with:
environment-name: ci
create-args: >-
python=${{ matrix.python-version }}
imagemagick
ghostscript
pip
condarc: |
channels:
- conda-forge
- name: ROOT info
if: ${{ matrix.root-version }}
run: |
root-config --version
root-config --python-version
# Install dependencies
- name: Install python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade \
'pylint' \
pytest_pylint \
configparser \
astroid \
pyyml \
papermill \
nbconvert \
jupyter \
pytest \
pytest-cov
- name: Install hepdata_lib
run: python -m pip install '.[test]'
# Use python -m pytest to add current working dir as src/ dir layout not used
- name: Run pytest
if: ${{ matrix.root-version }}
run: |
python -m pytest tests
- name: Run pytest without ROOT
if: ${{ !matrix.root-version }}
run: |
python -m pytest tests -m 'not needs_root'
- name: Report coverage with Codecov
if: ${{ matrix.root-version }}
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
flags: unittests-${{ matrix.python-version }}
- name: Save notebooks
if: ${{ always() && matrix.root-version }}
run: |
python -m jupyter kernelspec list
python -m jupyter nbconvert --ExecutePreprocessor.timeout=600 --ExecutePreprocessor.allow_errors=True --to html --execute examples/*.ipynb
- name: Upload notebooks
if: ${{ always() && matrix.root-version }}
uses: actions/upload-artifact@v4
with:
name: notebooks-${{ matrix.root-version }}-${{ matrix.python-version }}-${{ matrix.os }} py3-${{ matrix.root-version }}-${{ matrix.python-version }}-${{ matrix.os }}
path: examples/*.html
- name: Run pylint
if: ${{ always() && !startsWith(matrix.python-version, '3.6') && !startsWith(matrix.python-version, '3.7') }}
run: |
python -m pylint hepdata_lib/*.py
python -m pylint tests/*.py