-
Notifications
You must be signed in to change notification settings - Fork 3
153 lines (134 loc) · 4.6 KB
/
dependency-testing.yaml
File metadata and controls
153 lines (134 loc) · 4.6 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Dependency Compatibility Testing
on:
push:
branches: [main]
paths:
- 'pyproject.toml'
- 'requirements/**'
- 'validmind/**'
- 'tests/**'
pull_request:
branches: ['*']
paths:
- 'pyproject.toml'
- 'requirements/**'
- 'validmind/**'
- 'tests/**'
schedule:
# Run weekly on Sundays at 2 AM UTC to catch new dependency releases
- cron: '0 2 * * 0'
workflow_dispatch:
inputs:
test_type:
description: 'Type of dependency test to run'
required: true
default: 'all'
type: choice
options:
- 'all'
- 'min-versions'
- 'max-versions'
- 'python-versions'
- 'pip-freeze'
permissions:
contents: read
jobs:
dependency-matrix:
name: Test Python ${{ matrix.python-version }} with ${{ matrix.deps-type }} dependencies
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
deps-type: ['max', 'default']
steps:
- uses: actions/checkout@v4
- name: Free Disk Space
run: ./disk_clean.sh
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libomp-dev
- name: Install build tooling (build and uv)
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Build wheel and sdist
run: |
python -m build
- name: Install and test via pip artifacts (${{ matrix.deps-type }})
run: |
set -euxo pipefail
# limit threads to avoid resource contention
export OMP_NUM_THREADS=1
export MKL_NUM_THREADS=1
if [[ "${{ matrix.deps-type }}" == "default" ]]; then
# Install only from built artifacts (let pip resolve deps normally)
WHEEL=$(ls dist/*.whl | head -n 1)
python -m pip install "${WHEEL}[all]"
pip check
python -m tests.test_unit_tests | cat
else
# Generate latest-compatible constraints (max)
OUT=constraints-max.txt
uv pip compile pyproject.toml -p "${{ matrix.python-version }}" --all-extras --no-emit-index-url --no-annotate --no-strip-markers --output-file "$OUT" --upgrade
# Install constraints then the wheel without reinstalling deps
pip install -r "$OUT"
WHEEL=$(ls dist/*.whl | head -n 1)
python -m pip install "${WHEEL}[all]" --no-deps
pip check
python -m tests.test_unit_tests | cat
fi
pip-freeze-testing:
name: Test Client Pip Freeze Environments
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_type == 'pip-freeze' || github.event_name == 'schedule'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libomp-dev
- name: Install pip tooling
run: |
python -m pip install --upgrade pip
- name: Test pip freeze environments
env:
OMP_NUM_THREADS: 1
MKL_NUM_THREADS: 1
PIP_NO_CACHE_DIR: 1
run: |
set -euxo pipefail
if [ -z "${FREEZE_FILE:-}" ] || [ ! -f "$FREEZE_FILE" ]; then
echo "Set FREEZE_FILE env var to a pip freeze file path" >&2
exit 1
fi
python -m pip install --upgrade pip
pip install -r "$FREEZE_FILE"
python -m pip install . --no-deps
python -m tests.test_unit_tests | cat
report-status:
name: Report Dependency Testing Status
runs-on: ubuntu-latest
needs: [dependency-matrix]
if: always()
steps:
- name: Report results
run: |
echo "Dependency testing completed"
echo "Matrix job status: ${{ needs.dependency-matrix.result }}"
if [[ "${{ needs.dependency-matrix.result }}" == "failure" ]]; then
echo "❌ Some dependency combinations failed"
else
echo "✅ All dependency combinations passed"
fi