Skip to content

Commit

Permalink
ci: do arm64 builds natively on TravisCI
Browse files Browse the repository at this point in the history
  • Loading branch information
AWSjswinney committed Oct 1, 2020
1 parent 1f845d0 commit d067349
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 24 deletions.
49 changes: 40 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,22 @@ matrix:
env:
- PYTHON_VERSION=2.7.15

- os: linux
arch: arm64
virt: vm
group: edge
dist: focal
language: generic
env:
- PYTHON_VERSION=3.8.5

before_cache:
# Cleanup to avoid the cache to grow indefinitely as new package versions are released
# see https://stackoverflow.com/questions/39930171/cache-brew-builds-with-travis-ci
- brew cleanup
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew cleanup
fi
cache:
directories:
Expand All @@ -43,20 +55,39 @@ before_install:
if [[ "$TRAVIS_OS_NAME" == "osx" && "${PYTHON_VERSION}" == "3.7.8" ]]; then
brew install gettext
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir $HOME/bin; ln -s $(which pip2) $HOME/bin/pip; ln -s $(which python2) $HOME/bin/python; fi
- python scripts/ssl-check.py
- python -m pip install --disable-pip-version-check --upgrade pip
- pip install -U scikit-ci scikit-ci-addons
- ci_addons --install ../addons
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
mkdir $HOME/bin; ln -s $(which pip2) $HOME/bin/pip; ln -s $(which python2) $HOME/bin/python
python scripts/ssl-check.py
python -m pip install --disable-pip-version-check --upgrade pip
pip install -U scikit-ci scikit-ci-addons
ci_addons --install ../addons
elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
docker run -t --rm \
-v $(pwd):/io \
--env TRAVIS=True \
--env TRAVIS_OS_NAME="${TRAVIS_OS_NAME}" \
quay.io/pypa/manylinux2014_aarch64 \
/io/scripts/docker-build.sh
fi
install:
- ci install
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
ci install
fi
script:
- ci test
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
ci test
fi
after_success:
- ci after_test
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
ci after_test
fi
deploy:
# deploy-release
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ if(CMakePythonDistributions_SUPERBUILD)
# cache file.
file(WRITE "${CMAKE_BINARY_DIR}/initial-cache.txt"
"set(CMAKE_C_FLAGS \"-D_POSIX_C_SOURCE=199506L -D_POSIX_SOURCE=1 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1\" CACHE STRING \"Initial cache\" FORCE)
set(CMAKE_EXE_LINKER_FLAGS \"-static-libstdc++ -static-libgcc -lrt\" CACHE STRING \"Initial cache\" FORCE)
set(CMAKE_EXE_LINKER_FLAGS \"-lstdc++ -lgcc -lrt\" CACHE STRING \"Initial cache\" FORCE)
")
set(_common_args
CMAKE_ARGS -C "${CMAKE_BINARY_DIR}/initial-cache.txt"
Expand Down
34 changes: 20 additions & 14 deletions scikit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ before_install:
- python ../addons/travis/install_pyenv.py
- python scripts/ssl-check.py
- python ../addons/travis/install_cmake.py 3.12.0
linux:
commands:
- python: |
import os
import ci
os.environ["SETUP_BDIST_WHEEL_ARGS"] = "--plat-name %s" % os.environ["AUDITWHEEL_PLAT"]
setup_cmake_args = []
setup_cmake_args.append("-DSTRIP_EXECUTABLE:FILEPATH=/opt/rh/devtoolset-9/root/usr/" + "/bin/strip")
os.environ["SETUP_CMAKE_ARGS"] = " ".join(setup_cmake_args)
ci.driver.Driver.save_env(os.environ)
install:
commands:
Expand All @@ -82,20 +92,16 @@ build:
sdist=(glob.glob("dist/*.tar.gz") + glob.glob("dist/*.zip"))[0]
print("Deleting [%s]" % sdist)
os.remove(sdist)
circle:
commands:
- |
arch=${AUDITWHEEL_ARCH}
if [[ ${arch} == "aarch64" ]]; then
exit
fi
# Since there are no external shared libraries to bundle into the wheels
# this step will fixup the wheel switching from 'linux' to 'manylinux' tag
for whl in dist/*linux_${arch}.whl; do
auditwheel repair --plat ${AUDITWHEEL_PLAT} $whl -w ./dist/
rm $whl
done
travis:
linux:
commands:
- |
# Since there are no external shared libraries to bundle into the wheels
# this step will fixup the wheel switching from 'linux' to 'manylinux' tag
for whl in dist/*linux*_$(arch).whl; do
auditwheel repair --plat ${AUDITWHEEL_PLAT} $whl -w ./dist/
rm $whl
done
test:
commands:
Expand Down
43 changes: 43 additions & 0 deletions scripts/docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

set -e
set -x

MANYLINUX_PYTHON=cp38-cp38
export PATH="/opt/python/${MANYLINUX_PYTHON}/bin:$PATH"
export DEFAULT_DOCKCROSS_IMAGE=dockcross/manylinux2014-aarch64


yum install -y openssl-devel zlib-devel libcurl-devel
CMAKE_VERSION=3.18.3
cd /root
curl -L -O https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz
tar -xzf cmake-${CMAKE_VERSION}.tar.gz
cd cmake-${CMAKE_VERSION}
./bootstrap --system-curl --parallel=$(nproc)
make -j$(nproc)
make install
cd ..

cd /io


ci_before_install() {
/opt/python/${MANYLINUX_PYTHON}/bin/python scripts/ssl-check.py
/opt/python/${MANYLINUX_PYTHON}/bin/pip install scikit-ci scikit-ci-addons scikit-build
}

ci_install() {
/opt/python/${MANYLINUX_PYTHON}/bin/ci install
}
ci_test() {
/opt/python/${MANYLINUX_PYTHON}/bin/ci test
}
ci_after_success() {
/opt/python/${MANYLINUX_PYTHON}/bin/ci after_test
}

ci_before_install
ci_install
ci_test
ci_after_success

0 comments on commit d067349

Please sign in to comment.