Skip to content

Commit d3e68bb

Browse files
ossdev07odidev
authored andcommitted
added travis-ci support for arm64
Signed-off-by: ossdev07 <[email protected]>
1 parent 6be51cb commit d3e68bb

File tree

4 files changed

+127
-23
lines changed

4 files changed

+127
-23
lines changed

.travis.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ matrix:
3838
- env:
3939
- JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="(not slow and not network and not clipboard)"
4040

41+
- dist: trusty
42+
os: linux
43+
sudo: true
44+
arch: arm64
45+
env:
46+
- JOB="3.7" ENV_FILE="ci/deps/travis-37-aarch64.yaml" PATTERN="(not slow and not network)"
47+
4148
- env:
4249
- JOB="3.6, locale" ENV_FILE="ci/deps/travis-36-locale.yaml" PATTERN="((not slow and not network and not clipboard) or (single and db))" LOCALE_OVERRIDE="zh_CN.UTF-8" SQL="1"
4350
services:
@@ -98,6 +105,6 @@ script:
98105

99106
after_script:
100107
- echo "after_script start"
101-
- source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd
108+
- source activate pandas-dev && pushd /tmp && if [ `uname -m` = 'aarch64' ];then VAR="python3.7" ; else VAR="python";fi && $VAR -c "import pandas; pandas.show_versions();" && popd
102109
- ci/print_skipped.py
103110
- echo "after_script done"

ci/deps/travis-37-aarch64.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: pandas-dev
2+
channels:
3+
- defaults
4+
- conda-forge
5+
- c3i_test
6+
dependencies:
7+
- python=3.7.*
8+
9+
# tools
10+
- cython>=0.29.13
11+
- pytest>=5.0.1
12+
- pytest-xdist>=1.21
13+
- hypothesis>=3.58.0
14+
15+
# pandas dependencies
16+
- botocore>=1.11
17+
- numpy
18+
- python-dateutil
19+
- pytz
20+
- pip
21+
- pip:
22+
- moto

ci/run_tests.sh

+26-7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
# https://github.com/pytest-dev/pytest/issues/1075
66
export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))')
77

8+
if [ -n "$LOCALE_OVERRIDE" ]; then
9+
export LC_ALL="$LOCALE_OVERRIDE"
10+
export LANG="$LOCALE_OVERRIDE"
11+
PANDAS_LOCALE=`python -c 'import pandas; pandas.get_option("display.encoding")'`
12+
if [[ "$LOCALE_OVERRIDE" != "$PANDAS_LOCALE" ]]; then
13+
echo "pandas could not detect the locale. System locale: $LOCALE_OVERRIDE, pandas detected: $PANDAS_LOCALE"
14+
# TODO Not really aborting the tests until https://github.com/pandas-dev/pandas/issues/23923 is fixed
15+
# exit 1
16+
fi
17+
fi
18+
819
if [[ "not network" == *"$PATTERN"* ]]; then
920
export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4;
1021
fi
@@ -14,19 +25,27 @@ if [ "$COVERAGE" ]; then
1425
COVERAGE="-s --cov=pandas --cov-report=xml:$COVERAGE_FNAME"
1526
fi
1627

17-
# If no X server is found, we use xvfb to emulate it
18-
if [[ $(uname) == "Linux" && -z $DISPLAY ]]; then
19-
export DISPLAY=":0"
20-
XVFB="xvfb-run "
28+
# Travis does not have have an X server
29+
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
30+
DISPLAY=DISPLAY=:99.0
31+
if [ `uname -m` = 'aarch64' ]; then
32+
PYTEST_CMD="xvfb-run -e /dev/stdout pytest -m \"$PATTERN\" -s --strict --durations=10 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas"
33+
else
34+
PYTEST_CMD="xvfb-run -e /dev/stdout $PYTEST_CMD"
35+
fi
2136
fi
2237

2338
PYTEST_CMD="${XVFB}pytest -m \"$PATTERN\" -n auto --dist=loadfile -s --strict --durations=10 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas"
2439

