gitlab-ci: make android release build succeed (#9743)

* use docker cargo config file for android builds

* make android build succeed
This commit is contained in:
gabriel klawitter 2018-11-06 20:26:05 +01:00 committed by GitHub
parent 1a642fc624
commit f6dcca3ebb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 18 deletions

View File

@ -9,8 +9,6 @@ image: parity/rust:gitlab-ci
variables: variables:
CI_SERVER_NAME: "GitLab CI" CI_SERVER_NAME: "GitLab CI"
CARGO_HOME: "${CI_PROJECT_DIR}/.cargo" CARGO_HOME: "${CI_PROJECT_DIR}/.cargo"
BUILD_TARGET: ubuntu
BUILD_ARCH: amd64
CARGO_TARGET: x86_64-unknown-linux-gnu CARGO_TARGET: x86_64-unknown-linux-gnu
cache: cache:

View File

@ -6,18 +6,23 @@ set -u # treat unset variables as error
echo "__________Show ENVIROMENT__________" echo "__________Show ENVIROMENT__________"
echo "CI_SERVER_NAME: " $CI_SERVER_NAME echo "CI_SERVER_NAME: " $CI_SERVER_NAME
echo "CARGO_HOME: " $CARGO_HOME echo "CARGO_HOME: " $CARGO_HOME
echo "BUILD_TARGET: " $BUILD_TARGET
echo "BUILD_ARCH: " $BUILD_ARCH
echo "CARGO_TARGET: " $CARGO_TARGET echo "CARGO_TARGET: " $CARGO_TARGET
echo "CC: " $CC echo "CC: " $CC
echo "CXX: " $CXX echo "CXX: " $CXX
echo "__________CARGO CONFIG__________" echo "__________CARGO CONFIG__________"
if [ "${CARGO_TARGET}" = "armv7-linux-androideabi" ]
then
# use build container's cargo config
cat /.cargo/config
else
mkdir -p .cargo mkdir -p .cargo
rm -f .cargo/config rm -f .cargo/config
echo "[target.$CARGO_TARGET]" >> .cargo/config echo "[target.$CARGO_TARGET]" >> .cargo/config
echo "linker= \"$CC\"" >> .cargo/config echo "linker= \"$CC\"" >> .cargo/config
cat .cargo/config cat .cargo/config
fi
echo "_____ Building target: "$CARGO_TARGET" _____" echo "_____ Building target: "$CARGO_TARGET" _____"
time cargo build --target $CARGO_TARGET --release --features final time cargo build --target $CARGO_TARGET --release --features final
@ -32,15 +37,31 @@ mkdir -p artifacts
cd artifacts cd artifacts
mkdir -p $CARGO_TARGET mkdir -p $CARGO_TARGET
cd $CARGO_TARGET cd $CARGO_TARGET
cp ../../target/$CARGO_TARGET/release/parity ./parity cp -v ../../target/$CARGO_TARGET/release/parity ./parity
cp ../../target/$CARGO_TARGET/release/parity-evm ./parity-evm cp -v ../../target/$CARGO_TARGET/release/parity-evm ./parity-evm
cp ../../target/$CARGO_TARGET/release/ethstore ./ethstore cp -v ../../target/$CARGO_TARGET/release/ethstore ./ethstore
cp ../../target/$CARGO_TARGET/release/ethkey ./ethkey cp -v ../../target/$CARGO_TARGET/release/ethkey ./ethkey
cp ../../target/$CARGO_TARGET/release/whisper ./whisper cp -v ../../target/$CARGO_TARGET/release/whisper ./whisper
# stripping can also be done on release build time
# export RUSTFLAGS="${RUSTFLAGS} -C link-arg=-s"
if [ "${CARGO_TARGET}" = "armv7-linux-androideabi" ]
then
arm-linux-androideabi-strip -v ./*
else
strip -v ./* strip -v ./*
fi
echo "_____ Calculating checksums _____" echo "_____ Calculating checksums _____"
for binary in $(ls) for binary in $(ls)
do do
rhash --sha256 $binary -o $binary.sha256 rhash --sha256 $binary -o $binary.sha256
if [ "${CARGO_TARGET}" = "armv7-linux-androideabi" ]
then
echo "> ${binary} cannot be hashed with cross-compiled binary"
else
./parity tools hash $binary > $binary.sha3 ./parity tools hash $binary > $binary.sha3
fi
done done

View File

@ -8,8 +8,6 @@ set LIB="C:\vs2015\VC\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.
echo "__________Show ENVIROMENT__________" echo "__________Show ENVIROMENT__________"
echo "CI_SERVER_NAME: " $CI_SERVER_NAME echo "CI_SERVER_NAME: " $CI_SERVER_NAME
echo "CARGO_HOME: " $CARGO_HOME echo "CARGO_HOME: " $CARGO_HOME
echo "BUILD_TARGET: " $BUILD_TARGET
echo "BUILD_ARCH: " $BUILD_ARCH
echo "CARGO_TARGET: " $CARGO_TARGET echo "CARGO_TARGET: " $CARGO_TARGET
echo "_____ Building target: "$CARGO_TARGET" _____" echo "_____ Building target: "$CARGO_TARGET" _____"