Skip to content

Commit 76ea04a

Browse files
committed
Simplify test setup
1 parent a4d801c commit 76ea04a

File tree

1 file changed

+51
-30
lines changed

1 file changed

+51
-30
lines changed

.github/workflows/tests.yml

Lines changed: 51 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
name: Python
1616
runs-on: ${{ matrix.os }}
1717
strategy:
18+
fail-fast: false
1819
matrix:
1920
python: [ "3.10", 3.13 ]
2021
os: [ macos-latest, ubuntu-24.04, windows-latest ]
@@ -32,14 +33,10 @@ jobs:
3233
with:
3334
submodules: true
3435

35-
- name: Install Conda (needed for GSL)
36-
uses: conda-incubator/setup-miniconda@v3.1.1
36+
- name: Set up Python 3.10
37+
uses: actions/setup-python@v5.4.0
3738
with:
38-
activate-environment: anaconda-client-env
39-
python-version: ${{ matrix.python }}
40-
channels: conda-forge, anaconda
41-
channel-priority: strict
42-
auto-update-conda: true
39+
python-version: "${{ matrix.python }}"
4340

4441
- name: Fix windows symlinks
4542
# This is horrible, but the "git config core.symlinks true" didn't work.
@@ -48,36 +45,60 @@ jobs:
4845
rm lwt_interface
4946
cp -r --dereference git-submodules/tskit/python/lwt_interface ./lwt_interface
5047
51-
- name: Fix windows .profile
52-
if: steps.cache.outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
48+
- name: Install GSL (macOS)
49+
if: matrix.os == 'macos-latest'
50+
run: brew install gsl
51+
52+
- name: Install GSL (Windows)
53+
if: matrix.os == 'windows-latest'
5354
run: |
54-
cp ~/.bash_profile ~/.profile
55-
56-
- name: Install GSL
57-
if: steps.cache.outputs.cache-hit != 'true'
58-
shell: bash -l {0} #We need a login shell to get conda
59-
run: conda install gsl
55+
vcpkg install gsl:x64-windows
56+
# Add GSL DLL directory to PATH for runtime
57+
$vcpkgRoot = $env:VCPKG_INSTALLATION_ROOT
58+
if (-not $vcpkgRoot) { $vcpkgRoot = "C:\vcpkg" }
59+
$gslBinPath = Join-Path $vcpkgRoot "installed\x64-windows\bin"
60+
echo "$gslBinPath" >> $env:GITHUB_PATH
61+
Write-Output "Added to PATH: $gslBinPath"
62+
shell: powershell
6063

61-
- name: Install uv
62-
uses: astral-sh/setup-uv@v6
63-
with:
64-
version: "0.8.15"
64+
- name: Install GSL (Ubuntu)
65+
if: matrix.os == 'ubuntu-24.04'
66+
run: sudo apt-get update && sudo apt-get install -y libgsl-dev
6567

6668
- name: Install pip deps
67-
shell: bash -l {0}
6869
run: |
69-
uv pip install -r pyproject.toml --extra test
70+
pip install uv
71+
uv pip install --system -r pyproject.toml --extra test
7072
71-
- name: Build module
72-
env:
73-
MSP_CONDA_PREFIX: c:\Miniconda\envs\anaconda-client-env
73+
- name: Build module and run tests
74+
if: matrix.os != 'windows-latest'
7475
run: |
75-
source ~/.profile
76-
conda activate anaconda-client-env
7776
python setup.py build_ext --inplace
77+
pytest -xvs -n0
7878
79-
- name: Run tests
79+
- name: Build wheel and run tests
80+
if: matrix.os == 'windows-latest'
81+
shell: powershell
8082
run: |
81-
source ~/.profile
82-
conda activate anaconda-client-env
83-
pytest -xvs -n0
83+
uv pip install --system build delvewheel
84+
python -m build --wheel
85+
$vcpkgRoot = $env:VCPKG_INSTALLATION_ROOT
86+
if (-not $vcpkgRoot) { $vcpkgRoot = 'C:\vcpkg' }
87+
$gslBinPath = Join-Path $vcpkgRoot 'installed\x64-windows\bin'
88+
# Ensure GSL bin is on PATH for this session
89+
$env:PATH = "$gslBinPath;$env:PATH"
90+
# Repair wheel(s) to bundle DLLs
91+
$whls = Get-ChildItem -Path dist -Filter '*.whl'
92+
if ($whls) {
93+
foreach ($w in $whls) {
94+
delvewheel repair $w.FullName -w dist --add-path $gslBinPath
95+
}
96+
} else {
97+
Write-Error 'No wheel files found in dist/'
98+
exit 1
99+
}
100+
# Remove source package directory to ensure pip installs wheel
101+
if (Test-Path msprime) { Remove-Item -Recurse -Force msprime }
102+
# Install repaired wheel(s)
103+
Get-ChildItem -Path dist -Filter '*.whl' | ForEach-Object { pip install $_.FullName }
104+
pytest -xvs -n0

0 commit comments

Comments
 (0)