-
Notifications
You must be signed in to change notification settings - Fork 1
169 lines (164 loc) · 6.77 KB
/
python_matrix.yml
File metadata and controls
169 lines (164 loc) · 6.77 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: Python Version Matrix
on:
workflow_dispatch:
schedule:
- cron: '0 3 * * 1' # Monday 03:00 UTC, off-cycle from the daily release
# Force local editable builds to outrank PyPI versions so pip's resolver
# doesn't replace `pip install -e ./PyAutoConf` (1.0.dev0) with PyPI's
# autoconf-2026.x during a downstream lib install. Without this, the
# stale daily-release PyPI artifacts shadow the merged main code.
env:
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_AUTOCONF: "9999.0.0"
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_AUTOARRAY: "9999.0.0"
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_AUTOFIT: "9999.0.0"
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_AUTOGALAXY: "9999.0.0"
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_AUTOLENS: "9999.0.0"
jobs:
unit_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
project:
- { name: PyAutoConf, tests: test_autoconf }
- { name: PyAutoArray, tests: test_autoarray }
- { name: PyAutoFit, tests: test_autofit }
- { name: PyAutoGalaxy, tests: test_autogalaxy }
- { name: PyAutoLens, tests: test_autolens }
steps:
- uses: actions/checkout@v4
with: { repository: PyAutoLabs/PyAutoConf, path: PyAutoConf }
- uses: actions/checkout@v4
with: { repository: PyAutoLabs/PyAutoArray, path: PyAutoArray }
- uses: actions/checkout@v4
with: { repository: PyAutoLabs/PyAutoFit, path: PyAutoFit }
- uses: actions/checkout@v4
with: { repository: PyAutoLabs/PyAutoGalaxy, path: PyAutoGalaxy }
- uses: actions/checkout@v4
with: { repository: PyAutoLabs/PyAutoLens, path: PyAutoLens }
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install libraries (single combined install — all 5 local)
run: |
python -m pip install --upgrade pip wheel
# Pass all 5 libs in ONE pip invocation so the resolver knows about
# every local checkout upfront. Without this, transitive deps
# (e.g. autogalaxy as a dep of autolens) get resolved from PyPI,
# and pip backtracks through the entire PyPI release history of
# autogalaxy looking for one whose nautilus-sampler pin matches
# the local autolens — which never matches because PyPI is stale.
pip install \
-e ./PyAutoConf \
-e ./PyAutoArray \
-e ./PyAutoFit \
-e ./PyAutoGalaxy \
-e "./PyAutoLens[optional]"
pip install pytest pytest-cov
# Show final installed versions for diagnosis
pip list | grep -iE "^(autoconf|autoarray|autofit|autogalaxy|autolens|jax|numpy|scipy|nautilus)"
- name: Run tests
env:
NUMBA_CACHE_DIR: /tmp/numba_cache
MPLCONFIGDIR: /tmp/matplotlib
JAX_ENABLE_X64: "True"
run: |
cd ${{ matrix.project.name }}
python -m pytest ${{ matrix.project.tests }}/ --tb=short
smoke_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
workspace:
- { repo: PyAutoLabs/autofit_workspace, path: autofit_workspace }
- { repo: PyAutoLabs/autogalaxy_workspace, path: autogalaxy_workspace }
- { repo: PyAutoLabs/autolens_workspace, path: autolens_workspace }
env:
PYAUTO_TEST_MODE: "1"
PYAUTO_SMALL_DATASETS: "1"
PYAUTO_FAST_PLOTS: "1"
NUMBA_CACHE_DIR: /tmp/numba_cache
MPLCONFIGDIR: /tmp/matplotlib
steps:
- uses: actions/checkout@v4
with: { repository: PyAutoLabs/PyAutoConf, path: PyAutoConf }
- uses: actions/checkout@v4
with: { repository: PyAutoLabs/PyAutoArray, path: PyAutoArray }
- uses: actions/checkout@v4
with: { repository: PyAutoLabs/PyAutoFit, path: PyAutoFit }
- uses: actions/checkout@v4
with: { repository: PyAutoLabs/PyAutoGalaxy, path: PyAutoGalaxy }
- uses: actions/checkout@v4
with: { repository: PyAutoLabs/PyAutoLens, path: PyAutoLens }
- uses: actions/checkout@v4
with: { repository: "${{ matrix.workspace.repo }}", path: "${{ matrix.workspace.path }}" }
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install libraries (single combined install — all 5 local)
run: |
python -m pip install --upgrade pip wheel
pip install \
-e ./PyAutoConf \
-e ./PyAutoArray \
-e ./PyAutoFit \
-e ./PyAutoGalaxy \
-e "./PyAutoLens[optional]"
pip install numba
pip list | grep -iE "^(autoconf|autoarray|autofit|autogalaxy|autolens|jax|numpy|scipy|nautilus)"
- name: Enable JAX_ENABLE_X64 on 3.11+
run: |
if python -c "import sys; sys.exit(0 if sys.version_info >= (3, 11) else 1)"; then
echo "JAX_ENABLE_X64=True" >> $GITHUB_ENV
fi
- name: Run smoke tests
run: |
cd ${{ matrix.workspace.path }}
if [ ! -f smoke_tests.txt ]; then
echo "No smoke_tests.txt found in ${{ matrix.workspace.path }} -- skipping"
exit 0
fi
fail=0
while IFS= read -r script || [ -n "$script" ]; do
[ -z "$script" ] && continue
case "$script" in \#*) continue ;; esac
echo "::group::$script"
if python "scripts/$script"; then
echo "PASS: $script"
else
echo "FAIL: $script"
fail=$((fail + 1))
fi
echo "::endgroup::"
done < smoke_tests.txt
if [ "$fail" -gt 0 ]; then
echo "$fail smoke test(s) failed"
exit 1
fi
summary:
runs-on: ubuntu-latest
needs: [unit_tests, smoke_tests]
if: always()
steps:
- name: Post summary
run: |
{
echo "## Python Version Matrix Results"
echo ""
echo "| Job | Result |"
echo "|--------------|---------------------------------|"
echo "| unit_tests | ${{ needs.unit_tests.result }} |"
echo "| smoke_tests | ${{ needs.smoke_tests.result }} |"
echo ""
echo "Per-cell pass/fail (Python version × project) is visible in"
echo "the matrix job logs above."
echo ""
echo "**Recommended:** 3.12, 3.13 (first-class)."
echo "**Supported with warning:** 3.9, 3.10, 3.11, 3.14."
echo "**JAX features:** 3.11+ only."
} >> "$GITHUB_STEP_SUMMARY"