-
Notifications
You must be signed in to change notification settings - Fork 16
96 lines (79 loc) · 2.56 KB
/
python-ci.yml
File metadata and controls
96 lines (79 loc) · 2.56 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: CI
on:
push:
branches: [ master, dev, "dev_JV" ]
pull_request:
branches: [ master ]
jobs:
# ------------------------------------------------------------
# 1) INSTALL-ONLY MATRIX
# ------------------------------------------------------------
install:
name: Install check (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and build tools
run: python -m pip install --upgrade pip setuptools wheel build
- name: Install brukerapi (no tests)
run: |
git clone https://github.com/isi-nmr/brukerapi-python.git
cd brukerapi-python
pip install -e . --use-pep517
# ------------------------------------------------------------
# 2) FULL TEST JOB
# ------------------------------------------------------------
test:
name: Full tests (Python 3.13)
runs-on: ubuntu-latest
needs: install
strategy:
matrix:
python-version: ["3.13"]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and build tools
run: python -m pip install --upgrade pip setuptools wheel build
- name: Install brukerapi with dev dependencies
run: |
git clone https://github.com/isi-nmr/brukerapi-python.git
cd brukerapi-python
pip install pytest zenodo_get pytest-cov
pip install -e .[dev] --use-pep517
- name: Cache Zenodo data
uses: actions/cache@v5
with:
path: test/zenodo_zips
key: zenodo-4522220
- name: Run all dataset tests
run: |
python -m pytest test -v --cov=brukerapi --cov-branch --cov-report=xml --cov-report=term-missing --cov-report=html
- name: Upload coverage HTML
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: htmlcov/
- name: Print total coverage
run: |
echo "Total coverage:"
python - <<EOF
import xml.etree.ElementTree as ET
tree = ET.parse('coverage.xml')
root = tree.getroot()
line_rate = float(root.attrib['line-rate']) * 100
print(f"{line_rate:.2f}%")
EOF