Skip to content

Commit

Permalink
Merge pull request #670 from rgommers/use-msvc-action
Browse files Browse the repository at this point in the history
CI: use a GitHub Action to set up MSVC for wheel builds
  • Loading branch information
rgommers committed Apr 20, 2023
2 parents 5abcc10 + 75db353 commit 7c27f12
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 49 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
pip install numpy
if [ "${USE_SCIPY}" == "1" ]; then pip install scipy; fi
fi
pip install matplotlib pytest pytest-cov coverage codecov
pip install matplotlib pytest
set -o pipefail
if [ "${USE_WHEEL}" == "1" ]; then
Expand All @@ -108,7 +108,7 @@ jobs:
pip install sphinx numpydoc
pip install . -v
else
CFLAGS="--coverage" pip install . -v
pip install . -v
fi
- name: Run tests
Expand All @@ -130,8 +130,7 @@ jobs:
elif [ "${REFGUIDE_CHECK}" == "1" ]; then
python util/refguide_check.py --doctests
else
pytest --pyargs pywt --cov=pywt --cov-config=../.coveragerc
cp .coverage ..
pytest --pyargs pywt
fi
popd
Expand Down Expand Up @@ -202,7 +201,7 @@ jobs:
pip install cython numpy
if [ "${USE_SCIPY}" == "1" ]; then pip install scipy; fi
fi
pip install matplotlib pytest pytest-cov coverage codecov
pip install matplotlib pytest
set -o pipefail
if [ "${USE_WHEEL}" == "1" ]; then
Expand Down
49 changes: 12 additions & 37 deletions .github/workflows/wheel_tests_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,46 +155,20 @@ jobs:
run: |
python -m pip install cibuildwheel
- name: Build x86-64 (64-bit) Windows wheels for CPython
if: matrix.cibw_arch == 'AMD64'
# From https://github.com/actions/virtual-environments/issues/294#issuecomment-588090582,
# with additional -arch=amd64 flag to vsdevcmd.bat. Fix synced from scikit-image.
run: |
function Invoke-VSDevEnvironment {
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$installationPath = & $vswhere -prerelease -legacy -latest -property installationPath
$Command = Join-Path $installationPath "Common7\Tools\vsdevcmd.bat"
& "${env:COMSPEC}" /s /c "`"$Command`" -arch=amd64 -no_logo && set" | Foreach-Object {
if ($_ -match '^([^=]+)=(.*)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
}
}
}
Invoke-VSDevEnvironment
Get-Command rc.exe | Format-Table -AutoSize
- name: Setup MSVC (32-bit)
if: matrix.cibw_arch == 'x86'
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
with:
architecture: x86

python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_arch }}
- name: Setup MSVC (64-bit)
if: matrix.cibw_arch == 'AMD64'
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
with:
architecture: x64

- name: Build x86 (32-bit) Windows wheels for CPython
if: matrix.cibw_arch == 'x86'
# Same as above, but without `-arch=amd64` target arch selection argument
- name: Build Windows wheels for CPython
run: |
function Invoke-VSDevEnvironment {
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$installationPath = & $vswhere -prerelease -legacy -latest -property installationPath
$Command = Join-Path $installationPath "Common7\Tools\vsdevcmd.bat"
& "${env:COMSPEC}" /s /c "`"$Command`" -no_logo && set" | Foreach-Object {
if ($_ -match '^([^=]+)=(.*)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
}
}
}
Invoke-VSDevEnvironment
Get-Command rc.exe | Format-Table -AutoSize
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: ${{ matrix.cibw_python }}
Expand All @@ -214,6 +188,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v4
name: Install Python
with:
Expand Down
6 changes: 0 additions & 6 deletions codecov.yml

This file was deleted.

1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ envlist = py37, py38
deps =
flake8
pytest
coverage
cython
numpy
matplotlib
Expand Down

0 comments on commit 7c27f12

Please sign in to comment.