2540
echo $PYTEST_CMD
26-
sh -c "$PYTEST_CMD"
41+
if [ `uname -m` = 'aarch64' ]; then
42+
sudo sh -c "$PYTEST_CMD"
43+
else
44+
sh -c "$PYTEST_CMD"
45+
fi
2746

2847
if [[ "$COVERAGE" && $? == 0 && "$TRAVIS_BRANCH" == "master" ]]; then
2948
echo "uploading coverage"
30-
echo "bash <(curl -s https://codecov.io/bash) -Z -c -f $COVERAGE_FNAME"
31-
bash <(curl -s https://codecov.io/bash) -Z -c -f $COVERAGE_FNAME
49+
echo "bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME"
50+
bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME
3251
fi

ci/setup_env.sh

+71-15
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ if [[ "$(uname)" == "Linux" && -n "$LC_ALL" ]]; then
1717
echo
1818
fi
1919

20-
MINICONDA_DIR="$HOME/miniconda3"
2120

21+
if [ `uname -m` = 'aarch64' ]; then
22+
MINICONDA_DIR="$HOME/archiconda3"
23+
IS_SUDO="sudo"
24+
else
25+
MINICONDA_DIR="$HOME/miniconda3"
26+
fi
2227

2328
if [ -d "$MINICONDA_DIR" ]; then
2429
echo
@@ -41,9 +46,24 @@ else
4146
exit 1
4247
fi
4348

44-
wget -q "https://repo.continuum.io/miniconda/Miniconda3-latest-$CONDA_OS.sh" -O miniconda.sh
45-
chmod +x miniconda.sh
46-
./miniconda.sh -b
49+
if [ `uname -m` = 'aarch64' ]; then
50+
wget -q "https://github.com/Archiconda/build-tools/releases/download/0.2.3/Archiconda3-0.2.3-Linux-aarch64.sh" -O archiconda.sh
51+
chmod +x archiconda.sh
52+
$IS_SUDO apt-get install python-dev
53+
$IS_SUDO apt-get install python3-pip
54+
$IS_SUDO apt-get install lib$ARCHICONDA_PYTHON-dev
55+
$IS_SUDO apt-get install xvfb
56+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/local/lib:/usr/local/bin/python
57+
./archiconda.sh -b
58+
echo "chmod MINICONDA_DIR"
59+
$IS_SUDO chmod -R 777 $MINICONDA_DIR
60+
$IS_SUDO cp $MINICONDA_DIR/bin/* /usr/bin/
61+
$IS_SUDO rm /usr/bin/lsb_release
62+
else
63+
wget -q "https://repo.continuum.io/miniconda/Miniconda3-latest-$CONDA_OS.sh" -O miniconda.sh
64+
chmod +x miniconda.sh
65+
./miniconda.sh -b
66+
fi
4767

4868
export PATH=$MINICONDA_DIR/bin:$PATH
4969

@@ -55,8 +75,8 @@ echo
5575
echo "update conda"
5676
conda config --set ssl_verify false
5777
conda config --set quiet true --set always_yes true --set changeps1 false
58-
conda install pip conda # create conda to create a historical artifact for pip & setuptools
59-
conda update -n base conda
78+
$IS_SUDO conda install pip # create conda to create a historical artifact for pip & setuptools
79+
$IS_SUDO conda update -n base conda
6080

6181
echo "conda info -a"
6282
conda info -a
@@ -96,8 +116,18 @@ conda list
96116
conda remove --all -q -y -n pandas-dev
97117

98118
echo
119+
if [ `uname -m` = 'aarch64' ]; then
120+
$IS_SUDO chmod -R 777 $MINICONDA_DIR
121+
$IS_SUDO conda install botocore
122+
$IS_SUDO conda install numpy
123+
$IS_SUDO conda install python-dateutil=2.8.0
124+
$IS_SUDO conda install hypothesis
125+
$IS_SUDO conda install pytz
126+
$IS_SUDO chmod -R 777 $MINICONDA_DIR
127+
fi
128+
99129
echo "conda env create -q --file=${ENV_FILE}"
100-
time conda env create -q --file="${ENV_FILE}"
130+
time $IS_SUDO conda env create -q --file="${ENV_FILE}"
101131

102132

103133
if [[ "$BITS32" == "yes" ]]; then
@@ -111,13 +141,17 @@ source activate pandas-dev
111141
echo
112142
echo "remove any installed pandas package"
113143
echo "w/o removing anything else"
114-
conda remove pandas -y --force || true
115-
pip uninstall -y pandas || true
144+
$IS_SUDO conda remove pandas -y --force || true
145+
if [ `uname -m` = 'aarch64' ]; then
146+
$IS_SUDO $ARCHICONDA_PYTHON -m pip uninstall -y pandas || true
147+
else
148+
pip uninstall -y pandas || true
149+
fi
116150

117151
echo
118152
echo "remove postgres if has been installed with conda"
119153
echo "we use the one from the CI"
120-
conda remove postgresql -y --force || true
154+
$IS_SUDO conda remove postgresql -y --force || true
121155

122156
echo
123157
echo "remove qt"
@@ -131,7 +165,10 @@ conda list pandas
131165
# Make sure any error below is reported as such
132166

133167
echo "[Build extensions]"
134-
python setup.py build_ext -q -i -j2
168+
if [ `uname -m` = 'aarch64' ]; then
169+
sudo chmod -R 777 /home/travis/.ccache
170+
fi
171+
python setup.py build_ext -q -i
135172

136173
# TODO: Some of our environments end up with old versions of pip (10.x)
137174
# Adding a new enough version of pip to the requirements explodes the
@@ -140,21 +177,40 @@ python setup.py build_ext -q -i -j2
140177
# - py35_compat
141178
# - py36_32bit
142179
echo "[Updating pip]"
143-
python -m pip install --no-deps -U pip wheel setuptools
180+
if [ `uname -m` = 'aarch64' ]; then
181+
sudo chmod -R 777 /home/travis/archiconda3/envs/pandas-dev/lib/$ARCHICONDA_PYTHON/site-packages
182+
$IS_SUDO $ARCHICONDA_PYTHON -m pip install pytest-forked
183+
$IS_SUDO $ARCHICONDA_PYTHON -m pip install pytest-xdist
184+
$IS_SUDO $ARCHICONDA_PYTHON -m pip install --no-deps -U pip wheel setuptools
185+
sudo chmod -R 777 $MINICONDA_DIR
186+
else
187+
python -m pip install --no-deps -U pip wheel setuptools
188+
fi
144189

145190
echo "[Install pandas]"
146-
python -m pip install --no-build-isolation -e .
191+
if [ `uname -m` = 'aarch64' ]; then
192+
$IS_SUDO chmod -R 777 $MINICONDA_DIR
193+
$IS_SUDO $ARCHICONDA_PYTHON -m pip install numpy
194+
$IS_SUDO $ARCHICONDA_PYTHON -m pip install hypothesis
195+
$IS_SUDO chmod -R 777 /home/travis/.cache/
196+
$IS_SUDO $ARCHICONDA_PYTHON -m pip install --no-build-isolation -e .
197+
else
198+
python -m pip install --no-build-isolation -e .
199+
fi
147200

148201
echo
149202
echo "conda list"
150203
conda list
151204

152205
# Install DB for Linux
153-
154206
if [[ -n ${SQL:0} ]]; then
155207
echo "installing dbs"
208+
if [ `uname -m` = 'aarch64' ]; then
209+
sudo systemctl start mysql
210+
else
211+
psql -c 'create database pandas_nosetest;' -U postgres
212+
fi
156213
mysql -e 'create database pandas_nosetest;'
157-
psql -c 'create database pandas_nosetest;' -U postgres
158214
else
159215
echo "not using dbs on non-linux Travis builds or Azure Pipelines"
160216
fi

0 commit comments

Comments
 (0)