|
| 1 | +name: Win |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +env: |
| 10 | + OPENBLAS_COMMIT: "c2f4bdb" |
| 11 | + OPENBLAS_ROOT: "c:\\opt" |
| 12 | + # Preserve working directory for calls into bash |
| 13 | + # Without this, invoking bash will cd to the home directory |
| 14 | + CHERE_INVOKING: "yes" |
| 15 | + BASH_PATH: "c:\\rtools40\\usr\\bin\\bash.exe" |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + plat: ['x64', 'x86'] |
| 22 | + INTERFACE64: ['1', '0'] |
| 23 | + os: [windows-latest] |
| 24 | + exclude: |
| 25 | + - plat: x86 |
| 26 | + INTERFACE64: '1' |
| 27 | + fail-fast: false |
| 28 | + runs-on: ${{ matrix.os }} |
| 29 | + |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v3 |
| 32 | + - name: install-rtools |
| 33 | + run: | |
| 34 | + # rtools 42+ does not support 32 bits builds. |
| 35 | + choco install -y rtools --noprogress --force --version=4.0.0.20220206 |
| 36 | +
|
| 37 | + - name: Set env variables |
| 38 | + run: | |
| 39 | + echo "START_DIR=$PWD" >> $env:GITHUB_ENV |
| 40 | + # For interpretation of MSYSTEM, see: |
| 41 | + # https://sourceforge.net/p/msys2/discussion/general/thread/b7dfdac8/#3939 |
| 42 | + if ( "${{ matrix.plat }}" -eq "x86") { |
| 43 | + echo "PLAT=i686" >> $env:GITHUB_ENV |
| 44 | + echo "WHEEL_PLAT=win32" >> $env:GITHUB_ENV |
| 45 | + echo "MSYSTEM=MINGW32" >> $env:GITHUB_ENV |
| 46 | + echo "LDFLAGS=-static -static-libgcc" >> $env:GITHUB_ENV |
| 47 | + echo "BUILD_BITS=32" >> $env:GITHUB_ENV |
| 48 | + } else { |
| 49 | + echo "PLAT=x86_64" >> $env:GITHUB_ENV |
| 50 | + echo "WHEEL_PLAT=win_amd64" >> $env:GITHUB_ENV |
| 51 | + echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV |
| 52 | + echo "LDFLAGS=-lucrt -static -static-libgcc" >> $env:GITHUB_ENV |
| 53 | + echo "BUILD_BITS=64" >> $env:GITHUB_ENV |
| 54 | + } |
| 55 | + if ( ${{ matrix.INTERFACE64 }} -eq "1" ) { |
| 56 | + echo "INTERFACE64=1" >> $env:GITHUB_ENV |
| 57 | + } |
| 58 | +
|
| 59 | + - name: Build |
| 60 | + run: | |
| 61 | + git submodule update --init --recursive |
| 62 | + & $env:BASH_PATH -lc tools/build_openblas.sh |
| 63 | +
|
| 64 | + - name: Test |
| 65 | + run: | |
| 66 | + & $env:BASH_PATH -lc tools/build_gfortran.sh |
| 67 | + echo "Static test" |
| 68 | + .\for_test\test.exe |
| 69 | + echo "Dynamic test" |
| 70 | + .\for_test\test_dyn.exe |
| 71 | +
|
| 72 | + - name: Copy |
| 73 | + run: | |
| 74 | + cp for_test\test*.exe builds |
| 75 | +
|
| 76 | + - name: Set up Python |
| 77 | + uses: actions/setup-python@v4 |
| 78 | + with: |
| 79 | + python-version: 3.7 |
| 80 | + architecture: ${{ matrix.plat }} |
| 81 | + |
| 82 | + |
| 83 | + - name: Build wheel |
| 84 | + shell: bash |
| 85 | + run: | |
| 86 | + set -xeo pipefail |
| 87 | + python -m pip install wheel |
| 88 | + # This will fail if there is more than one file in libs |
| 89 | + unzip -d local/scipy_openblas64 builds/openblas*.zip |
| 90 | + if [[ -d local/scipy_openblas64/64 ]]; then |
| 91 | + mv local/scipy_openblas64/64/* local/scipy_openblas64 |
| 92 | + else |
| 93 | + mv local/scipy_openblas64/32/* local/scipy_openblas64 |
| 94 | + fi |
| 95 | + mv local/scipy_openblas64/bin/*.dll local/scipy_openblas64/lib |
| 96 | + rm local/scipy_openblas64/lib/*.a |
| 97 | + rm local/scipy_openblas64/lib/*.exp |
| 98 | + rm local/scipy_openblas64/lib/*.def |
| 99 | + if [[ -d local/scipy_openblas64/64 ]]; then |
| 100 | + rm -rf local/scipy_openblas64/64 |
| 101 | + else |
| 102 | + rm -rf local/scipy_openblas64/32 |
| 103 | + fi |
| 104 | + if [[ "${INTERFACE64}" != "1" ]]; then |
| 105 | + mv local/scipy_openblas64 local/scipy_openblas32 |
| 106 | + # rewrite the name of the project to scipy_openblas32 |
| 107 | + # this is a hack, but apparently there is no other way to change the name |
| 108 | + # of a pyproject.toml project |
| 109 | + sed -e "s/openblas64/openblas32/" -i pyproject.toml |
| 110 | + sed -e "s/openblas_get_config64_/openblas_get_config/" -i local/scipy_openblas32/__init__.py |
| 111 | + sed -e "s/openblas64/openblas32/" -i local/scipy_openblas32/__main__.py |
| 112 | + fi |
| 113 | +
|
| 114 | + python -m pip wheel -w dist -vv . |
| 115 | + # move the mis-named scipy_openblas64-none-any.whl to a platform-specific name |
| 116 | + for f in dist/*.whl; do mv $f "${f/%any.whl/$WHEEL_PLAT.whl}"; done |
| 117 | +
|
| 118 | + - name: Set up different Python |
| 119 | + uses: actions/setup-python@v4 |
| 120 | + with: |
| 121 | + python-version: 3.11 |
| 122 | + architecture: ${{ matrix.plat }} |
| 123 | + |
| 124 | + - uses: actions/upload-artifact@v3 |
| 125 | + with: |
| 126 | + name: openblas |
| 127 | + path: builds/openblas*.zip |
| 128 | + |
| 129 | + - uses: actions/upload-artifact@v3 |
| 130 | + with: |
| 131 | + name: wheels |
| 132 | + path: dist/scipy_openblas*.whl |
| 133 | + |
| 134 | + - name: Test 64-bit interface wheel |
| 135 | + if: matrix.INTERFACE64 == '1' |
| 136 | + shell: bash |
| 137 | + run: | |
| 138 | + python -m pip install --no-index --find-links dist scipy_openblas64 |
| 139 | + python -m scipy_openblas64 |
| 140 | +
|
| 141 | + - name: Test 32-bit interface wheel |
| 142 | + if: matrix.INTERFACE64 != '1' |
| 143 | + shell: bash |
| 144 | + run: | |
| 145 | + python -m pip install --no-index --find-links dist scipy_openblas32 |
| 146 | + python -m scipy_openblas32 |
| 147 | +
|
| 148 | + - uses: conda-incubator/setup-miniconda@v2 |
| 149 | + with: |
| 150 | + activate-environment: upload |
| 151 | + |
| 152 | + - name: Upload |
| 153 | + env: |
| 154 | + ANACONDA_SCIENTIFIC_PYTHON_UPLOAD: ${{ secrets.ANACONDA_SCIENTIFIC_PYTHON_UPLOAD }} |
| 155 | + run: | |
| 156 | + # Pin urllib3<2 due to github.com/Anaconda-Platform/anaconda-client/issues/654 |
| 157 | + conda install "urllib3<2" anaconda-client |
| 158 | + & $env:BASH_PATH -lc tools/upload_to_anaconda_staging.sh |
0 commit comments