add entrypoint.txt for pyconf-pypi, cleanup #517
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Win | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: | |
| - main | |
| - maintenance/** | |
| workflow_dispatch: null | |
| env: | |
| # Preserve working directory for calls into bash | |
| # Without this, invoking bash will cd to the home directory | |
| CHERE_INVOKING: "yes" | |
| BASH_PATH: "c:\\rtools40\\usr\\bin\\bash.exe" | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - { os: windows-latest, PLAT: x86, INTERFACE64: '0'} | |
| - { os: windows-latest, PLAT: x64, INTERFACE64: '0'} | |
| - { os: windows-latest, PLAT: x64, INTERFACE64: '1'} | |
| - { os: windows-11-arm, PLAT: arm64, INTERFACE64: '0'} | |
| - { os: windows-11-arm, PLAT: arm64, INTERFACE64: '1'} | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 90 | |
| steps: | |
| - uses: actions/checkout@v4.1.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| architecture: ${{ matrix.plat }} | |
| - name: install LLVM (x86_64) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| if ( "${{ matrix.plat }}" -eq "x86") { | |
| Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.0/LLVM-21.1.0-win64.exe -UseBasicParsing -OutFile LLVM-win64.exe | |
| Start-Process -FilePath ".\LLVM-win64.exe" -ArgumentList "/S" -Wait | |
| } else { | |
| Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.0/LLVM-21.1.0-win32.exe -UseBasicParsing -OutFile LLVM-win32.exe | |
| Start-Process -FilePath ".\LLVM-win32.exe" -ArgumentList "/S" -Wait | |
| } | |
| - name: Download and install LLVM (arm64) | |
| if: matrix.os == 'windows-11-arm' | |
| shell: pwsh | |
| run: | | |
| Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.0/LLVM-21.1.0-woa64.exe -UseBasicParsing -OutFile LLVM-woa64.exe | |
| Start-Process -FilePath ".\LLVM-woa64.exe" -ArgumentList "/S" -Wait | |
| - name: Install CMake, ninja | |
| run: | | |
| python -m pip install cmake ninja | |
| - name: Set env variables | |
| run: | | |
| echo "START_DIR=$PWD" >> $env:GITHUB_ENV | |
| # For interpretation of MSYSTEM, see: | |
| # https://sourceforge.net/p/msys2/discussion/general/thread/b7dfdac8/#3939 | |
| if ( "${{ matrix.plat }}" -eq "x86") { | |
| echo "PLAT=i686" >> $env:GITHUB_ENV | |
| echo "WHEEL_PLAT=win32" >> $env:GITHUB_ENV | |
| echo "MSYSTEM=MINGW32" >> $env:GITHUB_ENV | |
| # No ucrt on 32-bits, so use _snprintf_c instead | |
| echo "LDFLAGS=-static -static-libgcc -Wl,--defsym,_quadmath_snprintf=__snprintf_c" >> $env:GITHUB_ENV | |
| echo "BUILD_BITS=32" >> $env:GITHUB_ENV | |
| } else { | |
| echo "PLAT=x86_64" >> $env:GITHUB_ENV | |
| echo "WHEEL_PLAT=win_amd64" >> $env:GITHUB_ENV | |
| echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV | |
| echo "LDFLAGS=-lucrt -static -static-libgcc -Wl,--defsym,quadmath_snprintf=snprintf" >> $env:GITHUB_ENV | |
| echo "BUILD_BITS=64" >> $env:GITHUB_ENV | |
| } | |
| if ( "${{ matrix.plat }}" -eq "arm64") { | |
| echo "PLAT=arm64" >> $env:GITHUB_ENV | |
| } | |
| if ( ${{ matrix.INTERFACE64 }} -eq "1" ) { | |
| echo "INTERFACE64=1" >> $env:GITHUB_ENV | |
| } | |
| $CIBW = "${{ github.workspace }}/.openblas" | |
| $CIBW = $CIBW.replace("\","/") | |
| echo "CIBW_ENVIRONMENT_WINDOWS=PKG_CONFIG_PATH=$CIBW" >> $env:GITHUB_ENV | |
| - name: Debug | |
| run: | | |
| echo CIBW_ENVIRONMENT_WINDOWS=$env:CIBW_ENVIRONMENT_WINDOWS | |
| - name: Build | |
| shell: cmd | |
| run: | | |
| rem Use a generic MSVC, we only need the MT tool | |
| if ( "${{ matrix.plat }}" -eq "arm64") { | |
| CALL "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsarm64.bat" | |
| } else { | |
| CALL "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
| } | |
| set GITHUB_PATH="C:\Program Files\LLVM\bin;%GITHUB_PATH%" | |
| set PATH="C:\Program Files\LLVM\bin;%PATH%" | |
| git submodule update --init --recursive | |
| bash -lc tools/build_steps_windows.sh | |
| - name: Test | |
| shell: bash | |
| run: | | |
| bash -lc tools/build_gfortran.sh | |
| echo "Static test" | |
| ./for_test/test.exe | |
| echo "Dynamic test" | |
| ./for_test/test_dyn.exe | |
| - name: Copy | |
| run: | | |
| cp for_test\test*.exe builds | |
| - name: Build wheel | |
| shell: bash | |
| run: | | |
| set -xeo pipefail | |
| python -m pip install wheel | |
| # This will fail if there is more than one file in libs | |
| unzip -d local/scipy_openblas64 builds/openblas*.zip | |
| if [[ -d local/scipy_openblas64/64 ]]; then | |
| mv local/scipy_openblas64/64/* local/scipy_openblas64 | |
| else | |
| mv local/scipy_openblas64/32/* local/scipy_openblas64 | |
| fi | |
| mv local/scipy_openblas64/bin/*.dll local/scipy_openblas64/lib | |
| rm local/scipy_openblas64/lib/*.a | |
| rm -f local/scipy_openblas64/lib/*.exp # may not exist? | |
| rm local/scipy_openblas64/lib/*.def | |
| rm -rf local/scipy_openblas64/lib/pkgconfig | |
| if [[ -d local/scipy_openblas64/64 ]]; then | |
| rm -rf local/scipy_openblas64/64 | |
| else | |
| rm -rf local/scipy_openblas64/32 | |
| fi | |
| sed -e "s/bin/lib/" -i local/scipy_openblas64/lib/cmake/openblas/OpenBLASConfig.cmake | |
| sed -e "s/dll/lib/" -i local/scipy_openblas64/lib/cmake/openblas/OpenBLASConfig.cmake | |
| mkdir local/scipy_openblas64/lib/pkgconfig | |
| if [[ "${INTERFACE64}" != "1" ]]; then | |
| mv local/scipy_openblas64 local/scipy_openblas32 | |
| # rewrite the name of the project to scipy-openblas32 | |
| # this is a hack, but apparently there is no other way to change the name | |
| # of a pyproject.toml project | |
| sed -e "s/openblas64/openblas32/" -i pyproject.toml | |
| sed -e "s/openblas_get_config64_/openblas_get_config/" -i local/scipy_openblas32/__init__.py | |
| sed -e "s/cflags =.*/cflags = '-DBLAS_SYMBOL_PREFIX=scipy_'/" -i local/scipy_openblas32/__init__.py | |
| sed -e "s/openblas64/openblas32/" -i local/scipy_openblas32/__init__.py | |
| sed -e "s/openblas64/openblas32/" -i local/scipy_openblas32/__main__.py | |
| PYTHONPATH=$PWD/local python -c "import scipy_openblas32 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas32/lib/pkgconfig/scipy-openblas.pc | |
| else | |
| PYTHONPATH=$PWD/local python -c "import scipy_openblas64 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas64/lib/pkgconfig/scipy-openblas.pc | |
| fi | |
| echo "" >> LICENSE.txt | |
| echo "----" >> LICENSE.txt | |
| echo "" >> LICENSE.txt | |
| cat tools/LICENSE_win32.txt >> LICENSE.txt | |
| python -m pip wheel -w dist -vv . | |
| # move the mis-named scipy_openblas64-none-any.whl to a platform-specific name | |
| if [[ -e dist/*any*.whl ]]; then | |
| for f in dist/*.whl; do mv $f "${f/%any.whl/$WHEEL_PLAT.whl}"; done | |
| fi | |
| - name: Set up different Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.13 | |
| architecture: ${{ matrix.plat }} | |
| - uses: actions/upload-artifact@v4.3.0 | |
| with: | |
| name: wheels-${{matrix.plat }}-${{ matrix.INTERFACE64 }} | |
| path: dist/scipy_openblas*.whl | |
| - name: Test 64-bit interface wheel | |
| if: matrix.INTERFACE64 == '1' | |
| run: | | |
| python -m pip install --no-index --find-links dist scipy_openblas64 | |
| python -m scipy_openblas64 | |
| python -c "import scipy_openblas64; print(scipy_openblas64.get_pkg_config())" | |
| python -m pip install pkgconf | |
| python -m pkgconf scipy-openblas --cflags | |
| - name: Test 32-bit interface wheel | |
| if: matrix.INTERFACE64 != '1' | |
| run: | | |
| python -m pip install --no-index --find-links dist scipy_openblas32 | |
| python -m scipy_openblas32 | |
| python -c "import scipy_openblas32; print(scipy_openblas32.get_pkg_config())" | |
| python -m pip install pkgconf | |
| python -m pkgconf scipy-openblas --cflags | |
| - uses: conda-incubator/setup-miniconda@v3.1.1 | |
| with: | |
| channels: conda-forge | |
| channel-priority: true | |
| activate-environment: upload | |
| miniforge-version: latest | |
| - name: Upload | |
| # see https://github.com/marketplace/actions/setup-miniconda for why | |
| # `-el {0}` is required. | |
| shell: bash -el {0} | |
| env: | |
| ANACONDA_SCIENTIFIC_PYTHON_UPLOAD: ${{ secrets.ANACONDA_SCIENTIFIC_PYTHON_UPLOAD }} | |
| run: | | |
| conda install -y anaconda-client | |
| source tools/upload_to_anaconda_staging.sh | |
| upload_wheels |