Skip to content

Commit 0b1bb23

Browse files
committed
use rustup instead of cross everywhere
1 parent eab9a50 commit 0b1bb23

File tree

5 files changed

+66
-34
lines changed

5 files changed

+66
-34
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,7 @@ target/
6262
.python-version
6363

6464
# virtualenv
65-
.venv/
65+
.venv/
66+
67+
# Wheelhouse
68+
wheelhouse/

.travis.yml

+19-17
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ env:
1111
global:
1212
# TODO Update this to match the name of your project.
1313
- CRATE_NAME=trust_pypi_example
14+
# Rust release. E.g. Stable, nightly, nightly-2014-12-18
15+
- RUSTRELEASE=stable
1416

1517
matrix:
1618
include:
@@ -20,24 +22,24 @@ matrix:
2022

2123

2224
# Linux
23-
# we are using Rustup instead of cross when WHEELPLATFORM="*manylinux*". This is because both
25+
# we are using Rustup instead of cross when WHEELPLATFORM="*manylinux*". This is because both
2426
# manylinux and Cross depend on Docker but the shared libs in the Cross contains are too new
25-
# to make valid manylinux containers.
27+
# to make valid manylinux containers.
2628
#
27-
# You can lean more about the differnt Rustup toolchains here:
29+
# You can lean more about the differnt Rustup toolchains here:
2830
# https://github.com/rust-lang-nursery/rustup.rs#toolchain-specification
29-
#
31+
#
3032
# More on manylinuyx at https://github.com/pypa/manylinux
3133
# and the pep https://www.python.org/dev/peps/pep-0513
32-
#
33-
# one other thing about manylinux. Since the container contains several versions of python,
34-
# we build/test against all of them at the same time. I have it set up to run against
34+
#
35+
# one other thing about manylinux. Since the container contains several versions of python,
36+
# we build/test against all of them at the same time. I have it set up to run against
3537
# cp27-cp27m, cp27-cp27mu, cp33-cp33m, cp34-cp34m, cp35-cp35m, cp36-cp36m
36-
# PYENV versions isn't relevent here so just keep it at 3.6.1
38+
# PYENV versions isn't relevent here so just keep it at 3.6.1
3739
- env: TARGET=i686-unknown-linux-gnu PYENV=3.6.1 WHEELPLATFORM=manylinux1_i686
38-
- env: TARGET=stable-x86_64-unknown-linux-gnu PYENV=3.6.1 WHEELPLATFORM=manylinux1_x86_64
40+
- env: TARGET=x86_64-unknown-linux-gnu PYENV=3.6.1 WHEELPLATFORM=manylinux1_x86_64
3941

40-
# Note that musl isn't covered by manylinux and I had trouble building
42+
# Note that musl isn't covered by manylinux and I had trouble building
4143
# dylibs with it as well
4244
# - env: TARGET=i686-unknown-linux-musl PYENV=2.7.13 WHEELPLATFORM=
4345
# - env: TARGET=i686-unknown-linux-musl PYENV=3.6.1 WHEELPLATFORM=
@@ -46,8 +48,8 @@ matrix:
4648

4749
# OSX
4850
# See versions https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version
49-
# current default is osx_image: xcode7.3 OS X 10.11
50-
#
51+
# current default is osx_image: xcode7.3 OS X 10.11
52+
#
5153
- env: TARGET=x86_64-apple-darwin PYENV=2.7.13 WHEELPLATFORM=macosx_10_11_x86_64
5254
os: osx
5355
osx_image: xcode7.3
@@ -92,7 +94,7 @@ install:
9294
- source ~/.cargo/env || true
9395

9496
script:
95-
- bash ci/script.sh
97+
- bash ci/script.sh
9698

9799
after_script: set +e
98100

