From 8926b43d492941362d2da7a78a6268c03b6237ad Mon Sep 17 00:00:00 2001 From: "Denis S. Soldatov aka General-Beck" Date: Sat, 2 Jun 2018 05:13:28 +0300 Subject: [PATCH] add missed scripts --- scripts/gitlab/build-unix.sh | 32 +++ scripts/gitlab/build-windows.sh | 25 ++ scripts/{gitlab-build.sh => gitlab/build.sh} | 253 ++++++++++-------- scripts/gitlab/clippy.sh | 7 + scripts/gitlab/coverage.sh | 23 ++ scripts/gitlab/install-readme.sh | 8 + scripts/gitlab/msbuild.cmd | 1 + scripts/gitlab/package-macos.sh | 19 ++ scripts/gitlab/package-snap.sh | 25 ++ scripts/gitlab/package-unix.sh | 35 +++ scripts/gitlab/package-windows.sh | 27 ++ scripts/gitlab/publish-docker.sh | 22 ++ scripts/gitlab/publish-snap.sh | 18 ++ scripts/gitlab/push-binaries.sh | 25 ++ scripts/gitlab/push-github.sh | 38 +++ .../push-release.sh} | 0 scripts/gitlab/rustfmt.sh | 7 + scripts/gitlab/sign.cmd | 1 + scripts/gitlab/templates/release-table.md | 16 ++ .../gitlab/templates/snapcraft.template.yaml | 54 ++++ scripts/gitlab/test-qemu.sh | 10 + scripts/gitlab/test.sh | 28 ++ scripts/gitlab/uninstall-parity.sh | 4 + 23 files changed, 559 insertions(+), 119 deletions(-) create mode 100644 scripts/gitlab/build-unix.sh create mode 100644 scripts/gitlab/build-windows.sh rename scripts/{gitlab-build.sh => gitlab/build.sh} (70%) mode change 100755 => 100644 create mode 100644 scripts/gitlab/clippy.sh create mode 100644 scripts/gitlab/coverage.sh create mode 100644 scripts/gitlab/install-readme.sh create mode 100644 scripts/gitlab/msbuild.cmd create mode 100644 scripts/gitlab/package-macos.sh create mode 100644 scripts/gitlab/package-snap.sh create mode 100644 scripts/gitlab/package-unix.sh create mode 100644 scripts/gitlab/package-windows.sh create mode 100644 scripts/gitlab/publish-docker.sh create mode 100644 scripts/gitlab/publish-snap.sh create mode 100644 scripts/gitlab/push-binaries.sh create mode 100644 scripts/gitlab/push-github.sh rename scripts/{gitlab-push-release.sh => gitlab/push-release.sh} (100%) mode change 100755 => 100644 create mode 100644 scripts/gitlab/rustfmt.sh create mode 100644 scripts/gitlab/sign.cmd create mode 100644 scripts/gitlab/templates/release-table.md create mode 100644 scripts/gitlab/templates/snapcraft.template.yaml create mode 100644 scripts/gitlab/test-qemu.sh create mode 100644 scripts/gitlab/test.sh create mode 100644 scripts/gitlab/uninstall-parity.sh diff --git a/scripts/gitlab/build-unix.sh b/scripts/gitlab/build-unix.sh new file mode 100644 index 000000000..55f69e507 --- /dev/null +++ b/scripts/gitlab/build-unix.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error +echo "__________Show ENVIROMENT__________" +echo "CC: " $CC +echo "CXX: " $CXX + +echo "__________CARGO CONFIG__________" +rm -rf .cargo +mkdir -p .cargo +echo "[target.$CARGO_TARGET]" >> .cargo/config +echo "linker= \"$CC\"" >> .cargo/config +cat .cargo/config + +echo "_____ Building target: "$CARGO_TARGET" _____" +time cargo build --target $CARGO_TARGET --release --features final +time cargo build --target $CARGO_TARGET --release -p evmbin +time cargo build --target $CARGO_TARGET --release -p ethstore-cli +time cargo build --target $CARGO_TARGET --release -p ethkey-cli + +echo "_____ Post-processing binaries _____" +rm -rf artifacts +mkdir -p artifacts +cd artifacts +cp ../target/$CARGO_TARGET/release/{parity,parity-evm,ethstore,ethkey} . +strip -v ./* +echo "_____ Calculating checksums _____" +for binary in $(ls) +do + rhash --sha256 $binary -o $binary.sha256 +done diff --git a/scripts/gitlab/build-windows.sh b/scripts/gitlab/build-windows.sh new file mode 100644 index 000000000..e3631e6d4 --- /dev/null +++ b/scripts/gitlab/build-windows.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -e # fail on any error +set -u # treat unset variables as error + +set INCLUDE="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;C:\vs2015\VC\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt" +set LIB="C:\vs2015\VC\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64" + +rustup default stable-x86_64-pc-windows-msvc +echo "_____ Building _____" +time cargo build --target $CARGO_TARGET --release --features final +time cargo build --target $CARGO_TARGET --release -p evmbin +time cargo build --target $CARGO_TARGET --release -p ethstore-cli +time cargo build --target $CARGO_TARGET --release -p ethkey-cli + +echo "_____ Post-processing binaries _____" +rm -rf artifacts +mkdir -p artifacts +cd artifacts +cp --verbose ../target/$CARGO_TARGET/release/{parity,parity-evm,ethstore,ethkey}.exe . + +echo "_____ Calculating checksums _____" +for binary in $(ls) +do + rhash --sha256 $binary -o $binary.unsigned.sha256 +done diff --git a/scripts/gitlab-build.sh b/scripts/gitlab/build.sh old mode 100755 new mode 100644 similarity index 70% rename from scripts/gitlab-build.sh rename to scripts/gitlab/build.sh index 2f1b7b8d0..5721a8d16 --- a/scripts/gitlab-build.sh +++ b/scripts/gitlab/build.sh @@ -1,7 +1,5 @@ #!/bin/bash - set -e # fail on any error -set -u # treat unset variables as error #ARGUMENTS: 1. BUILD_PLATFORM (target for binaries) 2. PLATFORM (target for cargo) 3. ARC (architecture) 4. & 5. CC & CXX flags 6. binary identifier BUILD_PLATFORM=$1 PLATFORM=$2 @@ -20,6 +18,7 @@ echo "Architecture: " $ARC echo "Libssl version: " $LIBSSL echo "Parity version: " $VER echo "Branch: " $CI_BUILD_REF_NAME +echo "Protect? " $protect echo "--------------------" # NOTE for md5 and sha256 we want to display filename as well @@ -28,7 +27,7 @@ MD5_BIN="rhash --md5" SHA256_BIN="rhash --sha256" set_env () { - echo "Set ENVIROMENT" + echo "__________Set ENVIROMENT__________" export HOST_CC=gcc export HOST_CXX=g++ rm -rf .cargo @@ -48,42 +47,31 @@ set_env_win () { echo "@ signtool sign /f "\%"1 /p "\%"2 /tr http://timestamp.comodoca.com /du https://parity.io "\%"3" > sign.cmd } build () { - if [[ "windows" = $IDENT ]] - then - # This is a nasty hack till we figure out the proper cargo caching strategy - echo "Remove index" - rm -rf cargo/registry/index/*. - fi - echo "Build parity:" - cargo build --target $PLATFORM --features final --release - echo "Build evmbin:" - cargo build --target $PLATFORM --release -p evmbin - echo "Build ethstore-cli:" - cargo build --target $PLATFORM --release -p ethstore-cli - echo "Build ethkey-cli:" - cargo build --target $PLATFORM --release -p ethkey-cli - echo "Build whisper-cli:" - cargo build --target $PLATFORM --release -p whisper-cli + echo "__________Build parity__________" + time cargo build --target $PLATFORM --features final --release + echo "__________Build evmbin__________" + time cargo build --target $PLATFORM --release -p evmbin + echo "__________Build ethstore-cli__________" + time cargo build --target $PLATFORM --release -p ethstore-cli + echo "__________Build ethkey-cli__________" + time cargo build --target $PLATFORM --release -p ethkey-cli } strip_binaries () { - echo "Strip binaries:" + echo "__________Strip binaries__________" $STRIP_BIN -v target/$PLATFORM/release/parity $STRIP_BIN -v target/$PLATFORM/release/parity-evm $STRIP_BIN -v target/$PLATFORM/release/ethstore - $STRIP_BIN -v target/$PLATFORM/release/ethkey - $STRIP_BIN -v target/$PLATFORM/release/whisper; + $STRIP_BIN -v target/$PLATFORM/release/ethkey; } calculate_checksums () { - echo "Checksum calculation:" + echo "__________Checksum calculation__________" rhash --version - rm -rf *.md5 rm -rf *.sha256 - BIN="target/$PLATFORM/release/parity$S3WIN" export SHA3="$($BIN tools hash $BIN)" - - echo "Parity file SHA3: $SHA3" + echo "__________Parity file SHA3__________" + echo $SHA3 $MD5_BIN target/$PLATFORM/release/parity$S3WIN > parity$S3WIN.md5 $SHA256_BIN target/$PLATFORM/release/parity$S3WIN > parity$S3WIN.sha256 $MD5_BIN target/$PLATFORM/release/parity-evm$S3WIN > parity-evm$S3WIN.md5 @@ -92,12 +80,10 @@ calculate_checksums () { $SHA256_BIN target/$PLATFORM/release/ethstore$S3WIN > ethstore$S3WIN.sha256 $MD5_BIN target/$PLATFORM/release/ethkey$S3WIN > ethkey$S3WIN.md5 $SHA256_BIN target/$PLATFORM/release/ethkey$S3WIN > ethkey$S3WIN.sha256 - $MD5_BIN target/$PLATFORM/release/whisper$S3WIN > whisper$S3WIN.md5 - $SHA256_BIN target/$PLATFORM/release/whisper$S3WIN > whisper$S3WIN.sha256 } make_deb () { rm -rf deb - echo "create DEBIAN files" + echo "__________Create DEBIAN files__________" mkdir -p deb/usr/bin/ mkdir -p deb/DEBIAN echo "create copyright, docs, compat" @@ -122,24 +108,23 @@ make_deb () { echo "Description: Ethereum network client by Parity Technologies" >> $control size=`du deb/|awk 'END {print $1}'` echo "Installed-Size: $size" >> $control - echo "build .deb package" + echo "__________Build .deb package__________" cp target/$PLATFORM/release/parity deb/usr/bin/parity cp target/$PLATFORM/release/parity-evm deb/usr/bin/parity-evm cp target/$PLATFORM/release/ethstore deb/usr/bin/ethstore cp target/$PLATFORM/release/ethkey deb/usr/bin/ethkey - cp target/$PLATFORM/release/whisper deb/usr/bin/whisper dpkg-deb -b deb "parity_"$VER"_"$IDENT"_"$ARC".deb" $MD5_BIN "parity_"$VER"_"$IDENT"_"$ARC".deb" > "parity_"$VER"_"$IDENT"_"$ARC".deb.md5" $SHA256_BIN "parity_"$VER"_"$IDENT"_"$ARC".deb" > "parity_"$VER"_"$IDENT"_"$ARC".deb.sha256" } make_rpm () { rm -rf /install + echo "__________Create RPM package__________" mkdir -p /install/usr/bin cp target/$PLATFORM/release/parity /install/usr/bin cp target/$PLATFORM/release/parity-evm /install/usr/bin/parity-evm cp target/$PLATFORM/release/ethstore /install/usr/bin/ethstore cp target/$PLATFORM/release/ethkey /install/usr/bin/ethkey - cp target/$PLATFORM/release/whisper /install/usr/bin/whisper rm -rf "parity-"$VER"-1."$ARC".rpm" || true fpm -s dir -t rpm -n parity -v $VER --epoch 1 --license GPLv3 -d openssl --provides parity --url https://parity.io --vendor "Parity Technologies" -a x86_64 -m "" --description "Ethereum network client by Parity Technologies" -C /install/ @@ -148,12 +133,11 @@ make_rpm () { $SHA256_BIN "parity_"$VER"_"$IDENT"_"$ARC".rpm" > "parity_"$VER"_"$IDENT"_"$ARC".rpm.sha256" } make_pkg () { - echo "make PKG" + echo "__________Make OSX PKG__________" cp target/$PLATFORM/release/parity target/release/parity cp target/$PLATFORM/release/parity-evm target/release/parity-evm cp target/$PLATFORM/release/ethstore target/release/ethstore cp target/$PLATFORM/release/ethkey target/release/ethkey - cp target/$PLATFORM/release/whisper target/release/whisper cd mac xcodebuild -configuration Release cd .. @@ -164,11 +148,13 @@ make_pkg () { $SHA256_BIN "parity_"$VER"_"$IDENT"_"$ARC"."$EXT >> "parity_"$VER"_"$IDENT"_"$ARC".pkg.sha256" } sign_exe () { + if [[ -z "$protect" ]]; then echo "__________Skipping sign binaries__________"&&return; fi ./sign.cmd $keyfile $certpass "target/$PLATFORM/release/parity.exe" + ./sign.cmd $keyfile $certpass windows/ptray/x64/release/ptray.exe } make_exe () { ./msbuild.cmd - ./sign.cmd $keyfile $certpass windows/ptray/x64/release/ptray.exe + sign_exe cd nsis curl -sL --url "https://github.com/paritytech/win-build/raw/master/vc_redist.x64.exe" -o vc_redist.x64.exe echo "makensis.exe installer.nsi" > nsis.cmd @@ -179,8 +165,71 @@ make_exe () { $MD5_BIN "parity_"$VER"_"$IDENT"_"$ARC"."$EXT -p %h > "parity_"$VER"_"$IDENT"_"$ARC"."$EXT".md5" $SHA256_BIN "parity_"$VER"_"$IDENT"_"$ARC"."$EXT -p %h > "parity_"$VER"_"$IDENT"_"$ARC"."$EXT".sha256" } +push_snap () { + if [[ -z "$protect" ]]; then echo "__________Skipping push and release snap__________"&&return; fi + snapcraft_login=$(expect -c " + spawn snapcraft login + expect \"Email:\" + send \"$SNAP_EMAIL\n\" + expect \"Password:\" + send \"$SNAP_PASS\n\" + expect \"\$\" + ") + echo "$snapcraft_login" + snapcraft push "parity_"$VER"_"$ARC".snap" >> push.log + cat push.log + REVISION="$(grep -m 1 "Revision " push.log | awk '{print $2}')" + echo "__________Revision__________" + echo $REVISION + sleep 120 + if [[ "$CI_BUILD_REF_NAME" = "beta" || "$VER" == *1.9* ]]; + then + snapcraft release parity_"$VER"_"$ARC".snap $REVISION beta + snapcraft release parity_"$VER"_"$ARC".snap $REVISION candidate; + fi + if [[ "$CI_BUILD_REF_NAME" = "nightly" ]]; + then + snapcraft release parity_"$VER"_"$ARC".snap $REVISION edge; + fi + if [[ "$CI_BUILD_REF_NAME" = "beta" || "$VER" == *1.8* ]]; + then + snapcraft release parity_"$VER"_"$ARC".snap $REVISION stable; + fi + snapcraft status parity + snapcraft logout +} +make_snap () { + export HOST_CC=gcc + export HOST_CXX=g++ + apt install -y expect zip rhash + snapcraft clean + echo "__________ Prepare snapcraft.yaml for build on Gitlab CI in Docker image __________" + sed -i 's/git/'"$VER"'/g' snap/snapcraft.yaml + if [[ "$CI_BUILD_REF_NAME" = "beta" || "$VER" == *1.9* ]]; + then + sed -i -e 's/grade: devel/grade: stable/' snap/snapcraft.yaml; + fi + if [[ "$ARC" = "i386" ]]; + then + export ARCH=i686&&ln -s /usr/bin/gcc /usr/bin/i386-linux-gnu-gcc; + fi + mv -f snap/snapcraft.yaml snapcraft.yaml + snapcraft --target-arch=$ARC -d + echo "__________Build comlete__________" + push_snap + echo "__________Checksum calculation__________" + $MD5_BIN "parity_"$VER"_"$ARC".snap" > "parity_"$VER"_"$ARC".snap.md5" + $SHA256_BIN "parity_"$VER"_"$ARC".snap" > "parity_"$VER"_"$ARC".snap.sha256" + echo "__________Copy all artifacts to one place__________" + rm -rf artifacts + mkdir -p artifacts + cp "parity_"$VER"_"$ARC".snap" artifacts + cp "parity_"$VER"_"$ARC".snap.md5" artifacts + cp "parity_"$VER"_"$ARC".snap.sha256" artifacts +} push_binaries () { - echo "Push binaries to AWS S3" + if [[ -z "$protect" ]]; then echo "__________Skipping push to S3__________"&&return; fi + echo "__________Push binaries to AWS S3__________" aws configure set aws_access_key_id $s3_key aws configure set aws_secret_access_key $s3_secret if [[ "$CI_BUILD_REF_NAME" = "master" || "$CI_BUILD_REF_NAME" = "beta" || "$CI_BUILD_REF_NAME" = "stable" || "$CI_BUILD_REF_NAME" = "nightly" ]]; @@ -202,54 +251,58 @@ push_binaries () { aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethkey$S3WIN --body target/$PLATFORM/release/ethkey$S3WIN aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethkey$S3WIN.md5 --body ethkey$S3WIN.md5 aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethkey$S3WIN.sha256 --body ethkey$S3WIN.sha256 - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/whisper$S3WIN --body target/$PLATFORM/release/whisper$S3WIN - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/whisper$S3WIN.md5 --body whisper$S3WIN.md5 - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/whisper$S3WIN.sha256 --body whisper$S3WIN.sha256 aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/"parity_"$VER"_"$IDENT"_"$ARC"."$EXT --body "parity_"$VER"_"$IDENT"_"$ARC"."$EXT aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/"parity_"$VER"_"$IDENT"_"$ARC"."$EXT".md5" --body "parity_"$VER"_"$IDENT"_"$ARC"."$EXT".md5" aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/"parity_"$VER"_"$IDENT"_"$ARC"."$EXT".sha256" --body "parity_"$VER"_"$IDENT"_"$ARC"."$EXT".sha256" } -make_archive () { - echo "add artifacts to archive" - rm -rf parity.zip - zip -r parity.zip target/$PLATFORM/release/parity$S3WIN target/$PLATFORM/release/parity-evm$S3WIN target/$PLATFORM/release/ethstore$S3WIN target/$PLATFORM/release/ethkey$S3WIN target/$PLATFORM/release/whisper$S3WIN parity$S3WIN.md5 parity-evm$S3WIN.md5 ethstore$S3WIN.md5 ethkey$S3WIN.md5 whisper$S3WIN.md5 parity$S3WIN.sha256 parity-evm$S3WIN.sha256 ethstore$S3WIN.sha256 ethkey$S3WIN.sha256 whisper$S3WIN.sha256 +prepare_artifacts () { + echo "__________Copy all artifacts to one place__________" + rm -rf artifacts + mkdir -p artifacts + cp target/$PLATFORM/release/parity$S3WIN artifacts + cp target/$PLATFORM/release/parity-evm$S3WIN artifacts + cp target/$PLATFORM/release/ethstore$S3WIN artifacts + cp target/$PLATFORM/release/ethkey$S3WIN parity$S3WIN.md5 artifacts + cp parity-evm$S3WIN.md5 ethstore$S3WIN.md5 artifacts + cp ethkey$S3WIN.md5 artifacts + cp parity$S3WIN.sha256 artifacts + cp parity-evm$S3WIN.sha256 artifacts + cp ethstore$S3WIN.sha256 artifacts + cp ethkey$S3WIN.sha256 artifacts } - updater_push_release () { - echo "push release" - + echo "__________Build comlete__________" + if [[ -z "$protect" ]]; then echo "__________Skipping push release__________"&&return; fi + echo "__________Push release___________" DATA="commit=$CI_BUILD_REF&sha3=$SHA3&filename=parity$S3WIN&secret=$RELEASES_SECRET" # Mainnet source scripts/safe_curl.sh $DATA "http://update.parity.io:1337/push-build/$CI_BUILD_REF_NAME/$BUILD_PLATFORM" # Kovan source scripts/safe_curl.sh $DATA "http://update.parity.io:1338/push-build/$CI_BUILD_REF_NAME/$BUILD_PLATFORM" } - +build_and_push () { + build + strip_binaries + calculate_checksums + make_deb + prepare_artifacts + push_binaries + updater_push_release +} case $BUILD_PLATFORM in x86_64-unknown-linux-gnu) #set strip bin STRIP_BIN="strip" #package extention EXT="deb" - build - strip_binaries - calculate_checksums - make_deb - make_archive - push_binaries - updater_push_release + build_and_push ;; x86_64-unknown-debian-gnu) STRIP_BIN="strip" EXT="deb" LIBSSL="libssl1.1 (>=1.1.0)" - echo "Use libssl1.1 (>=1.1.0) for Debian builds" - build - strip_binaries - calculate_checksums - make_deb - make_archive - push_binaries + echo "__________Use libssl1.1 (>=1.1.0) for Debian builds__________" + build_and_push ;; x86_64-unknown-centos-gnu) STRIP_BIN="strip" @@ -258,52 +311,33 @@ case $BUILD_PLATFORM in strip_binaries calculate_checksums make_rpm - make_archive + prepare_artifacts push_binaries + updater_push_release ;; i686-unknown-linux-gnu) STRIP_BIN="strip" EXT="deb" set_env - build - strip_binaries - calculate_checksums - make_deb - make_archive - push_binaries + build_and_push ;; armv7-unknown-linux-gnueabihf) STRIP_BIN="arm-linux-gnueabihf-strip" EXT="deb" set_env - build - strip_binaries - calculate_checksums - make_deb - make_archive - push_binaries + build_and_push ;; arm-unknown-linux-gnueabihf) STRIP_BIN="arm-linux-gnueabihf-strip" EXT="deb" set_env - build - strip_binaries - calculate_checksums - make_deb - make_archive - push_binaries + build_and_push ;; aarch64-unknown-linux-gnu) STRIP_BIN="aarch64-linux-gnu-strip" EXT="deb" set_env - build - strip_binaries - calculate_checksums - make_deb - make_archive - push_binaries + build_and_push ;; x86_64-apple-darwin) STRIP_BIN="strip" @@ -313,41 +347,22 @@ case $BUILD_PLATFORM in strip_binaries calculate_checksums make_pkg - make_archive + prepare_artifacts push_binaries updater_push_release ;; x86_64-unknown-snap-gnu) - ARC="amd64" - EXT="snap" - apt update - apt install -y expect zip rhash - snapcraft clean - echo "Prepare snapcraft.yaml for build on Gitlab CI in Docker image" - sed -i 's/git/'"$VER"'/g' snap/snapcraft.yaml - if [[ "$CI_BUILD_REF_NAME" = "beta" || "$VER" == *1.11* ]]; - then - sed -i -e 's/grade: devel/grade: stable/' snap/snapcraft.yaml; - fi - mv -f snap/snapcraft.yaml snapcraft.yaml - snapcraft -d - snapcraft_login=$(expect -c " - spawn snapcraft login - expect \"Email:\" - send \"$SNAP_EMAIL\n\" - expect \"Password:\" - send \"$SNAP_PASS\n\" - expect \"\$\" - ") - echo "$snapcraft_login" - snapcraft push "parity_"$VER"_amd64.snap" - snapcraft status parity - snapcraft logout - $MD5_BIN "parity_"$VER"_amd64.snap" > "parity_"$VER"_amd64.snap.md5" - $SHA256_BIN "parity_"$VER"_amd64.snap" > "parity_"$VER"_amd64.snap.sha256" - echo "add artifacts to archive" - rm -rf parity.zip - zip -r parity.zip "parity_"$VER"_amd64.snap" "parity_"$VER"_amd64.snap.md5" "parity_"$VER"_amd64.snap.sha256" + make_snap + ;; + i686-unknown-snap-gnu) + set_env + make_snap + ;; + arm64-unknown-snap-gnu) + make_snap + ;; + armhf-unknown-snap-gnu) + make_snap ;; x86_64-pc-windows-msvc) set_env_win @@ -357,7 +372,7 @@ case $BUILD_PLATFORM in sign_exe calculate_checksums make_exe - make_archive + prepare_artifacts push_binaries updater_push_release esac diff --git a/scripts/gitlab/clippy.sh b/scripts/gitlab/clippy.sh new file mode 100644 index 000000000..aef39c29f --- /dev/null +++ b/scripts/gitlab/clippy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error + +cargo install clippy +cargo clippy -- -D warnings diff --git a/scripts/gitlab/coverage.sh b/scripts/gitlab/coverage.sh new file mode 100644 index 000000000..e3371f142 --- /dev/null +++ b/scripts/gitlab/coverage.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -x +git submodule update --init --recursive +rm -rf target/* +cargo test --all --exclude evmjit --no-run || exit $? +KCOV_TARGET="target/cov" +KCOV_FLAGS="--verify" +EXCLUDE="/usr/lib,/usr/include,$HOME/.cargo,$HOME/.multirust,rocksdb,secp256k1" +mkdir -p $KCOV_TARGET +echo "__________Cover RUST___________" +for FILE in `find target/debug/deps ! -name "*.*"` + do + timeout --signal=SIGKILL 5m kcov --exclude-pattern $EXCLUDE $KCOV_FLAGS $KCOV_TARGET $FILE + done +timeout --signal=SIGKILL 5m kcov --exclude-pattern $EXCLUDE $KCOV_FLAGS $KCOV_TARGET target/debug/parity-* +echo "Cover JS" +cd ../../js +npm install&&npm run test:coverage +cd .. +bash <(curl -s https://codecov.io/bash)&& +echo "Uploaded code coverage" +exit 0 diff --git a/scripts/gitlab/install-readme.sh b/scripts/gitlab/install-readme.sh new file mode 100644 index 000000000..531bae9b7 --- /dev/null +++ b/scripts/gitlab/install-readme.sh @@ -0,0 +1,8 @@ +echo "Parity Wallet +============= + +Welcome to Parity Wallet, your all-in-one Ethereum node and wallet. + +If you continue, Parity will be installed as a user service. You will be able to use the Parity Wallet through your browser by using the menu bar icon, following the shortcut in the Launchpad or navigating to http://localhost:8180/ in your browser. + +Parity is distributed under the terms of the GPL." diff --git a/scripts/gitlab/msbuild.cmd b/scripts/gitlab/msbuild.cmd new file mode 100644 index 000000000..16d23cfcf --- /dev/null +++ b/scripts/gitlab/msbuild.cmd @@ -0,0 +1 @@ +MsBuild.exe windows\ptray\ptray.vcxproj /p:Platform=x64 /p:Configuration=Release diff --git a/scripts/gitlab/package-macos.sh b/scripts/gitlab/package-macos.sh new file mode 100644 index 000000000..42fa7f38c --- /dev/null +++ b/scripts/gitlab/package-macos.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error +OSX_PACKAGE="parity_"$VERSION"_macos_x86_64.pkg" +echo "__________Create MacOS package__________" +cd mac +xcodebuild -configuration Release +cd .. +packagesbuild -v mac/Parity.pkgproj +echo "__________Sign Package__________" +find . -name \*.pkg +productsign --sign 'Developer ID Installer: PARITY TECHNOLOGIES LIMITED (P2PX3JU8FT)' Parity\ Ethereum.pkg $OSX_PACKAGE +echo "__________Move package to artifacts__________" +mkdir -p packages +mv -v $OSX_PACKAGE packages/$OSX_PACKAGE +cd packages +echo "_____ Calculating checksums _____" +rhash --sha256 "parity_"$VERSION"_macos_x86_64.pkg" >> "parity_"$VERSION"_macos_x86_64.pkg.sha256" diff --git a/scripts/gitlab/package-snap.sh b/scripts/gitlab/package-snap.sh new file mode 100644 index 000000000..c3e5b0045 --- /dev/null +++ b/scripts/gitlab/package-snap.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error +case ${CI_COMMIT_REF_NAME} in + master|*v1.12*|gitlab-next) export GRADE="devel";; + beta|*v1.11*) export GRADE="stable";; + stable|*v1.10*) export GRADE="stable";; + *) echo "No release" exit 0;; +esac +SNAP_PACKAGE="parity_"$VERSION"_"$BUILD_ARCH".snap" +echo "__________Create snap package__________" +echo "Release channel :" $GRADE " Branch/tag: " $CI_COMMIT_REF_NAME +snapcraft clean +echo $VERSION:$GRADE:$BUILD_ARCH +cat scripts/gitlab/templates/snapcraft.template.yaml | envsubst '$VERSION:$GRADE:$BUILD_ARCH' > snapcraft.yaml +cat snapcraft.yaml +snapcraft --target-arch=$BUILD_ARCH +ls *.snap +echo "__________Post-processing snap package__________" +mkdir -p packages +mv -v $SNAP_PACKAGE "packages/"$SNAP_PACKAGE +echo "_____ Calculating checksums _____" +cd packages +rhash --sha256 $SNAP_PACKAGE -o $SNAP_PACKAGE".sha256" diff --git a/scripts/gitlab/package-unix.sh b/scripts/gitlab/package-unix.sh new file mode 100644 index 000000000..e43d2a8d2 --- /dev/null +++ b/scripts/gitlab/package-unix.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error + +rm -rf /install +mkdir -p packages +echo "__________Create "$PKG" package__________" +PACKAGE="parity_"$VERSION"_"$IDENT"_"$BUILD_ARCH"."$PKG +mkdir -p /install/usr/bin +cp artifacts/parity /install/usr/bin +cp artifacts/parity-evm /install/usr/bin/parity-evm +cp artifacts/ethstore /install/usr/bin/ethstore +cp artifacts/ethkey /install/usr/bin/ethkey +cp scripts/gitlab/uninstall-parity.sh /install/usr/bin/uninstall-parity.sh +fpm --input-type dir \ +--output-type $PKG \ +--name parity \ +--version $VERSION \ +--license GPLv3 \ +--depends "$LIBSSL" \ +--provides parity \ +--url https://parity.io \ +--vendor "Parity Technologies" \ +--architecture $BUILD_ARCH \ +--maintainer "" \ +--description "Ethereum network client by Parity Technologies" \ +--before-install scripts/gitlab/install-readme.sh \ +--before-upgrade scripts/gitlab/uninstall-parity.sh \ +--after-remove scripts/gitlab/uninstall-parity.sh \ +-C /install \ +-p packages/$PACKAGE +echo "_____ Calculating checksums _____" +cd packages +rhash --sha256 $PACKAGE > $PACKAGE".sha256" diff --git a/scripts/gitlab/package-windows.sh b/scripts/gitlab/package-windows.sh new file mode 100644 index 000000000..d83bd2e4d --- /dev/null +++ b/scripts/gitlab/package-windows.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e # fail on any error +set -u # treat unset variables as error + +VERSION=$(grep -m 1 "version =" Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n") +echo "__________Create Windows package__________" +scripts/gitlab/msbuild.cmd +echo "__________Sign binaries__________" +scripts/gitlab/sign.cmd $keyfile $certpass artifacts/parity.exe +scripts/gitlab/sign.cmd $keyfile $certpass windows/ptray/x64/release/ptray.exe +echo "__________Create Windows installer__________" +cd nsis +curl -sL --url "https://github.com/paritytech/win-build/raw/master/vc_redist.x64.exe" -o vc_redist.x64.exe +echo "makensis.exe installer.nsi" > nsis.cmd +./nsis.cmd +cd .. +echo "__________Move package to artifacts__________" +mkdir -p packages +cp nsis/installer.exe packages/"parity_"$VERSION"_windows_x86_64.exe" +echo "__________Sign installer__________" +scripts/gitlab/sign.cmd $keyfile $certpass packages/"parity_"$VERSION"_windows_x86_64.exe" +echo "_____ Calculating checksums _____" +cd packages +for binary in $(ls) +do + rhash --sha256 $binary -o $binary.sha256 +done diff --git a/scripts/gitlab/publish-docker.sh b/scripts/gitlab/publish-docker.sh new file mode 100644 index 000000000..41c2e3db4 --- /dev/null +++ b/scripts/gitlab/publish-docker.sh @@ -0,0 +1,22 @@ +#!/bin/bash +##ARGUMENTS: 1. Docker target +set -e # fail on any error +set -u # treat unset variables as error + +if [ "$CI_COMMIT_REF_NAME" == "beta" ]; +then export DOCKER_BUILD_TAG="latest"; +else export DOCKER_BUILD_TAG=$CI_COMMIT_REF_NAME; +fi +docker login -u $Docker_Hub_User_Parity -p $Docker_Hub_Pass_Parity + +echo "__________Docker TAG__________" +echo $DOCKER_BUILD_TAG + +echo "__________Docker target__________" +export DOCKER_TARGET=$1 +echo $DOCKER_TARGET + +echo "__________Docker build and push__________" +docker build --build-arg TARGET=$DOCKER_TARGET --no-cache=true --tag parity/$DOCKER_TARGET:$DOCKER_BUILD_TAG -f docker/hub/Dockerfile . +docker push parity/$DOCKER_TARGET:$DOCKER_BUILD_TAG +docker logout diff --git a/scripts/gitlab/publish-snap.sh b/scripts/gitlab/publish-snap.sh new file mode 100644 index 000000000..6e6f7ef47 --- /dev/null +++ b/scripts/gitlab/publish-snap.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error + +case ${CI_COMMIT_REF_NAME} in + master|*v1.12*|gitlab-next) export CHANNEL="edge";; + beta|*v1.11*) export CHANNEL="beta";; + stable|*v1.10*) export CHANNEL="stable";; + *) echo "No release" exit 0;; +esac +echo "Release channel :" $CHANNEL " Branch/tag: " $CI_COMMIT_REF_NAME + +echo $SNAPCRAFT_LOGIN_PARITY_BASE64 | base64 --decode > snapcraft.login +snapcraft login --with snapcraft.login +snapcraft push --release $CHANNEL "packages/parity_"$VERSION"_"$BUILD_ARCH".snap" +snapcraft status parity +snapcraft logout diff --git a/scripts/gitlab/push-binaries.sh b/scripts/gitlab/push-binaries.sh new file mode 100644 index 000000000..5c15b7ccf --- /dev/null +++ b/scripts/gitlab/push-binaries.sh @@ -0,0 +1,25 @@ +echo "__________Push binaries to AWS S3__________" +aws configure set aws_access_key_id $s3_key +aws configure set aws_secret_access_key $s3_secret +if [[ "$CI_BUILD_REF_NAME" = "master" || "$CI_BUILD_REF_NAME" = "beta" || "$CI_BUILD_REF_NAME" = "stable" || "$CI_BUILD_REF_NAME" = "nightly" ]]; +then + export S3_BUCKET=builds-parity-published; +else + export S3_BUCKET=builds-parity; +fi +aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/$BUILD_PLATFORM +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/parity$S3WIN --body target/$PLATFORM/release/parity$S3WIN +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/parity$S3WIN.md5 --body parity$S3WIN.md5 +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/parity$S3WIN.sha256 --body parity$S3WIN.sha256 +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/parity-evm$S3WIN --body target/$PLATFORM/release/parity-evm$S3WIN +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/parity-evm$S3WIN.md5 --body parity-evm$S3WIN.md5 +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/parity-evm$S3WIN.sha256 --body parity-evm$S3WIN.sha256 +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethstore$S3WIN --body target/$PLATFORM/release/ethstore$S3WIN +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethstore$S3WIN.md5 --body ethstore$S3WIN.md5 +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethstore$S3WIN.sha256 --body ethstore$S3WIN.sha256 +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethkey$S3WIN --body target/$PLATFORM/release/ethkey$S3WIN +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethkey$S3WIN.md5 --body ethkey$S3WIN.md5 +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethkey$S3WIN.sha256 --body ethkey$S3WIN.sha256 +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/"parity_"$VER"_"$IDENT"_"$ARC"."$EXT --body "parity_"$VER"_"$IDENT"_"$ARC"."$EXT +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/"parity_"$VER"_"$IDENT"_"$ARC"."$EXT".md5" --body "parity_"$VER"_"$IDENT"_"$ARC"."$EXT".md5" +aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/"parity_"$VER"_"$IDENT"_"$ARC"."$EXT".sha256" --body "parity_"$VER"_"$IDENT"_"$ARC"."$EXT".sha256" diff --git a/scripts/gitlab/push-github.sh b/scripts/gitlab/push-github.sh new file mode 100644 index 000000000..9106c91db --- /dev/null +++ b/scripts/gitlab/push-github.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error +echo "__________Set ENVIROMENT__________" +DOWNLOAD_PREFIX="https://github.com/General-Beck/parity/releases/download/"$CI_COMMIT_REF_NAME"/" +DESCRIPTION="$(cat CHANGELOG.md)" +RELEASE_TABLE="$(cat scripts/gitlab/templates/release-table.md)" +RELEASE_TABLE="$(echo "${RELEASE_TABLE//\$VERSION/${VERSION}}")" +RELEASE_TABLE="$(echo "${RELEASE_TABLE//\$DOWNLOAD_PREFIX/${DOWNLOAD_PREFIX}}")" +#The text in the file CANGELOG.md before which the table with links is inserted. Must be present in this file necessarily +REPLACE_TEXT="The full list of included changes:" +case ${CI_COMMIT_REF_NAME} in + master|*v1.12*|nightly) NAME="Parity "$VERSION" nightly";; + beta|*v1.11*) NAME="Parity "$VERSION" beta";; + stable|*v1.10*) NAME="Parity "$VERSION" stable";; + *) echo "No release" exit 0;; +esac +cd packages +i=1 +for binary in $(ls *.sha256) +do + sha256=$(cat $binary | awk '{ print $1}' ) + RELEASE_TABLE="$(echo "${RELEASE_TABLE/sha${i}/${sha256}}")" + let ++i +done +#do not touch the following 3 lines. Features of output in Markdown +DESCRIPTION="$(echo "${DESCRIPTION/${REPLACE_TEXT}/${RELEASE_TABLE} + +${REPLACE_TEXT}}")" +echo "__________Create release to Github____________" +github-release release --user "$GITHUB_USER" --repo parity --tag "$CI_COMMIT_REF_NAME" --draft --name "$NAME" --description "$DESCRIPTION" +echo "__________Upload files to Github____________" + +for binary in $(ls -I "*.sha256") +do + github-release upload --user "$GITHUB_USER" --repo parity --tag "$CI_COMMIT_REF_NAME" --replace --name "$binary" --file $binary +done diff --git a/scripts/gitlab-push-release.sh b/scripts/gitlab/push-release.sh old mode 100755 new mode 100644 similarity index 100% rename from scripts/gitlab-push-release.sh rename to scripts/gitlab/push-release.sh diff --git a/scripts/gitlab/rustfmt.sh b/scripts/gitlab/rustfmt.sh new file mode 100644 index 000000000..447d66f24 --- /dev/null +++ b/scripts/gitlab/rustfmt.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error + +cargo install rustfmt-nightly +cargo fmt -- --write-mode=diff diff --git a/scripts/gitlab/sign.cmd b/scripts/gitlab/sign.cmd new file mode 100644 index 000000000..2b014a023 --- /dev/null +++ b/scripts/gitlab/sign.cmd @@ -0,0 +1 @@ +@signtool sign /f %1 /p %2 /tr http://timestamp.comodoca.com /du https://parity.io %3 diff --git a/scripts/gitlab/templates/release-table.md b/scripts/gitlab/templates/release-table.md new file mode 100644 index 000000000..8dc639397 --- /dev/null +++ b/scripts/gitlab/templates/release-table.md @@ -0,0 +1,16 @@ +| OS | Arch | Download | SHA256 Checksum | +|:---:|:---:|:---|:---| +| Linux Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | x64 | [parity_$VERSION_centos_x86_64.rpm]($DOWNLOAD_PREFIXparity_$VERSION_centos_x86_64.rpm) | `sha1` | +| Linux Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | x64 | [parity_$VERSION_debian_amd64.deb]($DOWNLOAD_PREFIXx86_64-unknown-debian-gnu/parity_$VERSION_debian_amd64.deb) | `sha2` | +| Apple Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | x64 | [parity_$VERSION_macos_macos.pkg]($DOWNLOAD_PREFIXx86_64-apple-darwin/parity_$VERSION_macos_macos.pkg) | `sha3` | +| Linux Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | x64 | [parity_$VERSION_ubuntu_amd64.deb]($DOWNLOAD_PREFIXx86_64-unknown-linux-gnu/parity_$VERSION_ubuntu_amd64.deb) | `sha4` | +| Linux Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | arm64 | [parity_$VERSION_ubuntu_arm64.deb]($DOWNLOAD_PREFIXaarch64-unknown-linux-gnu/parity_$VERSION_ubuntu_arm64.deb) | `sha5` | +| Linux Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | armv7 | [parity_$VERSION_ubuntu_armhf.deb]($DOWNLOAD_PREFIXarmv7-unknown-linux-gnueabihf/parity_$VERSION_ubuntu_armhf.deb) | `sha6` | +| Windows Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | x64 | [parity_$VERSION_windows_x86_64.exe]($DOWNLOAD_PREFIXx86_64-pc-windows-msvc/parity_$VERSION_windows_x86_64.exe) | `sha7` | + +| OS | Alternative | Link | +|:---:|:---:|:---| +| Apple Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | Homebrew |[github.com/paritytech/homebrew-paritytech/blob/master/README.md](https://github.com/paritytech/homebrew-paritytech/blob/master/README.md) | +| Linux Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | Snapcraft | [snapcraft.io/parity](https://snapcraft.io/parity/) | +| Settings Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | Docker | [hub.docker.com/r/parity/parity](https://hub.docker.com/r/parity/parity) | +| Settings Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | Other binaries | [vanity-service.parity.io/parity-binaries?format=markdown&version=$VERSION](https://vanity-service.parity.io/parity-binaries?format=markdown&version=$VERSION) | diff --git a/scripts/gitlab/templates/snapcraft.template.yaml b/scripts/gitlab/templates/snapcraft.template.yaml new file mode 100644 index 000000000..951fc7780 --- /dev/null +++ b/scripts/gitlab/templates/snapcraft.template.yaml @@ -0,0 +1,54 @@ +name: parity +version: $VERSION +architectures: [$BUILD_ARCH] +grade: $GRADE +confinement: strict + +summary: Fast, light, robust Ethereum implementation +description: | + Parity's goal is to be the fastest, lightest, and most secure Ethereum + client. We are developing Parity using the sophisticated and cutting-edge + Rust programming language. Parity is licensed under the GPLv3, and can be + used for all your Ethereum needs. + + +apps: + parity: + command: parity + plugs: [home, network, network-bind, mount-observe, x11, unity7, desktop, desktop-legacy, wayland] + desktop: usr/share/applications/parity.desktop + parity-evm: + command: parity-evm + plugs: [home, network, network-bind] + ethkey: + command: ethkey + plugs: [home] + ethstore: + command: ethstore + plugs: [home] + +icon: snap/gui/icon.png + +parts: + desktop-icon: + source: ./snap + plugin: nil + override-build: | + mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/applications + mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/pixmaps + cp -v gui/parity.desktop $SNAPCRAFT_PART_INSTALL/usr/share/applications/ + cp -v gui/icon.png $SNAPCRAFT_PART_INSTALL/usr/share/pixmaps/ + parity: + source: ./artifacts + plugin: nil + override-build: | + mkdir -p $SNAPCRAFT_PART_INSTALL/usr/bin + cp -v parity $SNAPCRAFT_PART_INSTALL/usr/bin/parity + cp -v parity-evm $SNAPCRAFT_PART_INSTALL/usr/bin/parity-evm + cp -v ethkey $SNAPCRAFT_PART_INSTALL/usr/bin/ethkey + cp -v ethstore $SNAPCRAFT_PART_INSTALL/usr/bin/ethstore + stage-packages: [libc6, libssl1.0.0, libudev1, libstdc++6] + df: + plugin: nil + stage-packages: [coreutils] + stage: [bin/df] diff --git a/scripts/gitlab/test-qemu.sh b/scripts/gitlab/test-qemu.sh new file mode 100644 index 000000000..a7b57ed70 --- /dev/null +++ b/scripts/gitlab/test-qemu.sh @@ -0,0 +1,10 @@ +#!/bin/bash +##ARGUMENTS: 1. Docker target +set -e # fail on any error +set -u # treat unset variables as error + +docker pull parity/rust-qemu:armhf +echo "Test wasmi on armhf" +docker run -it --rm -v /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static parity/rust-qemu:armhf \ +bash `git clone https://github.com/paritytech/parity.git&&\ +cd parity&&./test.sh&&cd ..&&rm -rf parity/` diff --git a/scripts/gitlab/test.sh b/scripts/gitlab/test.sh new file mode 100644 index 000000000..be48c52cc --- /dev/null +++ b/scripts/gitlab/test.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# ARGUMENT $1 Rust flavor to test with (stable/beta/nightly) + +set -e # fail on any error +set -u # treat unset variables as error + +rustup default $1 + +if [[ "$CI_COMMIT_REF_NAME" = "beta" || "$CI_COMMIT_REF_NAME" = "stable" ]]; then + export GIT_COMPARE=$CI_COMMIT_REF_NAME~; +else + export GIT_COMPARE=master; +fi + +export RUST_FILES_MODIFIED="$(git --no-pager diff --name-only $GIT_COMPARE...$CI_COMMIT_SHA | grep -v -e ^\\. -e ^LICENSE -e ^README.md -e ^test.sh -e ^windows/ -e ^scripts/ -e ^mac/ -e ^nsis/ | wc -l)" +echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED" + +git submodule update --init --recursive +rustup show +if [[ "${RUST_FILES_MODIFIED}" == "0" ]]; +then echo "__________Skipping Rust tests since no Rust files modified__________"; +else ./test.sh || exit $?; +fi + +# if [[ "$CI_COMMIT_REF_NAME" == "nightly" ]]; +# ### @TODO re-enable fail after https://github.com/paritytech/parity-import-tests/issues/3 +# then sh scripts/aura-test.sh; # || exit $?; +# fi diff --git a/scripts/gitlab/uninstall-parity.sh b/scripts/gitlab/uninstall-parity.sh new file mode 100644 index 000000000..cae406c44 --- /dev/null +++ b/scripts/gitlab/uninstall-parity.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +sudo killall -9 parity && sleep 5 +sudo rm -f /usr/bin/parity /usr/bin/uninstall-parity.sh /usr/bin/ethstore /usr/bin/ethkey /usr/bin/parity-evm