diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4d58a238d1d..2d473005b5c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,243 +1,178 @@ stages: - test - - push-release - build - - docs + - publish + - optional + +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: - - beta - - tags - - stable - - triggers - 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 - 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 - only: - - beta - - tags - - stable - - triggers - script: - - scripts/gitlab-build.sh i686-unknown-linux-gnu i686-unknown-linux-gnu i386 gcc g++ linux - 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 - 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 + - ./target + - ./.cargo + +.releaseable_branches: # list of git refs for building GitLab artifacts (think "pre-release binaries") + only: &releaseable_branches - 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 + +.collect_artifacts: &collect_artifacts artifacts: + name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" + when: on_success + expire_in: 1 mos 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 + - artifacts/ + +.determine_version: &determine_version + - VERSION="$(sed -r -n '1,/^version/s/^version = "([^"]+)".*$/\1/p' Cargo.toml)" + - DATE_STR="$(date +%Y%m%d)" + - ID_SHORT="$(echo ${CI_COMMIT_SHA} | cut -c 1-7)" + - test "${CI_COMMIT_REF_NAME}" = "nightly" && VERSION="${VERSION}-${ID_SHORT}-${DATE_STR}" + - export VERSION + - echo "Version = ${VERSION}" + +test-linux: + stage: test + variables: + RUN_TESTS: all + script: + - scripts/gitlab/test-all.sh stable tags: - rust-stable - artifacts: - paths: - - parity.zip - name: "stable-x86_64-unknown-snap-gnu_parity" -darwin: - stage: build - only: - - beta - - tags - - stable - - triggers + +build-linux: + stage: build + only: *releaseable_branches + variables: + CARGO_TARGET: x86_64-unknown-linux-gnu script: - - scripts/gitlab-build.sh x86_64-apple-darwin x86_64-apple-darwin macos gcc g++ macos + - scripts/gitlab/build-unix.sh + <<: *collect_artifacts tags: - - osx - artifacts: - paths: - - parity.zip - name: "x86_64-apple-darwin_parity" -windows: - cache: - key: "%CI_BUILD_STAGE%-%CI_BUILD_REF_NAME%" - untracked: true - stage: build - only: - - beta - - tags - - stable - - triggers - script: - - sh scripts/gitlab-build.sh x86_64-pc-windows-msvc x86_64-pc-windows-msvc amd64 "" "" windows + - rust-stable + +build-darwin: + stage: build + only: *releaseable_branches + variables: + CARGO_TARGET: x86_64-apple-darwin + CC: gcc + CXX: g++ + script: + - scripts/gitlab/build-unix.sh + tags: + - rust-osx + <<: *collect_artifacts + +build-windows: + stage: build + only: *releaseable_branches + variables: + CARGO_TARGET: x86_64-pc-windows-msvc + script: + - 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 + <<: *collect_artifacts + +publish-docker: + stage: publish + only: *releaseable_branches + cache: {} + dependencies: + - build-linux 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 - before_script: - - docker info + - shell 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 + - scripts/gitlab/publish-docker.sh parity + +publish-awss3: + stage: publish + only: *releaseable_branches + cache: {} + dependencies: + - build-linux + - build-darwin + - build-windows + before_script: *determine_version + script: + - scripts/gitlab/publish-awss3.sh + tags: + - shell + +docs-jsonrpc: + stage: optional only: - - master + - tags + cache: {} script: - - scripts/gitlab-test.sh test-coverage + - scripts/gitlab/docs-jsonrpc.sh tags: - - kcov - allow_failure: true -test-rust-stable: - stage: test - image: parity/rust:gitlab-ci + - shell + +cargo-audit: + stage: optional script: - - scripts/gitlab-test.sh stable + - scripts/gitlab/cargo-audit.sh tags: - rust-stable -test-rust-beta: - stage: test - only: - - triggers - - master - image: parity/rust:gitlab-ci + +test-android: + stage: optional + image: parity/rust-android:gitlab-ci + variables: + CARGO_TARGET: armv7-linux-androideabi script: - - scripts/gitlab-test.sh beta + - scripts/gitlab/test-all.sh stable tags: - - rust-beta - allow_failure: true -test-rust-nightly: - stage: test - only: - - triggers - - master - image: parity/rust:gitlab-ci - script: - - scripts/gitlab-test.sh nightly + - rust-arm + +test-darwin: + stage: optional + variables: + CARGO_TARGET: x86_64-apple-darwin + CC: gcc + CXX: g++ + RUN_TESTS: cargo + script: + - scripts/gitlab/test-all.sh stable + tags: + - rust-osx + +test-windows: + stage: optional + variables: + CARGO_TARGET: x86_64-pc-windows-msvc + RUN_TESTS: cargo + script: + - sh scripts/gitlab/test-all.sh stable tags: - - rust - - rust-nightly - allow_failure: true -json-rpc-docs: - stage: docs - only: - - tags - image: parity/rust:gitlab-ci + - rust-windows + +test-beta: + stage: optional + variables: + RUN_TESTS: cargo script: - - scripts/gitlab-rpc-docs.sh + - scripts/gitlab/test-all.sh beta tags: - - docs - cache: {} -push-release: - stage: push-release - only: - - tags - - triggers - image: parity/rust:gitlab-ci + - rust-beta + +test-nightly: + stage: optional + variables: + RUN_TESTS: all script: - - scripts/gitlab-push-release.sh + - scripts/gitlab/test-all.sh nightly tags: - - curl + - rust-nightly diff --git a/README.md b/README.md index 95e5ba2ed2d..d72e5bc3edc 100644 --- a/README.md +++ b/README.md @@ -1,111 +1,75 @@ -# Parity - fast, light, and robust Ethereum client +![Parity Ethereum](docs/logo-parity-ethereum.svg) -## [» Download the latest release «](https://github.com/paritytech/parity/releases/latest) +## The fastest and most advanced Ethereum client. -[![build status](https://gitlab.parity.io/parity/parity/badges/master/build.svg)](https://gitlab.parity.io/parity/parity/commits/master) -[![codecov](https://codecov.io/gh/paritytech/parity/branch/master/graph/badge.svg)](https://codecov.io/gh/paritytech/parity) -[![Snap Status](https://build.snapcraft.io/badge/paritytech/parity.svg)](https://build.snapcraft.io/user/paritytech/parity) -[![GPLv3](https://img.shields.io/badge/license-GPL%20v3-green.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) +