@@ -105,7 +107,7 @@ deploy:
105107
- provider: pypi
106108
distributions: bdist_wheel
107109
user: mckaymatt
108-
password:
110+
password:
109111
secure: gw5UUxAkCTOWQCcRqavrsjPNxGHDqZr1tej0Y6GzKq6DMDxcvAH36lHdP596eRUfIs20ZZcaUz9+y1DBL8cFleghLBMKHnjH9AMx5p5SMRxItkuERRE5zCsAASEf7W5z5bzR9PWoUsLXbQdR9eTaWn2JYHU00MC5RmPfH8+NAItP2xCjTX/JFqg/pXPHc0uKz5ijwDaFASF/+1zDaqHrU4SdS47o/17jQsmMOwYUMn4htfHWYFnB6dktrTlPeiCFV1qA4HntnVnm6Bls2J7THPkyZmHE1GnGTLhKhqlL/IUAHdRzQuPvcEpWwsgmwjgWbz8ccBdDVOh4n4KBRGxM+NlY0H3VZICRCI/r8aT/3M7FX5tQp5s1Cl8IDD7SHRcu6EsJKjubmntX/7/GFrMvEiIx342bA8ohFklAeZftlnaf9JSdZqvAj0NKi7K96B7BfajGEhFkd02GlC0/2uQGlZI4MajDcYd2cHB/qUvIKbRVXzkV1nFiwHD3g6PGCvFYYK+F+PCacPiz17ANuETaQgGJ6WpRV+zwTAlmmAWaAcUBdBkYkUamaQNtjIXvZCqqe0P0AX38bYJG+qXsLRL+TceZ3P0Pn8iaBkgn7VmRLq1jMio5zf6eIHQU6BENXsI1+3an2O1nLgB1TfatukMyIoORezWfQliTrkLnaP1Pmz8=
110112
on:
111113
tags: true
@@ -137,7 +139,7 @@ before_cache:
137139
- chmod -R a+r $HOME/.cargo
138140
- chmod -R a+r $HOME/.rustup
139141
- chmod -R a+r $HOME/.manylinux_pip_cache
140-
- chmod -R a+r $HOME/.manylinux_rustup_cache
142+
- chmod -R a+r $HOME/.manylinux_rustup_cache
141143
- chmod -R a+r $HOME/.manylinux_cargo_cache
142144

143145

@@ -149,7 +151,7 @@ cache:
149151
- $HOME/.cargo
150152
- $HOME/.rustup
151153
- $HOME/.manylinux_pip_cache
152-
- $HOME/.manylinux_rustup_cache
154+
- $HOME/.manylinux_rustup_cache
153155
- $HOME/.manylinux_cargo_cache
154156

155157

@@ -164,4 +166,4 @@ notifications:
164166
recipients:
165167
166168
on_success: never
167-
on_failure: always # default: always
169+
on_failure: never # default: always

ci/install.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ main() {
2121
fi
2222

2323
# This fetches latest stable release
24-
local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \
25-
| cut -d/ -f3 \
26-
| grep -E '^v[0.1.0-9.]+$' \
27-
| $sort --version-sort \
28-
| tail -n1)
24+
# local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \
25+
# | cut -d/ -f3 \
26+
# | grep -E '^v[0.1.0-9.]+$' \
27+
# | $sort --version-sort \
28+
# | tail -n1)
2929
curl -LSfs https://japaric.github.io/trust/install.sh | \
3030
sh -s -- \
3131
--force \
3232
--git japaric/cross \
33-
--tag $tag \
33+
--tag 'v0.1.10' \
3434
--target $target
3535
}
3636

37-
main
37+
# main

