Skip to content

Create an openblas wheel #46

Create an openblas wheel

Create an openblas wheel #46

Workflow file for this run

name: Win
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
OPENBLAS_COMMIT: "c2f4bdb"
OPENBLAS_ROOT: "c:\\opt"
# 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:
plat: ['x64', 'x86']
INTERFACE64: ['1', '0']
os: [windows-latest]
exclude:
- plat: x86
INTERFACE64: '1'
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: install-rtools
run: |
# rtools 42+ does not support 32 bits builds.
choco install -y rtools --noprogress --force --version=4.0.0.20220206
- 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
echo "LDFLAGS=-static -static-libgcc" >> $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" >> $env:GITHUB_ENV
echo "BUILD_BITS=64" >> $env:GITHUB_ENV
}
if ( ${{ matrix.INTERFACE64 }} -eq "1" ) {
echo "INTERFACE64=1" >> $env:GITHUB_ENV
}
- name: Build
run: |
git submodule update --init --recursive
& $env:BASH_PATH -lc tools/build_openblas.sh
- name: Test
run: |
& $env:BASH_PATH -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: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
architecture: ${{ matrix.plat }}
- 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 local/scipy_openblas64/lib/*.exp
rm local/scipy_openblas64/lib/*.def
if [[ -d local/scipy_openblas64/64 ]]; then
rm -rf local/scipy_openblas64/64
else
rm -rf local/scipy_openblas64/32
fi
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/openblas64/openblas32/" -i local/scipy_openblas32/__main__.py
fi
python -m pip wheel -w dist -vv .
# move the mis-named scipy_openblas64-none-any.whl to a platform-specific name
for f in dist/*.whl; do mv $f "${f/%any.whl/$WHEEL_PLAT.whl}"; done
- name: Set up different Python
uses: actions/setup-python@v4
with:
python-version: 3.11
architecture: ${{ matrix.plat }}
- uses: actions/upload-artifact@v3
with:
name: openblas
path: builds/openblas*.zip
- uses: actions/upload-artifact@v3
with:
name: wheels
path: dist/scipy_openblas*.whl
- name: Test 64-bit interface wheel
if: matrix.INTERFACE64 == '1'
shell: bash
run: |
python -m pip install --no-index --find-links dist scipy_openblas64
python -m scipy_openblas64
- name: Test 32-bit interface wheel
if: matrix.INTERFACE64 != '1'
shell: bash
run: |
python -m pip install --no-index --find-links dist scipy_openblas32
python -m scipy_openblas32
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: upload
- name: Upload
env:
ANACONDA_SCIENTIFIC_PYTHON_UPLOAD: ${{ secrets.ANACONDA_SCIENTIFIC_PYTHON_UPLOAD }}
run: |
# Pin urllib3<2 due to github.com/Anaconda-Platform/anaconda-client/issues/654
conda install "urllib3<2" anaconda-client
& $env:BASH_PATH -lc tools/upload_to_anaconda_staging.sh