From b45ba565b8e4e4437934429dbf6f814b4942206e Mon Sep 17 00:00:00 2001 From: Jacob Wilkins Date: Mon, 25 Nov 2024 19:17:10 +0000 Subject: [PATCH 1/6] use tox 4 for release testing --- .github/workflows/test_release.yml | 13 +++--- build_utils/release_tox.ini | 67 +++++++++++++----------------- 2 files changed, 36 insertions(+), 44 deletions(-) diff --git a/.github/workflows/test_release.yml b/.github/workflows/test_release.yml index b66179bf9..ee61504eb 100644 --- a/.github/workflows/test_release.yml +++ b/.github/workflows/test_release.yml @@ -15,12 +15,15 @@ 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: diff --git a/build_utils/release_tox.ini b/build_utils/release_tox.ini index 5c8a300a7..75bed3895 100644 --- a/build_utils/release_tox.ini +++ b/build_utils/release_tox.ini @@ -1,41 +1,41 @@ [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 {toxinidir}/../tests_and_analysis/test/run_tests.py --report requirements_dir = {toxinidir}/../tests_and_analysis +passenv = + EUPHONIC_VERSION + CC_LD +extras = + test + matplotlib + phonopy-reader + brille # Test PyPI source distribution [testenv:pypisource-{py310,py312}] passenv = CC CC_LD LDFLAGS CPPFLAGS install_command = python -m pip install {opts} {packages} -deps = - numpy - spglib # Not interested here in whether source builds of spglib work - -r{[testenv]requirements_dir}/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{[testenv]requirements_dir}/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} @@ -45,28 +45,12 @@ platform = linux: linux windows: win32 deps = - numpy==1.24.0 + numpy==1.21.3 +extras = + test commands_pre = python -m pip install --force-reinstall \ - -r{[testenv]requirements_dir}/minimum_euphonic_requirements.txt - python -m pip install --force-reinstall \ - -r{[testenv]requirements_dir}/tox_requirements.txt - python -m pip install \ - 'euphonic[matplotlib,phonopy_reader,brille]=={env:EUPHONIC_VERSION}' \ - --only-binary 'euphonic' -commands = {[testenv]test_command} - -[testenv:pypi-py310-min-mac] -install_command = python -m pip install --force-reinstall {opts} {packages} -platform = - mac: darwin -deps = - numpy==1.24.0 -commands_pre = - python -m pip install --force-reinstall \ - -r{[testenv]requirements_dir}/minimum_euphonic_requirements_mac.txt - python -m pip install --force-reinstall \ - -r{[testenv]requirements_dir}/tox_requirements.txt + -r{toxinidir}/tests_and_analysis/minimum_euphonic_requirements.txt python -m pip install \ 'euphonic[matplotlib,phonopy_reader,brille]=={env:EUPHONIC_VERSION}' \ --only-binary 'euphonic' @@ -78,10 +62,13 @@ install_command = conda install {packages} conda_channels = conda-forge default -conda_deps = - --file={[testenv]requirements_dir}/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" @@ -93,10 +80,12 @@ install_command = conda install {packages} conda_channels = conda-forge default -conda_deps = - --file={[testenv]requirements_dir}/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" From b1a679e13714907450e9c86eff9fffee5fefd075 Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Mon, 16 Dec 2024 10:35:15 +0000 Subject: [PATCH 2/6] Tox: extras don't work with skip_install, pass directly --- build_utils/release_tox.ini | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/build_utils/release_tox.ini b/build_utils/release_tox.ini index 75bed3895..89c59908b 100644 --- a/build_utils/release_tox.ini +++ b/build_utils/release_tox.ini @@ -12,47 +12,38 @@ requirements_dir = {toxinidir}/../tests_and_analysis passenv = EUPHONIC_VERSION CC_LD -extras = - test - matplotlib - phonopy-reader - brille +setenv = + EXTRAS=[test,matplotlib,phonopy-reader,brille] # Test PyPI source distribution [testenv:pypisource-{py310,py312}] passenv = CC CC_LD LDFLAGS CPPFLAGS -install_command = python -m pip install {opts} {packages} commands_pre = python -m pip install \ --force-reinstall \ - 'euphonic=={env:EUPHONIC_VERSION}' \ + 'euphonic{env:EXTRAS}=={env:EUPHONIC_VERSION}' \ --no-binary 'euphonic' commands = {[testenv]test_command} - [testenv:pypi-{py310,py311,py312}] -install_command = python -m pip install {opts} {packages} commands_pre = python -m pip install \ --force-reinstall \ - 'euphonic=={env:EUPHONIC_VERSION}' \ + 'euphonic{env:EXTRAS}=={env:EUPHONIC_VERSION}' \ --only-binary 'euphonic' commands = {[testenv]test_command} [testenv:pypi-py310-min-win-linux] -install_command = python -m pip install --force-reinstall {opts} {packages} platform = linux: linux windows: win32 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 \ - 'euphonic[matplotlib,phonopy_reader,brille]=={env:EUPHONIC_VERSION}' \ + 'euphonic{env:EXTRAS}=={env:EUPHONIC_VERSION}' \ --only-binary 'euphonic' commands = {[testenv]test_command} From 7972499b7e2065edcb2c90fef2c3dd43e117c8bd Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Mon, 16 Dec 2024 10:58:08 +0000 Subject: [PATCH 3/6] Update tox passenv syntax --- build_utils/release_tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_utils/release_tox.ini b/build_utils/release_tox.ini index 89c59908b..c8a4d93aa 100644 --- a/build_utils/release_tox.ini +++ b/build_utils/release_tox.ini @@ -17,7 +17,7 @@ setenv = # Test PyPI source distribution [testenv:pypisource-{py310,py312}] -passenv = CC CC_LD LDFLAGS CPPFLAGS +passenv = CC, CC_LD, LDFLAGS, CPPFLAGS commands_pre = python -m pip install \ --force-reinstall \ From f69eaa3089c1c366d4c3d80bf38b820adc8dd5a8 Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Mon, 16 Dec 2024 11:40:49 +0000 Subject: [PATCH 4/6] Enable min-requirements run, bump numpy version to match project --- build_utils/release_tox.ini | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/build_utils/release_tox.ini b/build_utils/release_tox.ini index c8a4d93aa..5d4844e7f 100644 --- a/build_utils/release_tox.ini +++ b/build_utils/release_tox.ini @@ -33,15 +33,13 @@ commands_pre = --only-binary 'euphonic' commands = {[testenv]test_command} -[testenv:pypi-py310-min-win-linux] -platform = - linux: linux - windows: win32 +[testenv:pypi-py310-min] +platform = (linux)|(win32) deps = - numpy==1.21.3 + numpy==1.24 commands_pre = python -m pip install --force-reinstall \ - -r{toxinidir}/tests_and_analysis/minimum_euphonic_requirements.txt + -r{toxinidir}/../tests_and_analysis/minimum_euphonic_requirements.txt python -m pip install \ 'euphonic{env:EXTRAS}=={env:EUPHONIC_VERSION}' \ --only-binary 'euphonic' @@ -71,7 +69,7 @@ install_command = conda install {packages} conda_channels = conda-forge default -deps = numpy==1.22 +deps = numpy==1.24 extras = test matplotlib From aee0fa40a6bc2d3dcf833ac1ae88b7cbf8399538 Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Mon, 16 Dec 2024 12:51:38 +0000 Subject: [PATCH 5/6] Add tox requirements to pypi min-requirements release test --- build_utils/release_tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/build_utils/release_tox.ini b/build_utils/release_tox.ini index 5d4844e7f..2c1ee0074 100644 --- a/build_utils/release_tox.ini +++ b/build_utils/release_tox.ini @@ -37,6 +37,7 @@ commands = {[testenv]test_command} platform = (linux)|(win32) deps = numpy==1.24 + -r{toxinidir}/../tests_and_analysis/tox_requirements.txt commands_pre = python -m pip install --force-reinstall \ -r{toxinidir}/../tests_and_analysis/minimum_euphonic_requirements.txt From 7d12f65a7ed543208f7fa1e817547d6dd1e10a81 Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Mon, 16 Dec 2024 15:21:16 +0000 Subject: [PATCH 6/6] Cleanup environment variables --- build_utils/release_tox.ini | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/build_utils/release_tox.ini b/build_utils/release_tox.ini index 2c1ee0074..0ed260e2b 100644 --- a/build_utils/release_tox.ini +++ b/build_utils/release_tox.ini @@ -11,17 +11,21 @@ test_command = python {toxinidir}/../tests_and_analysis/test/run_tests.py --repo requirements_dir = {toxinidir}/../tests_and_analysis passenv = EUPHONIC_VERSION - CC_LD -setenv = - EXTRAS=[test,matplotlib,phonopy-reader,brille] +# The name "extras" is reserved and has its own format with newlines: +# we need a token to inject into custom commands_pre, so call it extras_str +extras_str = [test,matplotlib,phonopy-reader,brille] # Test PyPI source distribution [testenv:pypisource-{py310,py312}] -passenv = CC, CC_LD, LDFLAGS, CPPFLAGS +passenv = + CC + CC_LD + LDFLAGS + CPPFLAGS commands_pre = python -m pip install \ --force-reinstall \ - 'euphonic{env:EXTRAS}=={env:EUPHONIC_VERSION}' \ + euphonic{[testenv]extras_str}=={env:EUPHONIC_VERSION} \ --no-binary 'euphonic' commands = {[testenv]test_command} @@ -29,7 +33,7 @@ commands = {[testenv]test_command} commands_pre = python -m pip install \ --force-reinstall \ - 'euphonic{env:EXTRAS}=={env:EUPHONIC_VERSION}' \ + euphonic{[testenv]extras_str}=={env:EUPHONIC_VERSION} \ --only-binary 'euphonic' commands = {[testenv]test_command} @@ -42,7 +46,7 @@ commands_pre = python -m pip install --force-reinstall \ -r{toxinidir}/../tests_and_analysis/minimum_euphonic_requirements.txt python -m pip install \ - 'euphonic{env:EXTRAS}=={env:EUPHONIC_VERSION}' \ + euphonic{[testenv]extras_str}=={env:EUPHONIC_VERSION} \ --only-binary 'euphonic' commands = {[testenv]test_command}