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 15, 2020
1 parent 1f845d0 commit f2aadb8
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 22 deletions.
50 changes: 41 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,40 @@ 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/manylinux2014-aarch64-build-and-test-wheel.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
pwd && ls dist
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
14 changes: 7 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ environment:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
PYTHON_DIR: "C:\\Python37"
PYTHON_VERSION: "3.7.x"
PYTHON_ARCH: "64"
PYTHON_ARCH: "32"
BLOCK: "0"

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
Expand All @@ -38,22 +38,22 @@ environment:
secure: qDoPKmtLMdcKUKRHuTlfaajjzO4Q4yu25FM5JuB7z84=

init:
- python -m pip install -U scikit-ci scikit-ci-addons
- python -m ci_addons --install ../addons
- "%PYTHON_DIR%\\python.exe -m pip install -U scikit-ci scikit-ci-addons"
- "%PYTHON_DIR%\\python.exe -m ci_addons --install ../addons"

- ps: ../addons/appveyor/rolling-build.ps1

install:
- python -m ci install
- "%PYTHON_DIR%\\python.exe -m ci install"

build_script:
- python -m ci build
- "%PYTHON_DIR%\\python.exe -m ci build"

test_script:
- python -m ci test
- "%PYTHON_DIR%\\python.exe -m ci test"

after_test:
- python -m ci after_test
- "%PYTHON_DIR%\\python.exe -m ci after_test"

on_finish:
- ps: ../addons/appveyor/enable-worker-remote-access.ps1 -check_for_block
Expand Down
26 changes: 25 additions & 1 deletion scikit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ 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
import platform
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")
if platform.machine() == "aarch64":
# Remove this after addressing https://github.com/dockcross/dockcross/issues/431
setup_cmake_args.append("-DOPENSSL_ROOT_DIR:PATH=/tmp/openssl-install")
os.environ["SETUP_CMAKE_ARGS"] = " ".join(setup_cmake_args)
os.environ["SETUP_MAKE_ARGS"] = "-j$(nproc)"
ci.driver.Driver.save_env(os.environ)
install:
commands:
Expand All @@ -74,14 +89,23 @@ build:
# Source distribution
- python setup.py --hide-listing sdist
# Built distribution (wheel)
- python setup.py --hide-listing bdist_wheel $<SETUP_BDIST_WHEEL_ARGS> -- $<SETUP_CMAKE_ARGS>
- python setup.py --hide-listing bdist_wheel $<SETUP_BDIST_WHEEL_ARGS> -- $<SETUP_CMAKE_ARGS> -- $<SETUP_MAKE_ARGS>
# Cleanup
- python: |
import glob, os
if os.environ.get("UPLOAD_SDIST", "") == "":
sdist=(glob.glob("dist/*.tar.gz") + glob.glob("dist/*.zip"))[0]
print("Deleting [%s]" % sdist)
os.remove(sdist)
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
done
circle:
commands:
Expand Down
8 changes: 4 additions & 4 deletions scripts/manylinux2014-aarch64-build-and-install-openssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ set -o pipefail
MY_DIR=$(dirname "${BASH_SOURCE[0]}")
source $MY_DIR/utils.sh

OPENSSL_ROOT=openssl-1.1.1g
OPENSSL_ROOT=openssl-1.1.1h

# Hash from https://www.openssl.org/source/openssl-1.1.1g.tar.gz.sha256
OPENSSL_HASH=ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
# Hash from https://www.openssl.org/source/openssl-1.1.1h.tar.gz.sha256
OPENSSL_HASH=5c9ca8774bd7b03e5784f26ae9e9e6d749c9da2438545077e6b3d755a06595d9

# Environment variables defined in "dockcross/manylinux2014-aarch64/Dockerfile.in"
check_var CROSS_ROOT
Expand All @@ -40,7 +40,7 @@ cd ${OPENSSL_ROOT}
shared

# Build
make -j$(grep -c processor /proc/cpuinfo)
make -j$(nproc)

# Install
make install
Expand Down
32 changes: 32 additions & 0 deletions scripts/manylinux2014-aarch64-build-and-test-wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -e
set -x

MANYLINUX_PYTHON=cp38-cp38
export PATH="/opt/python/${MANYLINUX_PYTHON}/bin:$PATH"

yum install -y wget

cd /io
./scripts/manylinux2014-aarch64-build-and-install-openssl.sh

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 f2aadb8

Please sign in to comment.