-
Notifications
You must be signed in to change notification settings - Fork 26
130 lines (114 loc) · 4.42 KB
/
Copy pathpr_check.yml
File metadata and controls
130 lines (114 loc) · 4.42 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI Tests
on:
pull_request:
branches: [master, main]
push:
branches: [master, main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.11']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
# Cache the entire pip site-packages directory
- name: Cache pip packages
uses: actions/cache@v4
with:
path: |
~/.cache/pip
${{ steps.setup-python.outputs.python-path }}/lib/python${{ matrix.python-version }}/site-packages
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Install system dependencies
run: |
sudo apt-get update -q
sudo apt-get install -y ninja-build
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
# Install the build-system.requires from pyproject.toml explicitly so
# that --no-build-isolation works (avoids a redundant isolated env).
pip install "meson-python" "meson" "cython" "numpy"
- name: Install runtime dependencies (excluding wxpython)
run: |
# pymecompress must be built with --no-build-isolation to see the already-installed numpy.
pip install --no-build-isolation pymecompress
# Read remaining deps from pyproject.toml; skip wxpython (requires a display)
# and pymecompress.
python - <<'EOF'
import tomllib, subprocess, sys
with open('pyproject.toml', 'rb') as f:
deps = tomllib.load(f)['project']['dependencies']
skip = {'wxpython', 'pymecompress'}
deps = [d for d in deps if not any(d.lower().startswith(s) for s in skip)]
subprocess.check_call([sys.executable, '-m', 'pip', 'install'] + deps)
EOF
- name: Build and install package
run: |
# --no-build-isolation reuses the build deps installed above.
# --no-deps avoids pip trying to install wxpython at this stage.
pip install --no-build-isolation --no-deps .
env:
# Disable Intel SVML to avoid undefined symbol issues
NPY_DISABLE_SVML: 1
#CFLAGS: "-fno-vectorize"
- name: Install test dependencies
run: |
pip install pytest pytest-cov
- name: Run tests
run: |
pytest -v tests/ --cov=PYME --cov-report=xml --junit-xml=test-results-${{ matrix.python-version }}.xml
env:
GITHUB_CI: "1"
# Workaround for SVML symbols
#LD_PRELOAD: /usr/lib/x86_64-linux-gnu/libmvec.so.1
# Upload with unique name per matrix job
- name: Upload test results
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test-results-${{ matrix.python-version }}
path: test-results-${{ matrix.python-version }}.xml
retention-days: 30
# Only upload coverage from first matrix job
- name: Upload coverage report
uses: actions/upload-artifact@v4
if: ${{ always() && strategy.job-index == 0 }}
with:
name: coverage
path: coverage.xml
retention-days: 30
# Merge all test results into single artifact
merge-test-results:
runs-on: ubuntu-latest
needs: test
if: always()
steps:
- name: Merge test results
uses: actions/upload-artifact/merge@v4
with:
name: test-results
pattern: test-results-*
delete-merged: true
retention-days: 30
# - name: Upload coverage to Codecov
# # Only upload from one Python version to avoid duplicate reports
# if: matrix.python-version == '3.11' && !cancelled()
# uses: codecov/codecov-action@v4
# with:
# files: coverage.xml
# fail_ci_if_error: false
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}