Skip to content

Commit cdf0fec

Browse files
committed
ci: do arm64 builds natively on TravisCI
1 parent 1f845d0 commit cdf0fec

6 files changed

+110
-22
lines changed

Diff for: .travis.yml

+41-9
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,22 @@ matrix:
1818
env:
1919
- PYTHON_VERSION=2.7.15
2020

21+
- os: linux
22+
arch: arm64
23+
virt: vm
24+
group: edge
25+
dist: focal
26+
language: generic
27+
env:
28+
- PYTHON_VERSION=3.8.5
29+
2130
before_cache:
2231
# Cleanup to avoid the cache to grow indefinitely as new package versions are released
2332
# see https://stackoverflow.com/questions/39930171/cache-brew-builds-with-travis-ci
24-
- brew cleanup
33+
- |
34+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
35+
brew cleanup
36+
fi
2537
2638
cache:
2739
directories:
@@ -43,20 +55,40 @@ before_install:
4355
if [[ "$TRAVIS_OS_NAME" == "osx" && "${PYTHON_VERSION}" == "3.7.8" ]]; then
4456
brew install gettext
4557
fi
46-
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir $HOME/bin; ln -s $(which pip2) $HOME/bin/pip; ln -s $(which python2) $HOME/bin/python; fi
47-
- python scripts/ssl-check.py
48-
- python -m pip install --disable-pip-version-check --upgrade pip
49-
- pip install -U scikit-ci scikit-ci-addons
50-
- ci_addons --install ../addons
58+
- |
59+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
60+
mkdir $HOME/bin; ln -s $(which pip2) $HOME/bin/pip; ln -s $(which python2) $HOME/bin/python
61+
python scripts/ssl-check.py
62+
python -m pip install --disable-pip-version-check --upgrade pip
63+
pip install -U scikit-ci scikit-ci-addons
64+
ci_addons --install ../addons
65+
elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
66+
docker run -t --rm \
67+
-v $(pwd):/io \
68+
--env TRAVIS=True \
69+
--env TRAVIS_OS_NAME="${TRAVIS_OS_NAME}" \
70+
quay.io/pypa/manylinux2014_aarch64 \
71+
/io/scripts/docker-build.sh
72+
fi
5173
5274
install:
53-
- ci install
75+
- |
76+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
77+
ci install
78+
fi
5479
5580
script:
56-
- ci test
81+
- |
82+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
83+
ci test
84+
fi
5785
5886
after_success:
59-
- ci after_test
87+
- |
88+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
89+
ci after_test
90+
fi
91+
pwd && ls dist
6092
6193
deploy:
6294
# deploy-release

