Skip to content

Commit

Permalink
tox: fix tox integration with conda
Browse files Browse the repository at this point in the history
use setup-miniconda github action and specify more packages in conda_deps for each testenv
  • Loading branch information
duncanmmacleod committed Nov 18, 2024
1 parent 53b1757 commit 821ecc3
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 35 deletions.
44 changes: 37 additions & 7 deletions .github/workflows/mac-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,46 @@ jobs:
max-parallel: 4
matrix:
os: [macos-latest]
python-version: ['3.10', '3.11', '3.12']
python-version:
- '3.10'
- '3.11'
- '3.12'

# this is needed for conda environments to activate automatically
defaults:
run:
shell: bash -el {0}

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5

- name: Cache conda packages
uses: actions/cache@v4
env:
# increment to reset cache
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ matrix.python-version}}-${{ env.CACHE_NUMBER }}

- name: Configure conda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: test
channels: conda-forge
miniforge-version: latest
python-version: ${{ matrix.python-version }}
- run: |
brew install fftw openssl gsl
pip install --upgrade pip setuptools "tox<4.0.0"
- name: run basic pycbc test suite

- name: Conda info
run: conda info --all

- name: Install tox
run: |
conda install \
pip \
setuptools \
"tox<4.0.0"
- name: Run basic pycbc test suite
run: |
tox -e py-unittest
55 changes: 27 additions & 28 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ deps =
mkl;'arm' not in platform_machine

[testenv]
allowlist_externals = bash
allowlist_externals =
bash
conda
passenv=LAL_DATA_PATH
conda_deps=openssl
conda_channels=conda-forge
Expand All @@ -28,20 +30,19 @@ deps =
; Needed for `BBHx` package to work with PyCBC
git+https://github.com/titodalcanton/BBHx.git@py39-and-cleanup; sys_platform == 'linux'
git+https://github.com/gwastro/BBHX-waveform-model.git; sys_platform == 'linux'
conda_deps=
mysqlclient
lin: gcc_linux-64>=12.2.0
lin: gxx_linux-64>=12.2.0
; mac doesn't work, need fix
; mac: clang_osx-64
; mac: clangxx_osx-64
conda_deps =
c-compiler
cxx-compiler
gsl
lapack==3.6.1
conda_channels=conda-forge
setenv =
; Tell the linker to look for shared libs inside the temporary Conda env.
; Needed to build BBHx's wheel, whick links to LAPACK.
LIBRARY_PATH={envdir}/lib:{env:LIBRARY_PATH:}
ligo-segments
mysqlclient
python-ligo-lw
; for BBHx
liblapacke
openblas
conda_channels = conda-forge
commands_pre =
conda list
commands = pytest

# The following are long running or may require
Expand Down Expand Up @@ -73,21 +74,19 @@ deps =
; Needed for `BBHx` package to work with PyCBC
git+https://github.com/titodalcanton/BBHx.git@py39-and-cleanup; sys_platform == 'linux'
git+https://github.com/gwastro/BBHX-waveform-model.git; sys_platform == 'linux'
conda_deps=
conda_deps =
c-compiler
cxx-compiler
ligo-segments
mysqlclient
lin: gcc_linux-64>=12.2.0
lin: gxx_linux-64>=12.2.0
; mac doesn't work, need fix
; mac: clang_osx-64
; mac: clangxx_osx-64
binutils_linux-64>=2.39
gsl
lapack==3.6.1
openmpi
conda_channels=conda-forge
python-ligo-lw
mysqlclient
; for BBHx
liblapacke
openblas
conda_channels = conda-forge
setenv =
PYCBC_TEST_TYPE=docs
; Tell the linker to look for shared libs inside the temporary Conda env.
; Needed to build BBHx's wheel, whick links to LAPACK.
LIBRARY_PATH={envdir}/lib:{env:LIBRARY_PATH:}
commands_pre =
conda list
commands = bash tools/pycbc_test_suite.sh

0 comments on commit 821ecc3

Please sign in to comment.