ci/manylinux_build_wheel.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ function rust_build() {
2121
curl https://sh.rustup.rs -sSf > /tmp/rustup.sh
2222
sh /tmp/rustup.sh -y
2323
source $HOME/.cargo/env
24-
rustup install "nightly-$TARGET"
25-
rustup default "nightly-$TARGET"
24+
rustup install "stable-$TARGET"
25+
rustup default "stable-$TARGET"
2626
rustup update
2727

2828
cd /io/trust_pypi_example/rust/

ci/script.sh

+34-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
set -ex
44

5+
# This builds "manylinux" python packages in the manylinux docker container
6+
# More on manylinuyx at https://github.com/pypa/manylinux
7+
# and the pep https://www.python.org/dev/peps/pep-0513
58
manylinux_linux() {
69
# cache pip packages used in docker
710
mkdir -p "$HOME/.manylinux_pip_cache"
@@ -11,22 +14,34 @@ manylinux_linux() {
1114
CACHES="-v $HOME/.manylinux_pip_cache:/root/.cache/pip \
1215
-v $HOME/.manylinux_cargo_cache:/root/.cargo \
1316
-v $HOME/.manylinux_rustup_cache:/root/.rustup "
14-
# SUB='-v /home/matt/workspace/auditwheel/auditwheel/wheeltools.py:/opt/python/cp36-cp36m/lib/python3.6/site-packages/auditwheel/wheeltools.py'
15-
docker run --rm -e TARGET="${TARGET}" $CACHES -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /io/ci/manylinux_build_wheel.sh
17+
18+
# WHEELPLATFORM is either "manylinux1_i686" or "manylinux1_x86_64"
19+
docker run --rm -e TARGET="${TARGET}" -e RUSTRELEASE="${RUSTRELEASE}" $CACHES -v `pwd`:/io "quay.io/pypa/${WHEELPLATFORM}" /io/ci/manylinux_build_wheel.sh
1620

1721
}
1822

23+
# This is for OSX mainly. It gets python from Pyenv and uses Rustup for getting rustc.
24+
# it could also be used for testing on other nixes
1925
pyenv_build_test_bundle() {
2026
# This uses cross and Pyenv
27+
curl https://sh.rustup.rs -sSf > /tmp/rustup.sh
28+
sh /tmp/rustup.sh -y
29+
source $HOME/.cargo/env
30+
rustup install "${RUSTRELEASE}-${TARGET}"
31+
rustup default "${RUSTRELEASE}-${TARGET}"
32+
rustup update
2133

2234
pushd trust_pypi_example/rust/
23-
cross build --target $TARGET --release
35+
cargo build --target $TARGET --release
36+
# pushd trust_pypi_example/rust/
37+
# cross build --target $TARGET --release
2438

2539
# disable tests
2640
if [ ! -z $DISABLE_TESTS ]; then
2741
echo "Rust Tests Disabled"
2842
else
29-
cross test --target $TARGET --release
43+
cargo test --target $TARGET --release
44+
# cross test --target $TARGET --release
3045
fi
3146
# uncomment if creating a bin
3247
# cross run --target $TARGET
@@ -35,7 +50,7 @@ pyenv_build_test_bundle() {
3550
# hack
3651
# move target/$TARGET/release to target/release to make
3752
# it easier to locate for py dist. See trust_pypi_example.py
38-
if [ ! -d "target/$TARGET/release" ]; then
53+
if [ ! -d "target/${TARGET}/release" ]; then
3954
echo "Cannot find release dir at target/$TARGET/release"
4055
exit 2
4156
else
@@ -66,13 +81,25 @@ if [ -z ${TARGET+x} ]; then
6681
echo "TARGET is not set. Defaulting to x86_64-unknown-linux-gnu"
6782
export TARGET='x86_64-unknown-linux-gnu'
6883
# This is for local testing. You can change the default to match your system.
69-
7084
else
7185
echo "TARGET is $TARGET"
7286
fi
7387

7488

75-
if [ $TRAVIS_OS_NAME = "osx" ]; then
89+
if [ -z ${RUSTRELEASE+x} ]; then
90+
if [ ! -z ${TRAVIS_BUILD_NUMBER+x} ]; then
91+
echo "RUSTRELEASE not set but it looks like this is running on Travis."
92+
exit 2
93+
fi
94+
echo "RUSTRELEASE is not set. Defaulting to stable"
95+
export RUSTRELEASE=stable
96+
# This is for local testing. You can change the default to match your system.
97+
else
98+
echo "RUSTRELEASE is $RUSTRELEASE"
99+
fi
100+
101+
102+
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
76103
pyenv_build_test_bundle
77104
else
78105
manylinux_linux

0 commit comments

Comments
 (0)