Diff for: CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ if(CMakePythonDistributions_SUPERBUILD)
188188
# cache file.
189189
file(WRITE "${CMAKE_BINARY_DIR}/initial-cache.txt"
190190
"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)
191-
set(CMAKE_EXE_LINKER_FLAGS \"-static-libstdc++ -static-libgcc -lrt\" CACHE STRING \"Initial cache\" FORCE)
191+
set(CMAKE_EXE_LINKER_FLAGS \"-lstdc++ -lgcc -lrt\" CACHE STRING \"Initial cache\" FORCE)
192192
")
193193
set(_common_args
194194
CMAKE_ARGS -C "${CMAKE_BINARY_DIR}/initial-cache.txt"

Diff for: appveyor.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ environment:
2323
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
2424
PYTHON_DIR: "C:\\Python37"
2525
PYTHON_VERSION: "3.7.x"
26-
PYTHON_ARCH: "64"
26+
PYTHON_ARCH: "32"
2727
BLOCK: "0"
2828

2929
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
@@ -38,22 +38,22 @@ environment:
3838
secure: qDoPKmtLMdcKUKRHuTlfaajjzO4Q4yu25FM5JuB7z84=
3939

4040
init:
41-
- python -m pip install -U scikit-ci scikit-ci-addons
42-
- python -m ci_addons --install ../addons
41+
- "%PYTHON_DIR%\\python.exe -m pip install -U scikit-ci scikit-ci-addons"
42+
- "%PYTHON_DIR%\\python.exe -m ci_addons --install ../addons"
4343

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

4646
install:
47-
- python -m ci install
47+
- "%PYTHON_DIR%\\python.exe -m ci install"
4848

4949
build_script:
50-
- python -m ci build
50+
- "%PYTHON_DIR%\\python.exe -m ci build"
5151

5252
test_script:
53-
- python -m ci test
53+
- "%PYTHON_DIR%\\python.exe -m ci test"
5454

5555
after_test:
56-
- python -m ci after_test
56+
- "%PYTHON_DIR%\\python.exe -m ci after_test"
5757

5858
on_finish:
5959
- ps: ../addons/appveyor/enable-worker-remote-access.ps1 -check_for_block

Diff for: scikit-ci.yml

+25-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ before_install:
5656
- python ../addons/travis/install_pyenv.py
5757
- python scripts/ssl-check.py
5858
- python ../addons/travis/install_cmake.py 3.12.0
59+
linux:
60+
commands:
61+
- python: |
62+
import os
63+
import ci
64+
import platform
65+
os.environ["SETUP_BDIST_WHEEL_ARGS"] = "--plat-name %s" % os.environ["AUDITWHEEL_PLAT"]
66+
setup_cmake_args = []
67+
setup_cmake_args.append("-DSTRIP_EXECUTABLE:FILEPATH=/opt/rh/devtoolset-9/root/usr/" + "/bin/strip")
68+
if platform.machine() == "aarch64":
69+
# Remove this after addressing https://github.com/dockcross/dockcross/issues/431
70+
setup_cmake_args.append("-DOPENSSL_ROOT_DIR:PATH=/tmp/openssl-install")
71+
os.environ["SETUP_CMAKE_ARGS"] = " ".join(setup_cmake_args)
72+
os.environ["SETUP_MAKE_ARGS"] = "-j$(nproc)"
73+
ci.driver.Driver.save_env(os.environ)
5974
6075
install:
6176
commands:
@@ -74,14 +89,23 @@ build:
7489
# Source distribution
7590
- python setup.py --hide-listing sdist
7691
# Built distribution (wheel)
77-
- python setup.py --hide-listing bdist_wheel $<SETUP_BDIST_WHEEL_ARGS> -- $<SETUP_CMAKE_ARGS>
92+
- python setup.py --hide-listing bdist_wheel $<SETUP_BDIST_WHEEL_ARGS> -- $<SETUP_CMAKE_ARGS> -- $<SETUP_MAKE_ARGS>
7893
# Cleanup
7994
- python: |
8095
import glob, os
8196
if os.environ.get("UPLOAD_SDIST", "") == "":
8297
sdist=(glob.glob("dist/*.tar.gz") + glob.glob("dist/*.zip"))[0]
8398
print("Deleting [%s]" % sdist)
8499
os.remove(sdist)
100+
travis:
101+
linux:
102+
commands:
103+
- |
104+
# Since there are no external shared libraries to bundle into the wheels
105+
# this step will fixup the wheel switching from 'linux' to 'manylinux' tag
106+
for whl in dist/*linux*_$(arch).whl; do
107+
auditwheel repair --plat ${AUDITWHEEL_PLAT} $whl -w ./dist
108+
done
85109
86110
circle:
87111
commands:

Diff for: scripts/manylinux2014-aarch64-build-and-install-openssl.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ set -o pipefail
1010
MY_DIR=$(dirname "${BASH_SOURCE[0]}")
1111
source $MY_DIR/utils.sh
1212

13-
OPENSSL_ROOT=openssl-1.1.1g
13+
OPENSSL_ROOT=openssl-1.1.1h
1414

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

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

4242
# Build
43-
make -j$(grep -c processor /proc/cpuinfo)
43+
make -j$(nproc)
4444

4545
# Install
4646
make install
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -x
5+
6+
MANYLINUX_PYTHON=cp38-cp38
7+
export PATH="/opt/python/${MANYLINUX_PYTHON}/bin:$PATH"
8+
9+
yum install -y wget
10+
11+
cd /io
12+
./scripts/manylinux2014-aarch64-build-and-install-openssl.sh
13+
14+
ci_before_install() {
15+
/opt/python/${MANYLINUX_PYTHON}/bin/python scripts/ssl-check.py
16+
/opt/python/${MANYLINUX_PYTHON}/bin/pip install scikit-ci scikit-ci-addons scikit-build
17+
}
18+
19+
ci_install() {
20+
/opt/python/${MANYLINUX_PYTHON}/bin/ci install
21+
}
22+
ci_test() {
23+
/opt/python/${MANYLINUX_PYTHON}/bin/ci test
24+
}
25+
ci_after_success() {
26+
/opt/python/${MANYLINUX_PYTHON}/bin/ci after_test
27+
}
28+
29+
ci_before_install
30+
ci_install
31+
ci_test
32+
ci_after_success

0 commit comments

Comments
 (0)