-
Notifications
You must be signed in to change notification settings - Fork 13
177 lines (158 loc) · 6.12 KB
/
windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Win
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch: null
env:
OPENBLAS_COMMIT: "d11e7340"
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 }}
timeout-minutes: 90
steps:
- uses: actions/checkout@v4.1.1
- name: install-rtools
run: |
# rtools 42+ does not support 32 bits builds.
choco install -y rtools --no-progress --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
}
$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
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@v5
with:
python-version: 3.9
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 -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
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
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
for f in dist/*.whl; do mv $f "${f/%any.whl/$WHEEL_PLAT.whl}"; done
- name: Set up different Python
uses: actions/setup-python@v5
with:
python-version: 3.11
architecture: ${{ matrix.plat }}
- uses: actions/upload-artifact@v4.3.0
with:
name: wheels-${{matrix.plat }}-${{ matrix.INTERFACE64 }}
path: dist/scipy_openblas*.whl
- uses: actions/upload-artifact@v4.3.0
with:
name: openblas-${{matrix.plat }}-${{ matrix.INTERFACE64 }}
path: builds/openblas*.zip
- 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())"
- 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())"
- uses: conda-incubator/setup-miniconda@v3.0.1
with:
activate-environment: upload
- 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: |
# Pin urllib3<2 due to github.com/Anaconda-Platform/anaconda-client/issues/654
conda install -y anaconda-client 'urllib3<2.0.0'
source tools/upload_to_anaconda_staging.sh
upload_wheels