Skip to content

Commit

Permalink
make more of CI work
Browse files Browse the repository at this point in the history
  • Loading branch information
mattip committed Aug 15, 2023
1 parent 4397282 commit 12b7dbd
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 75 deletions.
39 changes: 19 additions & 20 deletions .github/workflows/posix.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: multibuild
name: posix

on:
push:
Expand Down Expand Up @@ -71,10 +71,10 @@ jobs:
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.7
- name: Set extra env
run: |
if [ "macos-11" == "${{ matrix.os }}" ]; then
Expand All @@ -93,7 +93,7 @@ jobs:
echo "DOCKER_TEST_IMAGE: ${DOCKER_TEST_IMAGE}"
- name: Install VirtualEnv
run: |
python -m pip install --upgrade pip
python3 -m pip install --upgrade pip
pip install virtualenv
- name: Build OpenBLAS
run: |
Expand All @@ -120,23 +120,22 @@ jobs:
- name: Build wheel
run: |
mkdir -p local/openblas
tar -C local/openblas --strip-components=2 -xf libs/openblas*.tar.gz
cp local/openblas/lib/libopenblas64_.so local/openblas/libopenblas_python.so
# do not package the static libs and symlinks, they are ~55MB
rm -rf local/openblas/lib/*
mv local/openblas/libopenblas_python.so local/openblas/lib/
cat <<EOF > run_in_docker.sh
cd /openblas
patchelf --set-soname libopenblas_python.so local/openblas/lib/libopenblas_python.so
python3.7 -m pip wheel -w /tmp/wheelhouse -vv .
auditwheel repair -w dist/ /tmp/wheelhouse/openblas-*.whl
python3.10 -m pip install dist/openblas-*.whl
python3.10 -m openblas
EOF
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
source travis-ci/build_wheel.sh
else
docker run --rm -v $(pwd):/openblas quay.io/pypa/manylinux2014_x86_64 /bin/bash -xe /openblas/travis-ci/build_wheel.sh
fi
docker run --rm -v $(pwd):/openblas quay.io/pypa/manylinux2014_x86_64 /bin/bash -xe /openblas/run_in_docker.sh
- name: Setup different python to test wheel
uses: actions/setup-python@v4
with:
python-version: 3.10

- name: Test wheel
run: |
python -m pip install --no-index --find-links dist openblas
python -m openblas
- uses: actions/upload-artifact@v3
with:
Expand Down
107 changes: 56 additions & 51 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,61 +27,66 @@ jobs:
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
- 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
$BITS = ${{ matrix.BUILD_BITS }}
echo "BUILD_BITS=$BITS" >> $env:GITHUB_ENV
# For interpretation of MSYSTEM, see:
# https://sourceforge.net/p/msys2/discussion/general/thread/b7dfdac8/#3939
if ($BITS -eq 32) {
echo "PLAT=i686" >> $env:GITHUB_ENV
echo "MSYSTEM=MINGW32" >> $env:GITHUB_ENV
echo "LDFLAGS=-static -static-libgcc" >> $env:GITHUB_ENV
} else {
echo "PLAT=x86_64" >> $env:GITHUB_ENV
echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV
echo "LDFLAGS=-lucrt -static -static-libgcc" >> $env:GITHUB_ENV
}
if ( ${{ matrix.INTERFACE64 }} -eq 1 ) {
echo "INTERFACE64=1" >> $env:GITHUB_ENV
}
- name: Set env variables
run: |
echo "START_DIR=$PWD" >> $env:GITHUB_ENV
$BITS = ${{ matrix.BUILD_BITS }}
echo "BUILD_BITS=$BITS" >> $env:GITHUB_ENV
# For interpretation of MSYSTEM, see:
# https://sourceforge.net/p/msys2/discussion/general/thread/b7dfdac8/#3939
if ($BITS -eq 32) {
echo "PLAT=i686" >> $env:GITHUB_ENV
echo "MSYSTEM=MINGW32" >> $env:GITHUB_ENV
echo "LDFLAGS=-static -static-libgcc" >> $env:GITHUB_ENV
} else {
echo "PLAT=x86_64" >> $env:GITHUB_ENV
echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV
echo "LDFLAGS=-lucrt -static -static-libgcc" >> $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: 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: 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: Copy
run: |
cp for_test\test*.exe builds
- uses: actions/upload-artifact@v3
with:
path: builds/openblas*.zip
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8

- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: upload
- uses: actions/upload-artifact@v3
with:
path: builds/openblas*.zip

- 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
- 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
2 changes: 1 addition & 1 deletion OpenBLAS
6 changes: 3 additions & 3 deletions local/openblas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ def get_pkg_config():
return f"""\
libdir={_HERE}/lib
includedir={_HERE}/include
openblas_config= USE_64BITINT= DYNAMIC_ARCH=1 DYNAMIC_OLDER= NO_CBLAS= NO_LAPACK= NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP= PRESCOTT MAX_THREADS=24
version=0.3.23
openblas_config= {openblas_config}
version={openblas_config.split(" ")[1]}
extralib=-lm -lpthread -lgfortran -lm -lpthread -lgfortran
Name: openblas
Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version
Version: ${version}
Version: ${{version}}
URL: https://github.com/xianyi/OpenBLAS
Libs: -L${libdir} -lopenblas
Libs.private: ${extralib}
Expand Down
59 changes: 59 additions & 0 deletions tools/local_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Replicate the workflow from posix.yml locally on posix
# This may bitrot, compare it to the original file before using


# Set extra env
if [ "uname -m" == "x86_64" ]; then
export TRAVIS_OS_NAME=ubuntu-latest
export PLAT=x86_64
# export PLAT=i86
DOCKER_TEST_IMAGE=multibuild/xenial_${PLAT}
else
export TRAVIS_OS_NAME=osx
export LDFLAGS="-L/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/lib"
export LIBRARY_PATH="-L/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/lib"
export PLAT=x86_64
# export PLAT=arm64
export SUFFIX=gf_c469a42

fi
export REPO_DIR=OpenBLAS
export OPENBLAS_COMMIT="c2f4bdb"

# export MB_ML_LIBC=musllinux
# export MB_ML_VER=_1_1
# export MB_ML_VER=2014
export INTERFACE64=1

function install_virtualenv {
# Install VirtualEnv
python3 -m pip install --upgrade pip
pip install virtualenv
}

function build_openblas {
# Build OpenBLAS
set -xeo pipefail
if [ "$PLAT" == "arm64" ]; then
sudo xcode-select -switch /Applications/Xcode_12.5.1.app
export SDKROOT=/Applications/Xcode_12.5.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk
clang --version
fi
source travis-ci/build_steps.sh
echo "------ BEFORE BUILD ---------"
before_build
if [[ "$NIGHTLY" = "true" ]]; then
echo "------ CLEAN CODE --------"
clean_code $REPO_DIR develop
echo "------ BUILD LIB --------"
build_lib "$PLAT" "$INTERFACE64" "1"
else
echo "------ CLEAN CODE --------"
clean_code $REPO_DIR $OPENBLAS_COMMIT
echo "------ BUILD LIB --------"
build_lib "$PLAT" "$INTERFACE64" "0"
fi
}

# install_virtualenv
# build_openblas
20 changes: 20 additions & 0 deletions travis-ci/build_wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
set -xe
ls libs/openblas* >/dev/null 2>&1 && true
if [ "$?" != "0" ]; then
# inside docker
cd /openblas
fi

mkdir -p local/openblas
# This will fail if there is more than one file in libs
tar -C local/openblas --strip-components=2 -xf libs/openblas*.tar.gz

# do not package the static libs and symlinks, only take the shared object
find local/openblas/lib -maxdepth 1 -type l -delete
rm local/openblas/lib/*.a

mv local/openblas/lib/libopenblas* local/openblas/lib/libopenblas_python.so
patchelf --set-soname libopenblas_python.so local/openblas/lib/libopenblas_python.so
python3.7 -m pip install wheel auditwheel
python3.7 -m pip wheel -w /tmp/wheelhouse -vv .
auditwheel repair -w dist/ /tmp/wheelhouse/openblas-*.whl

0 comments on commit 12b7dbd

Please sign in to comment.