» Download the latest release «

+

+

-### Join the chat! +**Built for mission-critical use**: Miners, service providers, and exchanges need fast synchronisation and maximum uptime. Parity Ethereum provides the core infrastructure essential for speedy and reliable services. -Get in touch with us on Gitter: -[![Gitter: Parity](https://img.shields.io/badge/gitter-parity-4AB495.svg)](https://gitter.im/paritytech/parity) -[![Gitter: Parity.js](https://img.shields.io/badge/gitter-parity.js-4AB495.svg)](https://gitter.im/paritytech/parity.js) -[![Gitter: Parity/Miners](https://img.shields.io/badge/gitter-parity/miners-4AB495.svg)](https://gitter.im/paritytech/parity/miners) -[![Gitter: Parity-PoA](https://img.shields.io/badge/gitter-parity--poa-4AB495.svg)](https://gitter.im/paritytech/parity-poa) - -Or join our community on Matrix: -[![Riot: +Parity](https://img.shields.io/badge/riot-%2Bparity%3Amatrix.parity.io-orange.svg)](https://riot.im/app/#/group/+parity:matrix.parity.io) +- Clean, modular codebase for easy customisation +- Advanced CLI-based client +- Minimal memory and storage footprint +- Synchronise in hours, not days with Warp Sync +- Modular for light integration into your service or product -Official website: https://parity.io | Be sure to check out [our wiki](https://wiki.parity.io) for more information. +## Technical Overview ----- +Parity Ethereum's goal is to be the fastest, lightest, and most secure Ethereum client. We are developing Parity Ethereum using the sophisticated and cutting-edge **Rust programming language**. Parity Ethereum is licensed under the GPLv3 and can be used for all your Ethereum needs. -## About Parity +By default, Parity Ethereum runs a JSON-RPC HTTP server on port `:8545` and a Web-Sockets server on port `:8546`. This is fully configurable and supports a number of APIs. -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. +If you run into problems while using Parity Ethereum, check out the [wiki for documentation](https://wiki.parity.io/), feel free to [file an issue in this repository](https://github.com/paritytech/parity-ethereum/issues/new), or hop on our [Gitter](https://gitter.im/paritytech/parity) or [Riot](https://riot.im/app/#/group/+parity:matrix.parity.io) chat room to ask a question. We are glad to help! **For security-critical issues**, please refer to the security policy outlined in [SECURITY.md](SECURITY.md). -From Parity Ethereum client version 1.10.0, the User Interface (UI) is accessible in a separate application called Parity UI. To keep using the UI in the browser (deprecated), [follow these steps](https://wiki.parity.io/FAQ-Basic-Operations,-Configuration,-and-Synchronization#the-parity-ui-application-isnt-working-the-way-i-want). +Parity Ethereum's current beta-release is 2.1. You can download it at [the releases page](https://github.com/paritytech/parity-ethereum/releases) or follow the instructions below to build from source. Please, mind the [CHANGELOG.md](CHANGELOG.md) for a list of all changes between different versions. -By default, Parity will also run a JSONRPC server on `127.0.0.1:8545` and a websockets server on `127.0.0.1:8546`. This is fully configurable and supports a number of APIs. +## Build Dependencies -If you run into an issue while using Parity, feel free to file one in this repository or hop on our [Gitter](https://gitter.im/paritytech/parity) or [Riot](https://riot.im/app/#/group/+parity:matrix.parity.io) chat room to ask a question. We are glad to help! **For security-critical issues**, please refer to the security policy outlined in [SECURITY.MD](SECURITY.md). +Parity Ethereum requires **Rust version 1.29.x** to build. -Parity's current beta-release is 1.11. You can download it at https://github.com/paritytech/parity/releases or follow the instructions below to build from source. - ----- - -## Build dependencies - -**Parity requires Rust version 1.26.0 to build** - -We recommend installing Rust through [rustup](https://www.rustup.rs/). If you don't already have rustup, you can install it like this: +We recommend installing Rust through [rustup](https://www.rustup.rs/). If you don't already have `rustup`, you can install it like this: - Linux: - ```bash - $ curl https://sh.rustup.rs -sSf | sh - ``` + ```bash + $ curl https://sh.rustup.rs -sSf | sh + ``` - Parity also requires `gcc`, `g++`, `libssl-dev`/`openssl`, `libudev-dev`, `pkg-config`, `file` and `make` packages to be installed. + Parity Ethereum also requires `gcc`, `g++`, `libudev-dev`, `pkg-config`, `file`, `make`, and `cmake` packages to be installed. - OSX: - ```bash - $ curl https://sh.rustup.rs -sSf | sh - ``` + ```bash + $ curl https://sh.rustup.rs -sSf | sh + ``` - `clang` is required. It comes with Xcode command line tools or can be installed with homebrew. + `clang` is required. It comes with Xcode command line tools or can be installed with homebrew. - Windows - Make sure you have Visual Studio 2015 with C++ support installed. Next, download and run the rustup installer from - https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe, start "VS2015 x64 Native Tools Command Prompt", and use the following command to install and set up the msvc toolchain: + Make sure you have Visual Studio 2015 with C++ support installed. Next, download and run the `rustup` installer from + https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe, start "VS2015 x64 Native Tools Command Prompt", and use the following command to install and set up the `msvc` toolchain: ```bash - $ rustup default stable-x86_64-pc-windows-msvc + $ rustup default stable-x86_64-pc-windows-msvc ``` -Once you have rustup installed, then you need to install: +Once you have `rustup` installed, then you need to install: * [Perl](https://www.perl.org) -* [Yasm](http://yasm.tortall.net) - -Make sure that these binaries are in your `PATH`. After that you should be able to build parity from source. +* [Yasm](https://yasm.tortall.net) ----- +Make sure that these binaries are in your `PATH`. After that, you should be able to build Parity Ethereum from source. -## Install from the snap store - -In any of the [supported Linux distros](https://snapcraft.io/docs/core/install): +## Build from Source Code ```bash -sudo snap install parity -``` - -Or, if you want to contribute testing the upcoming release: - -```bash -sudo snap install parity --beta -``` - -And to test the latest code landed into the master branch: - -```bash -sudo snap install parity --edge -``` - ----- - -## Build from source - -```bash -# download Parity code -$ git clone https://github.com/paritytech/parity -$ cd parity +# download Parity Ethereum code +$ git clone https://github.com/paritytech/parity-ethereum +$ cd parity-ethereum # build in release mode -$ cargo build --release +$ cargo build --release --features final ``` -This will produce an executable in the `./target/release` subdirectory. +This produces an executable in the `./target/release` subdirectory. Note: if cargo fails to parse manifest try: @@ -119,7 +83,7 @@ Note, when compiling a crate and you receive errors, it's in most cases your out $ cargo clean ``` -This will always compile the latest nightly builds. If you want to build stable or beta, do a +This always compiles the latest nightly builds. If you want to build stable or beta, do a ```bash $ git checkout stable @@ -131,11 +95,7 @@ or $ git checkout beta ``` -first. - ----- - -## Simple one-line installer for Mac and Ubuntu +## Simple One-Line Installer for Mac and Linux ```bash bash <(curl https://get.parity.io -L) @@ -147,22 +107,49 @@ The one-line installer always defaults to the latest beta release. To install a bash <(curl https://get.parity.io -L) -r stable ``` -## Start Parity +## Start Parity Ethereum ### Manually -To start Parity manually, just run +To start Parity Ethereum manually, just run ```bash $ ./target/release/parity ``` -and Parity will begin syncing the Ethereum blockchain. +so Parity Ethereum begins syncing the Ethereum blockchain. -### Using systemd service file +### Using `systemd` service file -To start Parity as a regular user using systemd init: +To start Parity Ethereum as a regular user using `systemd` init: 1. Copy `./scripts/parity.service` to your -systemd user directory (usually `~/.config/systemd/user`). -2. To configure Parity, write a `/etc/parity/config.toml` config file, see [Configuring Parity](https://paritytech.github.io/wiki/Configuring-Parity) for details. +`systemd` user directory (usually `~/.config/systemd/user`). +2. To configure Parity Ethereum, write a `/etc/parity/config.toml` config file, see [Configuring Parity Ethereum](https://paritytech.github.io/wiki/Configuring-Parity) for details. + +## Parity Ethereum toolchain + +In addition to the Parity Ethereum client, there are additional tools in this repository available: + +- [evmbin](https://github.com/paritytech/parity-ethereum/blob/master/evmbin/) - EVM implementation for Parity Ethereum. +- [ethabi](https://github.com/paritytech/ethabi) - Parity Ethereum function calls encoding. +- [ethstore](https://github.com/paritytech/parity-ethereum/blob/master/ethstore/) - Parity Ethereum key management. +- [ethkey](https://github.com/paritytech/parity-ethereum/blob/master/ethkey/) - Parity Ethereum keys generator. +- [whisper](https://github.com/paritytech/parity-ethereum/blob/master/whisper/) - Implementation of Whisper-v2 PoC. + +## Join the chat! + +Questions? Get in touch with us on Gitter: +[![Gitter: Parity](https://img.shields.io/badge/gitter-parity-4AB495.svg)](https://gitter.im/paritytech/parity) +[![Gitter: Parity.js](https://img.shields.io/badge/gitter-parity.js-4AB495.svg)](https://gitter.im/paritytech/parity.js) +[![Gitter: Parity/Miners](https://img.shields.io/badge/gitter-parity/miners-4AB495.svg)](https://gitter.im/paritytech/parity/miners) +[![Gitter: Parity-PoA](https://img.shields.io/badge/gitter-parity--poa-4AB495.svg)](https://gitter.im/paritytech/parity-poa) + +Alternatively, join our community on Matrix: +[![Riot: +Parity](https://img.shields.io/badge/riot-%2Bparity%3Amatrix.parity.io-orange.svg)](https://riot.im/app/#/group/+parity:matrix.parity.io) + +## Documentation + +Official website: https://parity.io + +Be sure to [check out our wiki](https://wiki.parity.io) for more information. diff --git a/scripts/aura-test.sh b/scripts/aura-test.sh deleted file mode 100755 index 0c39e12f4d1..00000000000 --- a/scripts/aura-test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -e # fail on any error -set -u # treat unset variables as error - -cargo build -j $(nproc) --release --features final $CARGOFLAGS -git clone https://github.com/paritytech/parity-import-tests -cp target/release/parity parity-import-tests/aura/parity -cd parity-import-tests/aura -echo "Start Aura test" -./parity import blocks.rlp --chain chain.json -./parity restore snap --chain chain.json -echo "Aura test complete" diff --git a/docker/README.md b/scripts/docker/README.md similarity index 100% rename from docker/README.md rename to scripts/docker/README.md diff --git a/docker/alpine/Dockerfile b/scripts/docker/alpine/Dockerfile similarity index 100% rename from docker/alpine/Dockerfile rename to scripts/docker/alpine/Dockerfile diff --git a/docker/centos/Dockerfile b/scripts/docker/centos/Dockerfile similarity index 100% rename from docker/centos/Dockerfile rename to scripts/docker/centos/Dockerfile diff --git a/scripts/docker/centos/Dockerfile.build b/scripts/docker/centos/Dockerfile.build new file mode 100644 index 00000000000..454af403a03 --- /dev/null +++ b/scripts/docker/centos/Dockerfile.build @@ -0,0 +1,25 @@ +FROM centos:latest + +WORKDIR /build + +ADD . /build/parity-ethereum + +RUN yum -y update && \ + yum install -y systemd-devel git make gcc-c++ gcc file binutils && \ + curl -L "https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz" -o cmake.tar.gz && \ + tar -xzf cmake.tar.gz && \ + cp -r cmake-3.12.0-Linux-x86_64/* /usr/ && \ + curl https://sh.rustup.rs -sSf | sh -s -- -y && \ + PATH=/root/.cargo/bin:$PATH && \ + RUST_BACKTRACE=1 && \ + rustc -vV && \ + cargo -V && \ + gcc -v && \ + g++ -v && \ + cmake --version && \ + cd parity-ethereum && \ + cargo build --verbose --release --features final && \ + strip /build/parity-ethereum/target/release/parity && \ + file /build/parity-ethereum/target/release/parity + + diff --git a/scripts/docker/centos/build.sh b/scripts/docker/centos/build.sh new file mode 100755 index 00000000000..7215e745f0e --- /dev/null +++ b/scripts/docker/centos/build.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env sh + +# The image name +PARITY_IMAGE_REPO=${PARITY_IMAGE_REPO:-parity/parity} +# The tag to be used for builder image +PARITY_BUILDER_IMAGE_TAG=${PARITY_BUILDER_IMAGE_TAG:-build} +# The tag to be used for runner image +PARITY_RUNNER_IMAGE_TAG=${PARITY_RUNNER_IMAGE_TAG:-latest} + +echo Building $PARITY_IMAGE_REPO:$PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H") +docker build --no-cache -t $PARITY_IMAGE_REPO:$PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H") . -f docker/centos/Dockerfile.build + +echo Creating $PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H"), extracting binary +docker create --name extract $PARITY_IMAGE_REPO:$PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H") +mkdir docker/centos/parity +docker cp extract:/build/parity-ethereum/target/release/parity docker/centos/parity + +echo Building $PARITY_IMAGE_REPO:$PARITY_RUNNER_IMAGE_TAG +docker build --no-cache -t $PARITY_IMAGE_REPO:$PARITY_RUNNER_IMAGE_TAG docker/centos/ -f docker/centos/Dockerfile + +echo Cleaning up ... +rm -rf docker/centos/parity +docker rm -f extract +docker rmi -f $PARITY_IMAGE_REPO:$PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H") + +echo Echoing Parity version: +docker run $PARITY_IMAGE_REPO:$PARITY_RUNNER_IMAGE_TAG --version + +echo Done. diff --git a/docker/hub/Dockerfile b/scripts/docker/hub/Dockerfile similarity index 100% rename from docker/hub/Dockerfile rename to scripts/docker/hub/Dockerfile diff --git a/docker/ubuntu-aarch64/Dockerfile b/scripts/docker/ubuntu-aarch64/Dockerfile similarity index 100% rename from docker/ubuntu-aarch64/Dockerfile rename to scripts/docker/ubuntu-aarch64/Dockerfile diff --git a/docker/ubuntu-arm/Dockerfile b/scripts/docker/ubuntu-arm/Dockerfile similarity index 100% rename from docker/ubuntu-arm/Dockerfile rename to scripts/docker/ubuntu-arm/Dockerfile diff --git a/scripts/gitlab/build-unix.sh b/scripts/gitlab/build-unix.sh new file mode 100755 index 00000000000..00933f1eeb7 --- /dev/null +++ b/scripts/gitlab/build-unix.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error + +echo "__________Show ENVIROMENT__________" +echo "CI_SERVER_NAME: " $CI_SERVER_NAME +echo "CARGO_HOME: " $CARGO_HOME +echo "BUILD_TARGET: " $BUILD_TARGET +echo "BUILD_ARCH: " $BUILD_ARCH +echo "CARGO_TARGET: " $CARGO_TARGET +echo "CC: " $CC +echo "CXX: " $CXX + +echo "__________CARGO CONFIG__________" +mkdir -p .cargo +rm -f .cargo/config +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 +cp ../../target/$CARGO_TARGET/release/parity-evm ./parity-evm +cp ../../target/$CARGO_TARGET/release/ethstore ./ethstore +cp ../../target/$CARGO_TARGET/release/ethkey ./ethkey +cp ../../target/$CARGO_TARGET/release/whisper ./whisper +strip -v ./* +echo "_____ Calculating checksums _____" +for binary in $(ls) +do + rhash --sha256 $binary -o $binary.sha256 + ./parity tools hash $binary > $binary.sha3 +done diff --git a/scripts/gitlab/build-windows.sh b/scripts/gitlab/build-windows.sh new file mode 100755 index 00000000000..b0570b917dc --- /dev/null +++ b/scripts/gitlab/build-windows.sh @@ -0,0 +1,50 @@ +#!/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 "__________Show ENVIROMENT__________" +echo "CI_SERVER_NAME: " $CI_SERVER_NAME +echo "CARGO_HOME: " $CARGO_HOME +echo "BUILD_TARGET: " $BUILD_TARGET +echo "BUILD_ARCH: " $BUILD_ARCH +echo "CARGO_TARGET: " $CARGO_TARGET + +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 "__________Sign binaries__________" +scripts/gitlab/sign-win.cmd $keyfile $certpass target/$CARGO_TARGET/release/parity.exe +scripts/gitlab/sign-win.cmd $keyfile $certpass target/$CARGO_TARGET/release/parity-evm.exe +scripts/gitlab/sign-win.cmd $keyfile $certpass target/$CARGO_TARGET/release/ethstore.exe +scripts/gitlab/sign-win.cmd $keyfile $certpass target/$CARGO_TARGET/release/ethkey.exe +scripts/gitlab/sign-win.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.exe +cp --verbose ../../target/$CARGO_TARGET/release/parity-evm.exe ./parity-evm.exe +cp --verbose ../../target/$CARGO_TARGET/release/ethstore.exe ./ethstore.exe +cp --verbose ../../target/$CARGO_TARGET/release/ethkey.exe ./ethkey.exe +cp --verbose ../../target/$CARGO_TARGET/release/whisper.exe ./whisper.exe + +echo "_____ Calculating checksums _____" +for binary in $(ls) +do + rhash --sha256 $binary -o $binary.sha256 + ./parity.exe tools hash $binary > $binary.sha3 +done +cp parity.exe.sha256 parity.sha256 +cp parity.exe.sha3 parity.sha3 diff --git a/scripts/gitlab/cargo-audit.sh b/scripts/gitlab/cargo-audit.sh new file mode 100755 index 00000000000..3677204d6ad --- /dev/null +++ b/scripts/gitlab/cargo-audit.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error + +CARGO_TARGET_DIR=./target cargo +stable install cargo-audit +cargo +stable audit diff --git a/scripts/gitlab-rpc-docs.sh b/scripts/gitlab/docs-jsonrpc.sh similarity index 65% rename from scripts/gitlab-rpc-docs.sh rename to scripts/gitlab/docs-jsonrpc.sh index 13d49437174..3c00fe4ea06 100755 --- a/scripts/gitlab-rpc-docs.sh +++ b/scripts/gitlab/docs-jsonrpc.sh @@ -1,43 +1,48 @@ -#!/usr/bin/env bash - -set -e # fail on errors - +#!/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 } -set_remote_wiki() { - git config remote.origin.url "https://${GITHUB_TOKEN}@github.com/paritytech/wiki.git" +setup_git() { + echo "__________Set github__________" + git config user.email "devops@parity.com" + git config user.name "Devops Parity" } -setup_git() { - git config --global user.email "devops@parity.com" - git config --global user.name "Devops Parity" +set_remote_wiki() { + git config remote.origin.url "https://${GITHUB_TOKEN}@github.com/paritytech/wiki.git" } 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}" -m "Updated to ${CI_COMMIT_REF_NAME}" + git tag -a "${CI_COMMIT_REF_NAME}" -m "Update RPC docs to ${CI_COMMIT_REF_NAME}" } upload_files() { + echo "__________Upload files__________" git push origin HEAD git push --tags } diff --git a/scripts/gitlab/publish-awss3.sh b/scripts/gitlab/publish-awss3.sh new file mode 100755 index 00000000000..9ef0435f5ba --- /dev/null +++ b/scripts/gitlab/publish-awss3.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error + +echo "__________Register Release__________" +DATA="secret=$RELEASES_SECRET" + +echo "Pushing release to Mainnet" +./scripts/gitlab/safe-curl.sh $DATA "http://update.parity.io:1337/push-release/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA" + +echo "Pushing release to Kovan" +./scripts/gitlab/safe-curl.sh $DATA "http://update.parity.io:1338/push-release/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA" + +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 + sha3=$(cat parity.sha3 | awk '{print $1}') + case $DIR in + x86_64* ) + DATA="commit=$CI_COMMIT_SHA&sha3=$sha3&filename=parity$WIN&secret=$RELEASES_SECRET" + ../../scripts/gitlab/safe-curl.sh $DATA "http://update.parity.io:1337/push-build/$CI_COMMIT_REF_NAME/$DIR" + # Kovan + ../../scripts/gitlab/safe-curl.sh $DATA "http://update.parity.io:1338/push-build/$CI_COMMIT_REF_NAME/$DIR" + ;; + esac + cd .. +done + +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_COMMIT_REF_NAME" = "beta" || "$CI_COMMIT_REF_NAME" = "stable" || "$CI_COMMIT_REF_NAME" = "nightly" ]]; + then + export S3_BUCKET=builds-parity-published; + else + export S3_BUCKET=builds-parity; +fi +aws s3 sync ./ s3://$S3_BUCKET/$CI_COMMIT_REF_NAME/ diff --git a/scripts/gitlab/publish-docker.sh b/scripts/gitlab/publish-docker.sh new file mode 100755 index 00000000000..e4d2007b95c --- /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" == "master" ]; + 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 scripts/docker/hub/Dockerfile . +docker push parity/$DOCKER_TARGET:$DOCKER_BUILD_TAG +docker logout 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-win.cmd b/scripts/gitlab/sign-win.cmd new file mode 100755 index 00000000000..2b014a0236c --- /dev/null +++ b/scripts/gitlab/sign-win.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/test-all.sh b/scripts/gitlab/test-all.sh new file mode 100755 index 00000000000..fa4dc659586 --- /dev/null +++ b/scripts/gitlab/test-all.sh @@ -0,0 +1,35 @@ +#!/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 + +git log --graph --oneline --all --decorate=short -n 10 + +case $CI_COMMIT_REF_NAME in + (beta|stable) + export GIT_COMPARE=$CI_COMMIT_REF_NAME~ + ;; + (master|nightly) + export GIT_COMPARE=master~ + ;; + (*) + export GIT_COMPARE=master + ;; +esac + +export RUST_FILES_MODIFIED="$(git --no-pager diff --name-only $GIT_COMPARE...$CI_COMMIT_SHA | grep -v -e ^\\. -e ^LICENSE -e ^README.md -e ^CHANGELOG.md -e ^test.sh -e ^scripts/ -e ^docs/ -e ^docker/ -e ^snap/ | wc -l | tr -d ' ')" +echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED" + +if [ "${RUST_FILES_MODIFIED}" = "0" ] +then + echo "__________Skipping Rust tests since no Rust files modified__________"; + exit 0 +fi + +rustup default $1 + +git submodule update --init --recursive +rustup show + +exec ./test.sh diff --git a/snap/gui/icon.png b/snap/gui/icon.png deleted file mode 100644 index 35238121adf..00000000000 Binary files a/snap/gui/icon.png and /dev/null differ diff --git a/snap/gui/parity.desktop b/snap/gui/parity.desktop deleted file mode 100644 index c8f83be73d0..00000000000 --- a/snap/gui/parity.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Application -Encoding=UTF-8 -Name=parity -Comment=Fast, light, robust Ethereum implementation -Exec=parity -Icon=/usr/share/pixmaps/icon.png -Terminal=true diff --git a/test.sh b/test.sh index 82e05d954c5..b49dfadafac 100755 --- a/test.sh +++ b/test.sh @@ -1,9 +1,10 @@ #!/bin/sh # Running Parity Full Test Suite -FEATURES="json-tests" +FEATURES="json-tests,ci-skip-issue" OPTIONS="--release" VALIDATE=1 +THREADS=8 case $1 in --no-json) @@ -29,32 +30,72 @@ esac 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" -# Validate chainspecs -echo "________Validate chainspecs________" -./scripts/validate_chainspecs.sh +validate () { + if [ "$VALIDATE" -eq "1" ] + then + echo "________Validate build________" + 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________" + time ./scripts/validate_chainspecs.sh + else + echo "# not validating due to \$VALIDATE!=1" + fi +} + +cpp_test () { + case $CARGO_TARGET in + (x86_64-unknown-linux-gnu) + # Running the C++ example + echo "________Running the C++ example________" + cd parity-clib-examples/cpp && \ + mkdir -p build && \ + cd build && \ + cmake .. && \ + make -j $THREADS && \ + ./parity-example && \ + cd .. && \ + rm -rf build && \ + cd ../.. + ;; + (*) + echo "________Skipping the C++ example________" + ;; + esac +} + +cargo_test () { + echo "________Running Parity Full Test Suite________" + git submodule update --init --recursive + time cargo test $OPTIONS --features "$FEATURES" --all $@ -- --test-threads $THREADS +} + + +if [ "$CARGO_TARGET" ] +then + validate --target $CARGO_TARGET +else + validate fi +test "${RUN_TESTS}" = "all" && cpp_test + +if [ "$CARGO_TARGET" ] +then + + case "${RUN_TESTS}" in + (cargo|all) + cargo_test --target $CARGO_TARGET $@ + ;; + ('') + cargo_test --no-run --target $CARGO_TARGET $@ + ;; + esac +else + cargo_test $@ +fi -# Running the C++ example -echo "________Running the C++ example________" -cd parity-clib-examples/cpp && \ - mkdir -p build && \ - cd build && \ - cmake .. && \ - make && \ - ./parity-example && \ - cd .. && \ - rm -rf build && \ - cd ../.. - -# Running tests -echo "________Running Parity Full Test Suite________" -git submodule update --init --recursive -cargo test -j 8 $OPTIONS --features "$FEATURES" --all $1