chore: use 2x faster black mirror #1847
Workflow file for this run
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 workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- uses: pre-commit/[email protected] | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install cabinetry and dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install .[test] | |
- name: Static code analysis with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 src/cabinetry --select=E9,F63,F7,F82 --show-source | |
# check for additional issues flagged by flake8 | |
flake8 | |
- name: Format with Black | |
run: | | |
black --check --diff --verbose . | |
- name: Run example | |
run: | | |
python utils/create_ntuples.py | |
python example.py | |
- name: Install pyhf backends | |
run: | | |
python -m pip install .[pyhf_backends] # install pyhf backends | |
- name: Test with pytest, generate coverage report (skipping typeguard) | |
if: matrix.python-version == '3.8' | |
run: | | |
# skip typeguard for coverage https://github.com/agronholm/typeguard/issues/356 | |
pytest --runslow --cov-report=xml --typeguard-packages="" | |
- name: Test with pytest | |
if: matrix.python-version != '3.8' | |
run: | | |
pytest --runslow | |
- name: Upload coverage to codecov | |
if: matrix.python-version == '3.8' | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
name: codecov-umbrella | |
fail_ci_if_error: true | |
- name: Build docs with sphinx | |
run: | | |
python -m pip install .[docs] | |
sphinx-build -W docs docs/_build |