-
Notifications
You must be signed in to change notification settings - Fork 21
75 lines (70 loc) · 2.33 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 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/action@v3.0.0
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