From bd3bc5c16837ae3d25bd834e04e2b469fada351d Mon Sep 17 00:00:00 2001 From: "Denis S. Soldatov aka General-Beck" Date: Sun, 26 Aug 2018 02:44:08 +0400 Subject: [PATCH] Updating the CI system (#8765) * Updating the CI system with the publication of releases and binary files on github Signed-off-by: Denis S. Soldatov aka General-Beck * add missed scripts * chmod +x scripts * fix download link for github * rebuilding CI scripts * small fixes * update submodule wasm tests * ci: fix merge leftovers * ci: remove gitlab-next from ci triggers * ci: fix git add in docs script * ci: use nightly instead of master for publish triggers * ci: remove sleep from gitlab config * ci: replace ':' with '-' in gitlab targets * ci: fix recursive copy in docs script --- .gitlab-ci.yml | 464 ++++++++++-------- docker/hub/Dockerfile | 79 +-- scripts/cov.sh | 31 -- scripts/docker-build.sh | 11 - scripts/gitlab-build.sh | 234 --------- scripts/gitlab-push-release.sh | 12 - scripts/gitlab-test.sh | 47 -- scripts/gitlab/build-unix.sh | 35 ++ scripts/gitlab/build-windows.sh | 35 ++ scripts/gitlab/clippy.sh | 7 + scripts/gitlab/coverage.sh | 20 + scripts/gitlab/install-readme.sh | 8 + scripts/gitlab/package-snap.sh | 25 + scripts/gitlab/publish-docker.sh | 22 + scripts/gitlab/publish-snap.sh | 18 + scripts/gitlab/push.sh | 67 +++ scripts/gitlab/rpc-docs.sh | 54 ++ scripts/gitlab/rustfmt.sh | 7 + scripts/{ => gitlab}/safe_curl.sh | 0 scripts/gitlab/sign.cmd | 1 + scripts/gitlab/templates/release-table.md | 16 + .../gitlab/templates/snapcraft.template.yaml | 58 +++ scripts/gitlab/test.sh | 28 ++ snap/snapcraft.yaml | 41 -- test.sh | 10 +- 25 files changed, 686 insertions(+), 644 deletions(-) delete mode 100755 scripts/cov.sh delete mode 100755 scripts/docker-build.sh delete mode 100755 scripts/gitlab-build.sh delete mode 100755 scripts/gitlab-push-release.sh delete mode 100755 scripts/gitlab-test.sh create mode 100755 scripts/gitlab/build-unix.sh create mode 100755 scripts/gitlab/build-windows.sh create mode 100755 scripts/gitlab/clippy.sh create mode 100755 scripts/gitlab/coverage.sh create mode 100755 scripts/gitlab/install-readme.sh create mode 100755 scripts/gitlab/package-snap.sh create mode 100755 scripts/gitlab/publish-docker.sh create mode 100755 scripts/gitlab/publish-snap.sh create mode 100755 scripts/gitlab/push.sh create mode 100755 scripts/gitlab/rpc-docs.sh create mode 100755 scripts/gitlab/rustfmt.sh rename scripts/{ => gitlab}/safe_curl.sh (100%) create mode 100755 scripts/gitlab/sign.cmd create mode 100644 scripts/gitlab/templates/release-table.md create mode 100644 scripts/gitlab/templates/snapcraft.template.yaml create mode 100755 scripts/gitlab/test.sh delete mode 100644 snap/snapcraft.yaml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ac3e44892..856cdafc9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,242 +1,296 @@ stages: - test - - push-release - build + - package + - publish - docs + +image: parity/rust:gitlab-ci + variables: - RUST_BACKTRACE: "1" - RUSTFLAGS: "" - CARGOFLAGS: "" - CI_SERVER_NAME: "GitLab CI" + CI_SERVER_NAME: "GitLab CI" + CARGO_HOME: "${CI_PROJECT_DIR}/cargo" + + BUILD_TARGET: ubuntu + BUILD_ARCH: amd64 + CARGO_TARGET: x86_64-unknown-linux-gnu + cache: - key: "$CI_BUILD_STAGE-$CI_BUILD_REF_NAME" + key: "${CI_JOB_NAME}" paths: - - target/ - untracked: true -linux-amd64: - stage: build - image: parity/rust:gitlab-ci - only: + - ${CI_PROJECT_DIR}/target/ + - ${CI_PROJECT_DIR}/cargo/ + +.releaseable_branches: # list of git refs for building GitLab artifacts (think "pre-release binaries") + only: &releaseable_branches + - master + - stable - beta - tags - - stable - - triggers + +.publishable_branches: # list of git refs for publishing builds to the "production" locations + only: &publishable_branches + - nightly # Our nightly builds from schedule, on `master` + - "v2*" # Our version tags + +.collect_artifacts: &collect_artifacts + artifacts: + name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" + when: on_success + expire_in: 1 mos + paths: + - artifacts/ + +.determine_version: &determine_version | + export VERSION=$(grep -m 1 "version =" Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n") + echo "Version" $VERSION + + +#### stage: test + +test-rust-stable: &test + stage: test script: - - rustup default stable - # ARGUMENTS: 1. BUILD_PLATFORM (target for binaries) 2. PLATFORM (target for cargo) 3. ARC (architecture) 4. & 5. CC & CXX flags 6. binary identifier - - scripts/gitlab-build.sh x86_64-unknown-linux-gnu x86_64-unknown-linux-gnu amd64 gcc g++ linux + - scripts/gitlab/test.sh stable tags: - rust-stable - artifacts: - paths: - - parity.zip - name: "stable-x86_64-unknown-linux-gnu_parity" -linux-i686: - stage: build - image: parity/rust-i686:gitlab-ci + +.optional_test: &optional_test + <<: *test + allow_failure: true only: - - beta - - tags - - stable - - triggers + - master + +test-rust-beta: + <<: *optional_test script: - - scripts/gitlab-build.sh i686-unknown-linux-gnu i686-unknown-linux-gnu i386 gcc g++ linux + - scripts/gitlab/test.sh beta + +test-rust-nightly: + <<: *optional_test + script: + - scripts/gitlab/test.sh nightly + +test-lint-rustfmt: + <<: *optional_test + script: + - scripts/gitlab/rustfmt.sh + +test-lint-clippy: + <<: *optional_test + script: + - scripts/gitlab/clippy.sh + +test-coverage-kcov: + stage: test + only: + - master + script: + - scripts/gitlab/coverage.sh tags: - - rust-i686 - artifacts: - paths: - - parity.zip - name: "i686-unknown-linux-gnu" - allow_failure: true -linux-armv7: - stage: build - image: parity/rust-armv7:gitlab-ci - only: - - beta - - tags - - stable - - triggers + - shell + allow_failure: true + + +#### stage: build + +build-linux-ubuntu-amd64: &build + stage: build + only: *releaseable_branches + variables: + CARGO_TARGET: x86_64-unknown-linux-gnu script: - - scripts/gitlab-build.sh armv7-unknown-linux-gnueabihf armv7-unknown-linux-gnueabihf armhf arm-linux-gnueabihf-gcc arm-linux-gnueabihf-g++ linux - tags: - - rust-arm - artifacts: - paths: - - parity.zip - name: "armv7_unknown_linux_gnueabihf_parity" - allow_failure: true -linux-armhf: - stage: build - image: parity/rust-arm:gitlab-ci - only: - - beta - - tags - - stable - - triggers - script: - - scripts/gitlab-build.sh arm-unknown-linux-gnueabihf arm-unknown-linux-gnueabihf armhf arm-linux-gnueabihf-gcc arm-linux-gnueabihf-g++ linux - tags: - - rust-arm - artifacts: - paths: - - parity.zip - name: "arm-unknown-linux-gnueabihf_parity" - allow_failure: true -linux-aarch64: - stage: build - image: parity/rust-arm64:gitlab-ci - only: - - beta - - tags - - stable - - triggers - script: - - scripts/gitlab-build.sh aarch64-unknown-linux-gnu aarch64-unknown-linux-gnu arm64 aarch64-linux-gnu-gcc aarch64-linux-gnu-g++ linux - tags: - - rust-arm - artifacts: - paths: - - parity.zip - name: "aarch64-unknown-linux-gnu_parity" -linux-snap: - stage: build - image: parity/snapcraft:gitlab-ci - only: - - stable - - beta - - tags - - triggers - script: - - scripts/gitlab-build.sh x86_64-unknown-snap-gnu x86_64-unknown-linux-gnu amd64 gcc g++ snap + - scripts/gitlab/build-unix.sh + <<: *collect_artifacts tags: - rust-stable - artifacts: - paths: - - parity.zip - name: "stable-x86_64-unknown-snap-gnu_parity" -darwin: - stage: build - only: - - beta - - tags - - stable - - triggers - script: - - scripts/gitlab-build.sh x86_64-apple-darwin x86_64-apple-darwin macos gcc g++ macos + allow_failure: true + +build-linux-ubuntu-i386: + <<: *build + image: parity/rust-i686:gitlab-ci + variables: + CARGO_TARGET: i686-unknown-linux-gnu + +build-linux-ubuntu-arm64: + <<: *build + image: parity/rust-arm64:gitlab-ci + variables: + CARGO_TARGET: aarch64-unknown-linux-gnu + +build-linux-ubuntu-armhf: + <<: *build + image: parity/rust-armv7:gitlab-ci + variables: + CARGO_TARGET: armv7-unknown-linux-gnueabihf + +build-linux-android-armhf: + <<: *build + image: parity/rust-android:gitlab-ci + variables: + CARGO_TARGET: armv7-linux-androideabi + +build-darwin-macos-x86_64: + <<: *build + variables: + CARGO_TARGET: x86_64-apple-darwin + CC: gcc + CXX: g++ tags: - osx - artifacts: - paths: - - parity.zip - name: "x86_64-apple-darwin_parity" -windows: + <<: *collect_artifacts + +build-windows-msvc-x86_64: + stage: build + only: *releaseable_branches cache: - key: "%CI_BUILD_STAGE%-%CI_BUILD_REF_NAME%" - untracked: true - stage: build - only: - - beta - - tags - - stable - - triggers + key: "%CI_JOB_NAME%" + paths: + - "%CI_PROJECT_DIR%/target/" + - "%CI_PROJECT_DIR%/cargo/" + # No cargo caching, since fetch-locking on Windows gets stuck + variables: + CARGO_TARGET: x86_64-pc-windows-msvc script: - - sh scripts/gitlab-build.sh x86_64-pc-windows-msvc x86_64-pc-windows-msvc amd64 "" "" windows + - sh scripts/gitlab/build-windows.sh tags: - rust-windows - artifacts: - paths: - - parity.zip - name: "x86_64-pc-windows-msvc_parity" -android-armv7: - stage: build - image: parity/parity-android:latest - only: - - beta - - tags - - stable - - triggers - script: - - cargo build --target=armv7-linux-androideabi - tags: - - rust-arm - allow_failure: true - artifacts: - paths: - - parity.zip - name: "armv7-linux-androideabi_parity" -docker-build: - stage: build - only: - - tags - - master - - beta - - stable - - triggers + <<: *collect_artifacts + + +#### stage: package + +package-linux-snap-amd64: &package_snap + stage: package + only: *releaseable_branches + cache: {} before_script: - - docker info + - *determine_version + variables: + CARGO_TARGET: x86_64-unknown-linux-gnu + dependencies: + - build-linux-ubuntu-amd64 script: - - if [ "$CI_BUILD_REF_NAME" == "master" ]; then DOCKER_TAG="latest"; else DOCKER_TAG=$CI_BUILD_REF_NAME; fi - - echo "Tag:" $DOCKER_TAG - - docker login -u $Docker_Hub_User_Parity -p $Docker_Hub_Pass_Parity - - scripts/docker-build.sh $DOCKER_TAG - - docker logout - tags: - - docker -test-coverage: - stage: test - only: - - master - script: - - scripts/gitlab-test.sh test-coverage - tags: - - kcov - allow_failure: true -test-rust-stable: - stage: test - image: parity/rust:gitlab-ci - script: - - scripts/gitlab-test.sh stable + - scripts/gitlab/package-snap.sh tags: - rust-stable -test-rust-beta: - stage: test - only: - - triggers - - master - image: parity/rust:gitlab-ci + <<: *collect_artifacts + +package-linux-snap-i386: + <<: *package_snap + variables: + BUILD_ARCH: i386 + CARGO_TARGET: i686-unknown-linux-gnu + dependencies: + - build-linux-ubuntu-i386 + +package-linux-snap-arm64: + <<: *package_snap + variables: + BUILD_ARCH: arm64 + CARGO_TARGET: aarch64-unknown-linux-gnu + dependencies: + - build-linux-ubuntu-arm64 + +package-linux-snap-armhf: + <<: *package_snap + variables: + BUILD_ARCH: armhf + CARGO_TARGET: armv7-unknown-linux-gnueabihf + dependencies: + - build-linux-ubuntu-armhf + + +#### stage: publish + +publish-linux-snap-amd64: &publish_snap + stage: publish + only: *publishable_branches + image: snapcore/snapcraft:stable + cache: {} + before_script: + - *determine_version + variables: + BUILD_ARCH: amd64 + dependencies: + - package-linux-snap-amd64 script: - - scripts/gitlab-test.sh beta + - scripts/gitlab/publish-snap.sh tags: - - rust-beta - allow_failure: true -test-rust-nightly: - stage: test - only: - - triggers - - master - image: parity/rust:gitlab-ci + - rust-stable + +publish-linux-snap-i386: + <<: *publish_snap + before_script: + - *determine_version + variables: + BUILD_ARCH: i386 + dependencies: + - package-linux-snap-i386 + +publish-linux-snap-arm64: + <<: *publish_snap + before_script: + - *determine_version + variables: + BUILD_ARCH: arm64 + dependencies: + - package-linux-snap-arm64 + +publish-linux-snap-armhf: + <<: *publish_snap + before_script: + - *determine_version + variables: + BUILD_ARCH: armhf + dependencies: + - package-linux-snap-armhf + +publish-docker-parity-amd64: &publish_docker + stage: publish + only: *publishable_branches + cache: {} + dependencies: + - build-linux-ubuntu-amd64 + tags: + - shell + allow_failure: true script: - - scripts/gitlab-test.sh nightly + - scripts/gitlab/publish-docker.sh parity + +publish-docker-parityevm-amd64: + <<: *publish_docker + script: + - scripts/gitlab/publish-docker.sh parity-evm + +publish-github-and-s3: + stage: publish + only: *publishable_branches + cache: {} + dependencies: + - build-linux-ubuntu-amd64 + - build-linux-ubuntu-i386 + - build-linux-ubuntu-armhf + - build-linux-ubuntu-arm64 + - build-darwin-macos-x86_64 + - build-windows-msvc-x86_64 + before_script: + - *determine_version + script: + - scripts/gitlab/push.sh tags: - - rust - - rust-nightly - allow_failure: true -json-rpc-docs: + - shell + allow_failure: true + + +####stage: docs + +docs-rpc-json: stage: docs only: - tags - image: parity/rust:gitlab-ci + cache: {} script: - - scripts/gitlab-rpc-docs.sh + - scripts/gitlab/rpc-docs.sh tags: - - docs -push-release: - stage: push-release - only: - - tags - - triggers - image: parity/rust:gitlab-ci - script: - - scripts/gitlab-push-release.sh - tags: - - curl + - shell diff --git a/docker/hub/Dockerfile b/docker/hub/Dockerfile index eb007dc10..4eec8cfc6 100644 --- a/docker/hub/Dockerfile +++ b/docker/hub/Dockerfile @@ -1,64 +1,27 @@ FROM ubuntu:xenial MAINTAINER Parity Technologies -WORKDIR /build -#ENV for build TAG -ARG BUILD_TAG -ENV BUILD_TAG ${BUILD_TAG:-master} -RUN echo "Build tag:" $BUILD_TAG +#set ENVIROMENT +ARG TARGET +ENV TARGET ${TARGET} + # install tools and dependencies -RUN apt-get update && \ - apt-get install -y --force-yes --no-install-recommends \ - # make - build-essential \ - # add-apt-repository - software-properties-common \ - make \ - cmake \ - curl \ - wget \ - git \ - g++ \ - gcc \ - libc6 \ - libc6-dev \ - binutils \ - file \ - libudev-dev \ - pkg-config \ - dpkg-dev &&\ -# install rustup - curl https://sh.rustup.rs -sSf | sh -s -- -y && \ -# rustup directory - PATH=/root/.cargo/bin:$PATH && \ +RUN apt update && apt install -y --no-install-recommends openssl libudev-dev file + # show backtraces - RUST_BACKTRACE=1 && \ -# build parity -cd /build&&git clone https://github.com/paritytech/parity-ethereum && \ - cd parity-ethereum&& \ - git pull&& \ - git checkout $BUILD_TAG && \ - cargo build --verbose --release --features final && \ - strip /build/parity-ethereum/target/release/parity && \ - file /build/parity-ethereum/target/release/parity&&mkdir -p /parity&& cp /build/parity-ethereum/target/release/parity /parity&&\ +ENV RUST_BACKTRACE 1 + #cleanup Docker image - rm -rf /root/.cargo&&rm -rf /root/.multirust&&rm -rf /root/.rustup&&rm -rf /build&&\ - apt-get purge -y \ - # make - build-essential \ - # add-apt-repository - software-properties-common \ - make \ - cmake \ - curl \ - wget \ - git \ - g++ \ - gcc \ - binutils \ - file \ - pkg-config \ - dpkg-dev &&\ - rm -rf /var/lib/apt/lists/* +RUN apt autoremove -y +RUN apt clean -y +RUN rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* + +#add TARGET to docker image +COPY artifacts/x86_64-unknown-linux-gnu/$TARGET /usr/bin/$TARGET + +# Build a shell script because the ENTRYPOINT command doesn't like using ENV +RUN echo "#!/bin/bash \n ${TARGET} \$@" > ./entrypoint.sh +RUN chmod +x ./entrypoint.sh + # setup ENTRYPOINT -EXPOSE 8080 8545 8180 -ENTRYPOINT ["/parity/parity"] +EXPOSE 5001 8080 8082 8083 8545 8546 8180 30303/tcp 30303/udp +ENTRYPOINT ["./entrypoint.sh"] diff --git a/scripts/cov.sh b/scripts/cov.sh deleted file mode 100755 index b6d25c692..000000000 --- a/scripts/cov.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -# Installing KCOV under ubuntu -# https://users.rust-lang.org/t/tutorial-how-to-collect-test-coverages-for-rust-project/650# -### Install deps -# $ sudo apt-get install libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc binutils-dev libiberty-dev -# -### Compile kcov -# $ wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && tar xf master.tar.gz -# $ cd kcov-master && mkdir build && cd build -# $ cmake .. && make && sudo make install - -### Running coverage - -set -x -RUSTFLAGS="-C link-dead-code" cargo test --all --no-run || exit $? -KCOV_TARGET="target/cov" -KCOV_FLAGS="--verify" -mkdir -p $KCOV_TARGET -echo "Cover RUST" -for FILE in `find target/debug/deps ! -name "*.*"` -do - timeout --signal=SIGKILL 5m kcov --include-path=$(pwd) --exclude-path=$(pwd)/target $KCOV_FLAGS $KCOV_TARGET $FILE -done -timeout --signal=SIGKILL 5m kcov --include-path=$(pwd) --exclude-path=$(pwd)/target $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/docker-build.sh b/scripts/docker-build.sh deleted file mode 100755 index b880d33b7..000000000 --- a/scripts/docker-build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -cd docker/hub -DOCKER_BUILD_TAG=$1 -echo "Docker build tag: " $DOCKER_BUILD_TAG -if [[ "$DOCKER_BUILD_TAG" = "latest" ]]; then - docker build --build-arg BUILD_TAG="master" --no-cache=true --tag parity/parity:$DOCKER_BUILD_TAG . -else - docker build --build-arg BUILD_TAG=$DOCKER_BUILD_TAG --no-cache=true --tag parity/parity:$DOCKER_BUILD_TAG . -fi -docker run -it parity/parity:$DOCKER_BUILD_TAG -v -docker push parity/parity:$DOCKER_BUILD_TAG diff --git a/scripts/gitlab-build.sh b/scripts/gitlab-build.sh deleted file mode 100755 index 014cab8e6..000000000 --- a/scripts/gitlab-build.sh +++ /dev/null @@ -1,234 +0,0 @@ -#!/usr/bin/env 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 -ARC=$3 -CC=$4 -CXX=$5 -IDENT=$6 -VER="$(grep -m 1 "version =" Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")" -S3WIN="" -echo "--------------------" -echo "Build for platform: " $BUILD_PLATFORM -echo "Build identifier: " $IDENT -echo "Cargo target: " $PLATFORM -echo "CC&CXX flags: " $CC ", " $CXX -echo "Architecture: " $ARC -echo "Parity version: " $VER -echo "Branch: " $CI_BUILD_REF_NAME -echo "--------------------" - -# NOTE for sha256 we want to display filename as well -# hence we use --* instead of -p * -SHA256_BIN="rhash --sha256" - -set_env () { - echo "Set ENVIROMENT" - export HOST_CC=gcc - export HOST_CXX=g++ - rm -rf .cargo - mkdir -p .cargo - echo "[target.$PLATFORM]" >> .cargo/config - echo "linker= \"$CC\"" >> .cargo/config - cat .cargo/config -} -set_env_win () { - set PLATFORM=x86_64-pc-windows-msvc - 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" - set RUST_BACKTRACE=1 - #export RUSTFLAGS=$RUSTFLAGS - rustup default stable-x86_64-pc-windows-msvc - 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 -} -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; -} -calculate_checksums () { - echo "Checksum calculation:" - rhash --version - - rm -rf *.sha256 - - BIN="target/$PLATFORM/release/parity$S3WIN" - export SHA3="$($BIN tools hash $BIN)" - - echo "Parity file SHA3: $SHA3" - $SHA256_BIN target/$PLATFORM/release/parity$S3WIN > parity$S3WIN.sha256 - $SHA256_BIN target/$PLATFORM/release/parity-evm$S3WIN > parity-evm$S3WIN.sha256 - $SHA256_BIN target/$PLATFORM/release/ethstore$S3WIN > ethstore$S3WIN.sha256 - $SHA256_BIN target/$PLATFORM/release/ethkey$S3WIN > ethkey$S3WIN.sha256 - $SHA256_BIN target/$PLATFORM/release/whisper$S3WIN > whisper$S3WIN.sha256 -} -sign_exe () { - ./sign.cmd $keyfile $certpass "target/$PLATFORM/release/parity.exe" - ./sign.cmd $keyfile $certpass "target/$PLATFORM/release/parity-evm.exe" - ./sign.cmd $keyfile $certpass "target/$PLATFORM/release/ethstore.exe" - ./sign.cmd $keyfile $certpass "target/$PLATFORM/release/ethkey.exe" - ./sign.cmd $keyfile $certpass "target/$PLATFORM/release/whisper.exe" -} -push_binaries () { - 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" = "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.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.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.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.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.sha256 --body whisper$S3WIN.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.sha256 parity-evm$S3WIN.sha256 ethstore$S3WIN.sha256 ethkey$S3WIN.sha256 whisper$S3WIN.sha256 -} - -updater_push_release () { - 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" -} - -case $BUILD_PLATFORM in - x86_64-unknown-linux-gnu) - #set strip bin - STRIP_BIN="strip" - #package extention - build - strip_binaries - calculate_checksums - make_archive - push_binaries - updater_push_release - ;; - i686-unknown-linux-gnu) - STRIP_BIN="strip" - set_env - build - strip_binaries - calculate_checksums - make_archive - push_binaries - ;; - armv7-unknown-linux-gnueabihf) - STRIP_BIN="arm-linux-gnueabihf-strip" - set_env - build - strip_binaries - calculate_checksums - make_archive - push_binaries - ;; - arm-unknown-linux-gnueabihf) - STRIP_BIN="arm-linux-gnueabihf-strip" - set_env - build - strip_binaries - calculate_checksums - make_archive - push_binaries - ;; - aarch64-unknown-linux-gnu) - STRIP_BIN="aarch64-linux-gnu-strip" - set_env - build - strip_binaries - calculate_checksums - make_archive - push_binaries - ;; - x86_64-apple-darwin) - STRIP_BIN="strip" - PLATFORM="x86_64-apple-darwin" - build - strip_binaries - calculate_checksums - make_archive - 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" = "stable" || "$CI_BUILD_REF_NAME" = "beta" || "$VER" == *1.11* || "$VER" == *2.0* ]]; - 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 - $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.sha256" - ;; - x86_64-pc-windows-msvc) - set_env_win - EXT="exe" - S3WIN=".exe" - build - sign_exe - calculate_checksums - make_archive - push_binaries - updater_push_release -esac diff --git a/scripts/gitlab-push-release.sh b/scripts/gitlab-push-release.sh deleted file mode 100755 index 207d66c11..000000000 --- a/scripts/gitlab-push-release.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -e # fail on any error -set -u # treat unset variables as error - -DATA="secret=$RELEASES_SECRET" - -echo "Pushing release to Mainnet" -./scripts/safe_curl.sh $DATA "http://update.parity.io:1337/push-release/$CI_BUILD_REF_NAME/$CI_BUILD_REF" - -echo "Pushing release to Kovan" -./scripts/safe_curl.sh $DATA "http://update.parity.io:1338/push-release/$CI_BUILD_REF_NAME/$CI_BUILD_REF" diff --git a/scripts/gitlab-test.sh b/scripts/gitlab-test.sh deleted file mode 100755 index fbd93167a..000000000 --- a/scripts/gitlab-test.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -#ARGUMENT test for RUST and COVERAGE -set -e # fail on any error -set -u # treat unset variables as error -if [[ "$CI_COMMIT_REF_NAME" = "master" || "$CI_COMMIT_REF_NAME" = "beta" || "$CI_COMMIT_REF_NAME" = "stable" ]]; then - export GIT_COMPARE=$CI_COMMIT_REF_NAME~; -else - export GIT_COMPARE=master; -fi -git fetch -a -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/ -e ^docs/ | wc -l)" -echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED" -TEST_SWITCH=$1 -rust_test () { - 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 -} -coverage_test () { - git submodule update --init --recursive - rm -rf target/* - scripts/cov.sh -} -case $TEST_SWITCH in - stable ) - rustup default stable - rust_test - ;; - beta) - rustup default beta - rust_test - ;; - nightly) - rustup default nightly - rust_test - ;; - test-coverage) - coverage_test - ;; -esac diff --git a/scripts/gitlab/build-unix.sh b/scripts/gitlab/build-unix.sh new file mode 100755 index 000000000..50ae7314c --- /dev/null +++ b/scripts/gitlab/build-unix.sh @@ -0,0 +1,35 @@ +#!/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 +time cargo build --target $CARGO_TARGET --release -p whisper-cli + +echo "_____ Post-processing binaries _____" +rm -rf artifacts +mkdir -p artifacts +cd artifacts +mkdir -p $CARGO_TARGET +cd $CARGO_TARGET +cp ../../target/$CARGO_TARGET/release/{parity,parity-evm,ethstore,ethkey,whisper} . +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 100755 index 000000000..a5510875c --- /dev/null +++ b/scripts/gitlab/build-windows.sh @@ -0,0 +1,35 @@ +#!/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 +time cargo build --target $CARGO_TARGET --release -p whisper-cli +echo "__________Sign binaries__________" +scripts/gitlab/sign.cmd $keyfile $certpass target/$CARGO_TARGET/release/parity.exe +scripts/gitlab/sign.cmd $keyfile $certpass target/$CARGO_TARGET/release/parity-evm.exe +scripts/gitlab/sign.cmd $keyfile $certpass target/$CARGO_TARGET/release/ethstore.exe +scripts/gitlab/sign.cmd $keyfile $certpass target/$CARGO_TARGET/release/ethkey.exe +scripts/gitlab/sign.cmd $keyfile $certpass target/$CARGO_TARGET/release/whisper.exe + +echo "_____ Post-processing binaries _____" +rm -rf artifacts +mkdir -p artifacts +cd artifacts +mkdir -p $CARGO_TARGET +cd $CARGO_TARGET +cp --verbose ../../target/$CARGO_TARGET/release/{parity.exe,parity-evm.exe,ethstore.exe,ethkey.exe,whisper.exe} . + +echo "_____ Calculating checksums _____" +for binary in $(ls) +do + rhash --sha256 $binary -o $binary.sha256 +done +cp parity.exe.sha256 parity.sha256 diff --git a/scripts/gitlab/clippy.sh b/scripts/gitlab/clippy.sh new file mode 100755 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 100755 index 000000000..1ddf340a1 --- /dev/null +++ b/scripts/gitlab/coverage.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -x +git submodule update --init --recursive +rm -rf target/* +cargo test --all --exclude evmjit --no-run -- --test-threads 8|| 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" +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 100755 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/package-snap.sh b/scripts/gitlab/package-snap.sh new file mode 100755 index 000000000..168ab4751 --- /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 + nightly|*v2.1*) export GRADE="devel";; + beta|*v2.0*) export GRADE="stable";; + stable|*v1.11*) 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:$CARGO_TARGET' > snapcraft.yaml +cat snapcraft.yaml +snapcraft --target-arch=$BUILD_ARCH +ls *.snap +echo "__________Post-processing snap package__________" +mkdir -p artifacts +mv -v $SNAP_PACKAGE "artifacts/"$SNAP_PACKAGE +echo "_____ Calculating checksums _____" +cd artifacts +rhash --sha256 $SNAP_PACKAGE -o $SNAP_PACKAGE".sha256" diff --git a/scripts/gitlab/publish-docker.sh b/scripts/gitlab/publish-docker.sh new file mode 100755 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 100755 index 000000000..35644c8d7 --- /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 + nightly|*v2.1*) export CHANNEL="edge";; + beta|*v2.0*) export CHANNEL="beta";; + stable|*v1.11*) 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 "artifacts/parity_"$VERSION"_"$BUILD_ARCH".snap" +snapcraft status parity +snapcraft logout diff --git a/scripts/gitlab/push.sh b/scripts/gitlab/push.sh new file mode 100755 index 000000000..718f291fe --- /dev/null +++ b/scripts/gitlab/push.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error +updater_push_release () { + echo "push release" + # Mainnet + +} +echo "__________Set ENVIROMENT__________" +DESCRIPTION="$(cat CHANGELOG.md)" +RELEASE_TABLE="$(cat scripts/gitlab/templates/release-table.md)" +RELEASE_TABLE="$(echo "${RELEASE_TABLE//\$VERSION/${VERSION}}")" +#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 + nightly|*v2.1*) NAME="Parity "$VERSION" nightly";; + beta|*v2.0*) NAME="Parity "$VERSION" beta";; + stable|*v1.11*) NAME="Parity "$VERSION" stable";; + *) echo "No release" exit 0;; +esac +cd artifacts +ls -l | sort -k9 +filetest=( * ) +echo ${filetest[*]} +for DIR in "${filetest[@]}"; +do + cd $DIR + if [[ $DIR == "*windows*" ]]; + then + WIN=".exe"; + else + WIN=""; + fi + for binary in $(ls parity.sha256) + do + sha256=$(cat $binary | awk '{ print $1}' ) + case $DIR in + x86_64* ) + DATA="commit=$CI_BUILD_REF&sha3=$sha256&filename=parity$WIN&secret=$RELEASES_SECRET" + ../../scripts/gitlab/safe_curl.sh $DATA "http://update.parity.io:1337/push-build/$CI_BUILD_REF_NAME/$DIR" + # Kovan + ../../scripts/gitlab/safe_curl.sh $DATA "http://update.parity.io:1338/push-build/$CI_BUILD_REF_NAME/$DIR" + ;; + esac + RELEASE_TABLE="$(echo "${RELEASE_TABLE/sha$DIR/${sha256}}")" + done + cd .. +done +#do not touch the following 3 lines. Features of output in Markdown +DESCRIPTION="$(echo "${DESCRIPTION/${REPLACE_TEXT}/${RELEASE_TABLE} + +${REPLACE_TEXT}}")" +echo "$DESCRIPTION" +if [["$CI_COMMIT_REF_NAME" == "nightly" ]]; then DESCRIPTION=""; fi #TODO in the future, we need to prepare a script that will do changelog +echo "__________Create release to Github____________" +github-release release --user devops-parity --repo parity-ethereum --tag "$CI_COMMIT_REF_NAME" --draft --name "$NAME" --description "$DESCRIPTION" +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" = "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 sync ./ s3://$S3_BUCKET/$CI_BUILD_REF_NAME/ diff --git a/scripts/gitlab/rpc-docs.sh b/scripts/gitlab/rpc-docs.sh new file mode 100755 index 000000000..a01ab1280 --- /dev/null +++ b/scripts/gitlab/rpc-docs.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error + +clone_repos() { + echo "__________Clone repos__________" + git clone https://github.com/parity-js/jsonrpc.git jsonrpc + git clone https://github.com/paritytech/wiki.git wiki +} + +build_docs() { + echo "__________Build docs__________" + npm install + npm run build:markdown +} + +update_wiki_docs() { + echo "__________Update WIKI docs__________" + for file in $(ls jsonrpc/docs); do + module_name=${file:0:-3} + mv jsonrpc/docs/$file wiki/JSONRPC-$module_name-module.md + done +} + +setup_git() { + echo "__________Set github__________" + git config user.email "devops@parity.com" + git config user.name "Devops Parity" +} + +commit_files() { + echo "__________Commit files__________" + git checkout -b rpcdoc-update-${CI_COMMIT_REF_NAME} + git add . + git commit -m "Update docs to ${CI_COMMIT_REF_NAME}" + git tag -a "${CI_COMMIT_REF_NAME}" +} + +upload_files() { + echo "__________Upload files__________" + git push --tags +} + +setup_git +clone_repos +cp -r parity/ jsonrpc/.parity/ +cd jsonrpc +build_docs +cd .. +update_wiki_docs +cd wiki +commit_files +upload_files diff --git a/scripts/gitlab/rustfmt.sh b/scripts/gitlab/rustfmt.sh new file mode 100755 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/safe_curl.sh b/scripts/gitlab/safe_curl.sh similarity index 100% rename from scripts/safe_curl.sh rename to scripts/gitlab/safe_curl.sh diff --git a/scripts/gitlab/sign.cmd b/scripts/gitlab/sign.cmd new file mode 100755 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..614552152 --- /dev/null +++ b/scripts/gitlab/templates/release-table.md @@ -0,0 +1,16 @@ +| OS | Arch | Download | SHA256 Checksum | +|:---:|:---:|:---|:---| +| linux | arm64 | [parity](https://releases.parity.io/$VERSION/aarch64-unknown-linux-gnu/parity) | `shaaarch64-unknown-linux-gnu` | +| android | armv7 | [parity](https://releases.parity.io/$VERSION/armv7-linux-androideabi/parity) | `shaarmv7-linux-androideabi` | +| linux | armv7 | [parity](https://releases.parity.io/$VERSION/armv7-unknown-linux-gnueabihf/parity) | `shaarmv7-unknown-linux-gnueabihf` | +| linux | i686 | [parity](https://releases.parity.io/$VERSION/i686-unknown-linux-gnu/parity) | `shai686-unknown-linux-gnu` | +| osx | x64 | [parity](https://releases.parity.io/$VERSION/x86_64-apple-darwin/parity) | `shax86_64-apple-darwin` | +| windows | x64 | [parity.exe](https://releases.parity.io/$VERSION/x86_64-pc-windows-msvc/parity.exe) | `shax86_64-pc-windows-msvc` | +| linux | x64 | [parity](https://releases.parity.io/$VERSION/x86_64-unknown-linux-gnu/parity) | `shax86_64-unknown-linux-gnu` | + +| 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..97bb39aa1 --- /dev/null +++ b/scripts/gitlab/templates/snapcraft.template.yaml @@ -0,0 +1,58 @@ +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] + whisper: + command: whisper + 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/$CARGO_TARGET + 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 + cp -v whisper $SNAPCRAFT_PART_INSTALL/usr/bin/whisper + stage-packages: [libc6, libssl1.0.0, libudev1, libstdc++6, cmake] + df: + plugin: nil + stage-packages: [coreutils] + stage: [bin/df] diff --git a/scripts/gitlab/test.sh b/scripts/gitlab/test.sh new file mode 100755 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/snap/snapcraft.yaml b/snap/snapcraft.yaml deleted file mode 100644 index c7da23960..000000000 --- a/snap/snapcraft.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: parity -version: git -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. - -grade: devel -confinement: strict - -apps: - parity: - command: parity - plugs: [home, network, network-bind, mount-observe, x11, unity7, desktop, desktop-legacy, wayland] - desktop: usr/share/applications/parity.desktop - -icon: snap/gui/icon.png - -parts: - desktop-icon: - source: ./snap - plugin: nil - prepare: | - 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: . - plugin: rust - # rust-channel: stable # @TODO enable after https://bugs.launchpad.net/snapcraft/+bug/1778530 - rust-revision: 1.26.2 # @TODO remove after https://bugs.launchpad.net/snapcraft/+bug/1778530 - build-attributes: [no-system-libraries] - build-packages: [g++, libudev-dev, make, pkg-config, cmake] - stage-packages: [libc6, libudev1, libstdc++6] - df: - plugin: nil - stage-packages: [coreutils] - stage: [bin/df] diff --git a/test.sh b/test.sh index 82e05d954..baa959f3c 100755 --- a/test.sh +++ b/test.sh @@ -32,13 +32,13 @@ set -e if [ "$VALIDATE" -eq "1" ]; then # Validate --no-default-features build echo "________Validate build________" -cargo check --no-default-features -cargo check --manifest-path util/io/Cargo.toml --no-default-features -cargo check --manifest-path util/io/Cargo.toml --features "mio" +time cargo check --no-default-features +time cargo check --manifest-path util/io/Cargo.toml --no-default-features +time cargo check --manifest-path util/io/Cargo.toml --features "mio" # Validate chainspecs echo "________Validate chainspecs________" -./scripts/validate_chainspecs.sh +time ./scripts/validate_chainspecs.sh fi @@ -57,4 +57,4 @@ cd parity-clib-examples/cpp && \ # Running tests echo "________Running Parity Full Test Suite________" git submodule update --init --recursive -cargo test -j 8 $OPTIONS --features "$FEATURES" --all $1 +time cargo test $OPTIONS --features "$FEATURES" --all $1 -- --test-threads 8