Skip to content

Commit

Permalink
use tox 4 for release testing
Browse files Browse the repository at this point in the history
  • Loading branch information
oerc0122 committed Nov 25, 2024
1 parent e40457a commit 037e060
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 25 deletions.
40 changes: 35 additions & 5 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,50 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.10'
channels: conda-forge,defaults
channel-priority: true
- name: Install llvm on Macos
fetch-depth: 0 # Ensure tags are fetched for versioning
- uses: actions/setup-python@v5
with:
python-version: |
3.10
3.11
3.12
- name: Install llvm on MacOS
if: startsWith(matrix.os, 'macos')
shell: bash -l {0}
env:
# Homebrew location is different on Intel Mac
LLVM_DIR: ${{ (matrix.os == 'macos-13') && '/usr/local/opt/llvm' || '/opt/homebrew/opt/llvm' }}
run: |
brew install llvm
echo CC="${LLVM_DIR}/bin/clang" >> $GITHUB_ENV
echo LDFLAGS="-L${LLVM_DIR}/lib $LDFLAGS" >> $GITHUB_ENV
echo CPPFLAGS="-I${LLVM_DIR}/include $CPPFLAGS" >> $GITHUB_ENV
- name: Windows - find MSVC and set environment variables
if: startsWith(matrix.os, 'windows')
shell: bash -l {0}
env:
MSVC_PREFIX: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC'
run: |
echo "Available MSVC installations:"
ls "$MSVC_PREFIX"
MSVC_BIN=$(ls "$MSVC_PREFIX" | tail -n 1)\\bin\\HostX64\\x64
CC="$MSVC_PREFIX\\$MSVC_BIN\\cl.exe"
echo "CC: $CC"
echo "CC=$CC" >> $GITHUB_ENV
CC_LD="$MSVC_PREFIX\\$MSVC_BIN\\link.exe"
echo "CC_LD: $CC_LD"
echo "CC_LD=$CC_LD" >> $GITHUB_ENV
- name: Update pip and install dependencies
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
python -m pip install -r tests_and_analysis/ci_requirements.txt
- name: Run tests
shell: bash -l {0}
env:
Expand Down
46 changes: 26 additions & 20 deletions build_utils/release_tox.ini
Original file line number Diff line number Diff line change
@@ -1,50 +1,51 @@
[tox]
# Use conda to set up the python environments to run in
requires = tox-conda
requires = tox>=4
# The python environments to run the tests in
envlist = pypi-py310-min,conda-py310-old-np,{pypi,conda}-{py310,py311,py312},pypisource-{py310,py312}
# Skip the execution of setup.py as we do it with the correct version in commands_pre below
skipsdist = True
skip_install = True

[testenv]
changedir = tests_and_analysis/test
test_command = python run_tests.py --report
passenv =
EUPHONIC_VERSION
CC_LD
extras =
test
matplotlib
phonopy-reader
brille

# Test PyPI source distribution
[testenv:pypisource-{py310,py312}]
install_command = python -m pip install {opts} {packages}
deps =
numpy
-r{toxinidir}/tests_and_analysis/tox_requirements.txt
commands_pre =
python -m pip install \
--force-reinstall \
'euphonic[matplotlib,phonopy_reader,brille]=={env:EUPHONIC_VERSION}' \
'euphonic=={env:EUPHONIC_VERSION}' \
--no-binary 'euphonic'
commands = {[testenv]test_command}


[testenv:pypi-{py310,py311,py312}]
install_command = python -m pip install {opts} {packages}
deps =
numpy
-r{toxinidir}/tests_and_analysis/tox_requirements.txt
commands_pre =
python -m pip install \
--force-reinstall \
'euphonic[matplotlib,phonopy_reader,brille]=={env:EUPHONIC_VERSION}' \
'euphonic=={env:EUPHONIC_VERSION}' \
--only-binary 'euphonic'
commands = {[testenv]test_command}

[testenv:pypi-py310-min]
install_command = python -m pip install --force-reinstall {opts} {packages}
deps =
numpy==1.21.3
extras =
test
commands_pre =
python -m pip install --force-reinstall \
-r{toxinidir}/tests_and_analysis/minimum_euphonic_requirements.txt
python -m pip install --force-reinstall \
-r{toxinidir}/tests_and_analysis/tox_requirements.txt
python -m pip install \
'euphonic[matplotlib,phonopy_reader,brille]=={env:EUPHONIC_VERSION}' \
--only-binary 'euphonic'
Expand All @@ -56,10 +57,13 @@ install_command = conda install {packages}
conda_channels =
conda-forge
default
conda_deps =
--file={toxinidir}/tests_and_analysis/tox_requirements.txt
extras =
test
matplotlib
phonopy-reader

commands_pre =
conda install -c conda-forge euphonic={env:EUPHONIC_VERSION} matplotlib-base pyyaml h5py
conda install -c conda-forge euphonic={env:EUPHONIC_VERSION}
# Brille not available on conda
commands = {[testenv]test_command} -m "not brille"

Expand All @@ -71,10 +75,12 @@ install_command = conda install {packages}
conda_channels =
conda-forge
default
conda_deps =
--file={toxinidir}/tests_and_analysis/tox_requirements.txt
deps = numpy==1.22
extras =
test
matplotlib
phonopy-reader
commands_pre =
conda install numpy=1.22
conda install -c conda-forge euphonic={env:EUPHONIC_VERSION} matplotlib-base pyyaml h5py
conda install -c conda-forge euphonic={env:EUPHONIC_VERSION}
# Brille not available on conda
commands = {[testenv]test_command} -m "not brille"

0 comments on commit 037e060

Please sign in to comment.