Skip to content

Commit 12b7dbd

Browse files
committed
make more of CI work
1 parent 4397282 commit 12b7dbd

File tree

6 files changed

+158
-75
lines changed

6 files changed

+158
-75
lines changed

.github/workflows/posix.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: multibuild
1+
name: posix
22

33
on:
44
push:
@@ -71,10 +71,10 @@ jobs:
7171
with:
7272
submodules: recursive
7373
fetch-depth: 0
74-
- name: Set up Python 3.8
75-
uses: actions/setup-python@v2
74+
- name: Set up Python
75+
uses: actions/setup-python@v4
7676
with:
77-
python-version: 3.8
77+
python-version: 3.7
7878
- name: Set extra env
7979
run: |
8080
if [ "macos-11" == "${{ matrix.os }}" ]; then
@@ -93,7 +93,7 @@ jobs:
9393
echo "DOCKER_TEST_IMAGE: ${DOCKER_TEST_IMAGE}"
9494
- name: Install VirtualEnv
9595
run: |
96-
python -m pip install --upgrade pip
96+
python3 -m pip install --upgrade pip
9797
pip install virtualenv
9898
- name: Build OpenBLAS
9999
run: |
@@ -120,23 +120,22 @@ jobs:
120120
121121
- name: Build wheel
122122
run: |
123-
mkdir -p local/openblas
124-
tar -C local/openblas --strip-components=2 -xf libs/openblas*.tar.gz
125-
cp local/openblas/lib/libopenblas64_.so local/openblas/libopenblas_python.so
126-
# do not package the static libs and symlinks, they are ~55MB
127-
rm -rf local/openblas/lib/*
128-
mv local/openblas/libopenblas_python.so local/openblas/lib/
129123
130-
cat <<EOF > run_in_docker.sh
131-
cd /openblas
132-
patchelf --set-soname libopenblas_python.so local/openblas/lib/libopenblas_python.so
133-
python3.7 -m pip wheel -w /tmp/wheelhouse -vv .
134-
auditwheel repair -w dist/ /tmp/wheelhouse/openblas-*.whl
135-
python3.10 -m pip install dist/openblas-*.whl
136-
python3.10 -m openblas
137-
EOF
124+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
125+
source travis-ci/build_wheel.sh
126+
else
127+
docker run --rm -v $(pwd):/openblas quay.io/pypa/manylinux2014_x86_64 /bin/bash -xe /openblas/travis-ci/build_wheel.sh
128+
fi
138129
139-
docker run --rm -v $(pwd):/openblas quay.io/pypa/manylinux2014_x86_64 /bin/bash -xe /openblas/run_in_docker.sh
130+
- name: Setup different python to test wheel
131+
uses: actions/setup-python@v4
132+
with:
133+
python-version: 3.10
134+
135+
- name: Test wheel
136+
run: |
137+
python -m pip install --no-index --find-links dist openblas
138+
python -m openblas
140139
141140
- uses: actions/upload-artifact@v3
142141
with:

.github/workflows/windows.yml

Lines changed: 56 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -27,61 +27,66 @@ jobs:
2727
runs-on: ${{ matrix.os }}
2828

2929
steps:
30-
- uses: actions/checkout@v3
31-
- name: install-rtools
32-
run: |
33-
# rtools 42+ does not support 32 bits builds.
34-
choco install -y rtools --noprogress --force --version=4.0.0.20220206
30+
- uses: actions/checkout@v3
31+
- name: install-rtools
32+
run: |
33+
# rtools 42+ does not support 32 bits builds.
34+
choco install -y rtools --noprogress --force --version=4.0.0.20220206
3535
36-
- name: Set env variables
37-
run: |
38-
echo "START_DIR=$PWD" >> $env:GITHUB_ENV
39-
$BITS = ${{ matrix.BUILD_BITS }}
40-
echo "BUILD_BITS=$BITS" >> $env:GITHUB_ENV
41-
# For interpretation of MSYSTEM, see:
42-
# https://sourceforge.net/p/msys2/discussion/general/thread/b7dfdac8/#3939
43-
if ($BITS -eq 32) {
44-
echo "PLAT=i686" >> $env:GITHUB_ENV
45-
echo "MSYSTEM=MINGW32" >> $env:GITHUB_ENV
46-
echo "LDFLAGS=-static -static-libgcc" >> $env:GITHUB_ENV
47-
} else {
48-
echo "PLAT=x86_64" >> $env:GITHUB_ENV
49-
echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV
50-
echo "LDFLAGS=-lucrt -static -static-libgcc" >> $env:GITHUB_ENV
51-
}
52-
if ( ${{ matrix.INTERFACE64 }} -eq 1 ) {
53-
echo "INTERFACE64=1" >> $env:GITHUB_ENV
54-
}
36+
- name: Set env variables
37+
run: |
38+
echo "START_DIR=$PWD" >> $env:GITHUB_ENV
39+
$BITS = ${{ matrix.BUILD_BITS }}
40+
echo "BUILD_BITS=$BITS" >> $env:GITHUB_ENV
41+
# For interpretation of MSYSTEM, see:
42+
# https://sourceforge.net/p/msys2/discussion/general/thread/b7dfdac8/#3939
43+
if ($BITS -eq 32) {
44+
echo "PLAT=i686" >> $env:GITHUB_ENV
45+
echo "MSYSTEM=MINGW32" >> $env:GITHUB_ENV
46+
echo "LDFLAGS=-static -static-libgcc" >> $env:GITHUB_ENV
47+
} else {
48+
echo "PLAT=x86_64" >> $env:GITHUB_ENV
49+
echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV
50+
echo "LDFLAGS=-lucrt -static -static-libgcc" >> $env:GITHUB_ENV
51+
}
52+
if ( ${{ matrix.INTERFACE64 }} -eq 1 ) {
53+
echo "INTERFACE64=1" >> $env:GITHUB_ENV
54+
}
5555
56-
- name: Build
57-
run: |
58-
git submodule update --init --recursive
59-
& $env:BASH_PATH -lc tools/build_openblas.sh
56+
- name: Build
57+
run: |
58+
git submodule update --init --recursive
59+
& $env:BASH_PATH -lc tools/build_openblas.sh
6060
61-
- name: Test
62-
run: |
63-
& $env:BASH_PATH -lc tools/build_gfortran.sh
64-
echo "Static test"
65-
.\for_test\test.exe
66-
echo "Dynamic test"
67-
.\for_test\test_dyn.exe
61+
- name: Test
62+
run: |
63+
& $env:BASH_PATH -lc tools/build_gfortran.sh
64+
echo "Static test"
65+
.\for_test\test.exe
66+
echo "Dynamic test"
67+
.\for_test\test_dyn.exe
6868
69-
- name: Copy
70-
run: |
71-
cp for_test\test*.exe builds
69+
- name: Copy
70+
run: |
71+
cp for_test\test*.exe builds
7272
73-
- uses: actions/upload-artifact@v3
74-
with:
75-
path: builds/openblas*.zip
73+
- name: Set up Python 3.8
74+
uses: actions/setup-python@v4
75+
with:
76+
python-version: 3.8
7677

77-
- uses: conda-incubator/setup-miniconda@v2
78-
with:
79-
activate-environment: upload
78+
- uses: actions/upload-artifact@v3
79+
with:
80+
path: builds/openblas*.zip
8081

81-
- name: Upload
82-
env:
83-
ANACONDA_SCIENTIFIC_PYTHON_UPLOAD: ${{ secrets.ANACONDA_SCIENTIFIC_PYTHON_UPLOAD }}
84-
run: |
85-
# Pin urllib3<2 due to github.com/Anaconda-Platform/anaconda-client/issues/654
86-
conda install "urllib3<2" anaconda-client
87-
& $env:BASH_PATH -lc tools/upload_to_anaconda_staging.sh
82+
- uses: conda-incubator/setup-miniconda@v2
83+
with:
84+
activate-environment: upload
85+
86+
- name: Upload
87+
env:
88+
ANACONDA_SCIENTIFIC_PYTHON_UPLOAD: ${{ secrets.ANACONDA_SCIENTIFIC_PYTHON_UPLOAD }}
89+
run: |
90+
# Pin urllib3<2 due to github.com/Anaconda-Platform/anaconda-client/issues/654
91+
conda install "urllib3<2" anaconda-client
92+
& $env:BASH_PATH -lc tools/upload_to_anaconda_staging.sh

OpenBLAS

local/openblas/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ def get_pkg_config():
4141
return f"""\
4242
libdir={_HERE}/lib
4343
includedir={_HERE}/include
44-
openblas_config= USE_64BITINT= DYNAMIC_ARCH=1 DYNAMIC_OLDER= NO_CBLAS= NO_LAPACK= NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP= PRESCOTT MAX_THREADS=24
45-
version=0.3.23
44+
openblas_config= {openblas_config}
45+
version={openblas_config.split(" ")[1]}
4646
extralib=-lm -lpthread -lgfortran -lm -lpthread -lgfortran
4747
Name: openblas
4848
Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version
49-
Version: ${version}
49+
Version: ${{version}}
5050
URL: https://github.com/xianyi/OpenBLAS
5151
Libs: -L${libdir} -lopenblas
5252
Libs.private: ${extralib}

tools/local_build.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Replicate the workflow from posix.yml locally on posix
2+
# This may bitrot, compare it to the original file before using
3+
4+
5+
# Set extra env
6+
if [ "uname -m" == "x86_64" ]; then
7+
export TRAVIS_OS_NAME=ubuntu-latest
8+
export PLAT=x86_64
9+
# export PLAT=i86
10+
DOCKER_TEST_IMAGE=multibuild/xenial_${PLAT}
11+
else
12+
export TRAVIS_OS_NAME=osx
13+
export LDFLAGS="-L/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/lib"
14+
export LIBRARY_PATH="-L/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/lib"
15+
export PLAT=x86_64
16+
# export PLAT=arm64
17+
export SUFFIX=gf_c469a42
18+
19+
fi
20+
export REPO_DIR=OpenBLAS
21+
export OPENBLAS_COMMIT="c2f4bdb"
22+
23+
# export MB_ML_LIBC=musllinux
24+
# export MB_ML_VER=_1_1
25+
# export MB_ML_VER=2014
26+
export INTERFACE64=1
27+
28+
function install_virtualenv {
29+
# Install VirtualEnv
30+
python3 -m pip install --upgrade pip
31+
pip install virtualenv
32+
}
33+
34+
function build_openblas {
35+
# Build OpenBLAS
36+
set -xeo pipefail
37+
if [ "$PLAT" == "arm64" ]; then
38+
sudo xcode-select -switch /Applications/Xcode_12.5.1.app
39+
export SDKROOT=/Applications/Xcode_12.5.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk
40+
clang --version
41+
fi
42+
source travis-ci/build_steps.sh
43+
echo "------ BEFORE BUILD ---------"
44+
before_build
45+
if [[ "$NIGHTLY" = "true" ]]; then
46+
echo "------ CLEAN CODE --------"
47+
clean_code $REPO_DIR develop
48+
echo "------ BUILD LIB --------"
49+
build_lib "$PLAT" "$INTERFACE64" "1"
50+
else
51+
echo "------ CLEAN CODE --------"
52+
clean_code $REPO_DIR $OPENBLAS_COMMIT
53+
echo "------ BUILD LIB --------"
54+
build_lib "$PLAT" "$INTERFACE64" "0"
55+
fi
56+
}
57+
58+
# install_virtualenv
59+
# build_openblas

travis-ci/build_wheel.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
set -xe
2+
ls libs/openblas* >/dev/null 2>&1 && true
3+
if [ "$?" != "0" ]; then
4+
# inside docker
5+
cd /openblas
6+
fi
7+
8+
mkdir -p local/openblas
9+
# This will fail if there is more than one file in libs
10+
tar -C local/openblas --strip-components=2 -xf libs/openblas*.tar.gz
11+
12+
# do not package the static libs and symlinks, only take the shared object
13+
find local/openblas/lib -maxdepth 1 -type l -delete
14+
rm local/openblas/lib/*.a
15+
16+
mv local/openblas/lib/libopenblas* local/openblas/lib/libopenblas_python.so
17+
patchelf --set-soname libopenblas_python.so local/openblas/lib/libopenblas_python.so
18+
python3.7 -m pip install wheel auditwheel
19+
python3.7 -m pip wheel -w /tmp/wheelhouse -vv .
20+
auditwheel repair -w dist/ /tmp/wheelhouse/openblas-*.whl

0 commit comments

Comments
 (0)