From 70683445f10f152e94e19dcea5d7da9fd0e6410e Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sat, 23 May 2020 17:12:38 +0300 Subject: [PATCH 01/34] cargo: run tests and clippy in release mode this will reduce total build times in travis, and when running git hooks --- .travis.yml | 4 ++-- devops/dockerfiles/node-and-runtime/Dockerfile | 6 +++++- devops/git-hooks/pre-push | 10 ++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index bfaefebec6..6bc53ddc97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,11 +20,11 @@ before_install: - rustup component add rustfmt - cargo fmt --all -- --check - rustup component add clippy - - BUILD_DUMMY_WASM_BINARY=1 cargo clippy -- -D warnings + - BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release -- -D warnings - rustup default stable - rustup update nightly - rustup target add wasm32-unknown-unknown --toolchain nightly - - cargo test --verbose --all + - cargo test --release --verbose --all install: - | diff --git a/devops/dockerfiles/node-and-runtime/Dockerfile b/devops/dockerfiles/node-and-runtime/Dockerfile index 72f125eb1e..af995bda4a 100644 --- a/devops/dockerfiles/node-and-runtime/Dockerfile +++ b/devops/dockerfiles/node-and-runtime/Dockerfile @@ -3,7 +3,11 @@ LABEL description="Compiles all workspace artifacts" WORKDIR /joystream COPY . /joystream -RUN cargo build --release +# Make sure tests pass before continuing +RUN cargo test --release + +# Build joystream-node and its dependencies - runtime +RUN cargo build --release -p joystream-node FROM debian:stretch LABEL description="Joystream node" diff --git a/devops/git-hooks/pre-push b/devops/git-hooks/pre-push index b9ffbcb184..9d718cdfe0 100755 --- a/devops/git-hooks/pre-push +++ b/devops/git-hooks/pre-push @@ -1,10 +1,8 @@ #!/bin/sh set -e -export BUILD_DUMMY_WASM_BINARY=1 +echo '+cargo test --release --all' +cargo test --release --all -echo '+cargo test --all' -cargo test --all - -echo '+cargo clippy --all -- -D warnings' -cargo clippy --all -- -D warnings \ No newline at end of file +echo '+cargo clippy --release --all -- -D warnings' +BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --all -- -D warnings \ No newline at end of file From a09808ccd3f34bc941f6808d0b96a226c0c62cc0 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sat, 23 May 2020 21:18:26 +0300 Subject: [PATCH 02/34] travis and hooks, cargo test and clippy for target --- .travis.yml | 14 +++++++++----- devops/dockerfiles/node-and-runtime/Dockerfile | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6bc53ddc97..a9bf72f32c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,14 +17,12 @@ matrix: services: docker before_install: - - rustup component add rustfmt - - cargo fmt --all -- --check - - rustup component add clippy - - BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release -- -D warnings - rustup default stable - rustup update nightly - rustup target add wasm32-unknown-unknown --toolchain nightly - - cargo test --release --verbose --all + - rustup component add rustfmt + - rustup component add clippy + - cargo fmt --all -- --check install: - | @@ -37,6 +35,10 @@ script: - | if [ "$TARGET" = "arm-unknown-linux-gnueabihf" ] then + docker run -u root \ + --volume ${TRAVIS_BUILD_DIR}:/home/cross/project \ + joystream/rust-raspberry \ + test --release docker run -u root \ --volume ${TRAVIS_BUILD_DIR}:/home/cross/project \ joystream/rust-raspberry \ @@ -51,6 +53,8 @@ script: docker cp temp-container-joystream-node:/joystream/runtime.compact.wasm joystream_runtime.wasm docker rm temp-container-joystream-node else + cargo test --release --verbose --all --target=${TARGET} + BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --target=${TARGET} -- -D warnings cargo build --release --target=${TARGET} fi diff --git a/devops/dockerfiles/node-and-runtime/Dockerfile b/devops/dockerfiles/node-and-runtime/Dockerfile index af995bda4a..7ee95ffce9 100644 --- a/devops/dockerfiles/node-and-runtime/Dockerfile +++ b/devops/dockerfiles/node-and-runtime/Dockerfile @@ -4,6 +4,7 @@ WORKDIR /joystream COPY . /joystream # Make sure tests pass before continuing +RUN BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release -- -D warnings RUN cargo test --release # Build joystream-node and its dependencies - runtime From 2bf96c1d2950307d48aca5318c6ed691d538351d Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sun, 24 May 2020 12:43:44 +0300 Subject: [PATCH 03/34] travis: cache cargo again --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index a9bf72f32c..bb29a50834 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: rust +cache: cargo + rust: - 1.43.0 From 64d3c8884b71997d6453b15e8b834411b5b43d8a Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sun, 24 May 2020 16:13:24 +0300 Subject: [PATCH 04/34] travis: additional optimizations --- .travis.yml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index bb29a50834..5e842314dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: rust +# Caching of the runtime .wasm blob poses a problem. +# See: https://github.com/Joystream/joystream/issues/466 cache: cargo rust: @@ -19,9 +21,25 @@ matrix: services: docker before_install: - - rustup default stable - - rustup update nightly - - rustup target add wasm32-unknown-unknown --toolchain nightly + # This is not needed since travis will install rust stable as the default, and just specifying + # stable might be newer that version defined in the .travis.yml file and available + # as an env var: TRAVIS_RUST_VERSION + # - rustup default stable + # ensure main version is the default + - rustup default $TRAVIS_RUST_VERSION + # We need nightly for WASM build, we choose a specific version so the built and cached artifacts + # do not get invalidated every time a new nightly is released. + # Nightly isn't always released for all platforms on the same date, so we pick based on target + - | + if [ "$TARGET" = "x86_64-apple-darwin" ] + then + export NIGHTLY_RELEASE_DATE=2020-05-14 + else + export NIGHTLY_RELEASE_DATE=2020-05-23 + fi + - rustup update nightly-${NIGHTLY_RELEASE_DATE} + - rustup target add wasm32-unknown-unknown --toolchain nightly-${NIGHTLY_RELEASE_DATE} + # travis installs rust using rustup with the "minimal" profile so these tools are not installed by default - rustup component add rustfmt - rustup component add clippy - cargo fmt --all -- --check From e0ccff708e4e9fd87f206ab832d8b88231ce9a50 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sun, 24 May 2020 19:38:03 +0300 Subject: [PATCH 05/34] travis: test recompiling runtime with cargo cache enabled --- Cargo.lock | 2 +- runtime/Cargo.toml | 2 +- runtime/src/lib.rs | 2 +- runtime/src/migration.rs | 27 +++------------------------ 4 files changed, 6 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa4e3c8bba..ae87b728cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1614,7 +1614,7 @@ dependencies = [ [[package]] name = "joystream-node-runtime" -version = "6.13.0" +version = "6.14.0" dependencies = [ "parity-scale-codec", "safe-mix", diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index aa41d86893..ff48869367 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -5,7 +5,7 @@ edition = '2018' name = 'joystream-node-runtime' # Follow convention: https://github.com/Joystream/substrate-runtime-joystream/issues/1 # {Authoring}.{Spec}.{Impl} of the RuntimeVersion -version = '6.13.0' +version = '6.14.0' [features] default = ['std'] diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 4bae8353eb..41d67827df 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("joystream-node"), impl_name: create_runtime_str!("joystream-node"), authoring_version: 6, - spec_version: 13, + spec_version: 14, impl_version: 0, apis: RUNTIME_API_VERSIONS, }; diff --git a/runtime/src/migration.rs b/runtime/src/migration.rs index 7d9e76409a..3919253b45 100644 --- a/runtime/src/migration.rs +++ b/runtime/src/migration.rs @@ -3,7 +3,7 @@ use crate::VERSION; use rstd::prelude::*; -use sr_primitives::{print, traits::Zero}; +// use sr_primitives::{print, traits::Zero}; use srml_support::{debug, decl_event, decl_module, decl_storage}; impl Module { @@ -12,37 +12,16 @@ impl Module { /// Important to note this method should be carefully maintained, because it runs on every runtime /// upgrade. fn runtime_upgraded() { - print("Running runtime upgraded handler"); + debug::print!("Running runtime upgraded handler"); // Add initialization of modules introduced in new runtime release. Typically this // would be any new storage values that need an initial value which would not // have been initialized with config() or build() chainspec construction mechanism. // Other tasks like resetting values, migrating values etc. - - // Runtime Upgrade Code for going from Rome to Constantinople - - // Create the Council mint. If it fails, we can't do anything about it here. - if let Err(err) = governance::council::Module::::create_new_council_mint( - minting::BalanceOf::::zero(), - ) { - debug::warn!( - "Failed to create a mint for council during migration: {:?}", - err - ); - } - - // Initialise the proposal system various periods - proposals_codex::Module::::set_default_config_values(); } } -pub trait Trait: - system::Trait - + governance::election::Trait - + content_working_group::Trait - + roles::actors::Trait - + proposals_codex::Trait -{ +pub trait Trait: system::Trait { type Event: From> + Into<::Event>; } From 25835bab7fac3d7b3ee84d532a21395adb1fa16e Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sun, 24 May 2020 20:58:50 +0300 Subject: [PATCH 06/34] travis: fail if cargo test and clippy fail --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5e842314dd..aec139421d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,7 +58,7 @@ script: docker run -u root \ --volume ${TRAVIS_BUILD_DIR}:/home/cross/project \ joystream/rust-raspberry \ - test --release + test --release && \ docker run -u root \ --volume ${TRAVIS_BUILD_DIR}:/home/cross/project \ joystream/rust-raspberry \ @@ -73,8 +73,8 @@ script: docker cp temp-container-joystream-node:/joystream/runtime.compact.wasm joystream_runtime.wasm docker rm temp-container-joystream-node else - cargo test --release --verbose --all --target=${TARGET} - BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --target=${TARGET} -- -D warnings + cargo test --release --verbose --all --target=${TARGET} && \ + BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --target=${TARGET} -- -D warnings && \ cargo build --release --target=${TARGET} fi From ca7c8567a57e4cc8ea73804c583906a5757a39f8 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sun, 24 May 2020 21:23:44 +0300 Subject: [PATCH 07/34] scripts: no need to explicitly pull a docker image --- scripts/raspberry-cross-build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/raspberry-cross-build.sh b/scripts/raspberry-cross-build.sh index 69b2665528..83b95c569a 100755 --- a/scripts/raspberry-cross-build.sh +++ b/scripts/raspberry-cross-build.sh @@ -7,7 +7,6 @@ # joystream/rust-raspberry image was built from: # https://github.com/mnaamani/rust-on-raspberry-docker/commit/8536508b743d55c8573043c4082c62da3b4fd3e2 -docker pull joystream/rust-raspberry docker run \ --volume ${PWD}/:/home/cross/project \ From 53a706ae13ca3b106ba163934b9a3be6bfa86a1a Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sun, 24 May 2020 23:05:55 +0300 Subject: [PATCH 08/34] travis: disable cache again to test build time --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index aec139421d..421fedff25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,8 @@ language: rust # Caching of the runtime .wasm blob poses a problem. # See: https://github.com/Joystream/joystream/issues/466 -cache: cargo +# Testing removing caching again on build time.. +# cache: cargo rust: - 1.43.0 From 0b01fb188c2c2fb3799992217de2634d2505aaff Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 25 May 2020 10:19:59 +0300 Subject: [PATCH 09/34] travis: experiment with caching with just one travis job --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 421fedff25..4cf66e015c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,14 +12,14 @@ matrix: include: - os: linux env: TARGET=x86_64-unknown-linux-gnu - - os: linux - env: TARGET=arm-unknown-linux-gnueabihf - services: docker - - os: osx - env: TARGET=x86_64-apple-darwin - - os: linux - env: TARGET=wasm-blob - services: docker + # - os: linux + # env: TARGET=arm-unknown-linux-gnueabihf + # services: docker + # - os: osx + # env: TARGET=x86_64-apple-darwin + # - os: linux + # env: TARGET=wasm-blob + # services: docker before_install: # This is not needed since travis will install rust stable as the default, and just specifying From e272365a36b8cb79877330762b46ebdfbb36fb86 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 25 May 2020 10:37:52 +0300 Subject: [PATCH 10/34] travis: re-enable cargo cache --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4cf66e015c..c0d568d1cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,7 @@ language: rust # Caching of the runtime .wasm blob poses a problem. # See: https://github.com/Joystream/joystream/issues/466 -# Testing removing caching again on build time.. -# cache: cargo +cache: cargo rust: - 1.43.0 From a2ab7927184367bb205fba21325d83959b3e2042 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 25 May 2020 11:53:42 +0300 Subject: [PATCH 11/34] build.rs - make sure to trigger WASM build after dummy from clippy --- .travis.yml | 4 ++-- devops/dockerfiles/node-and-runtime/Dockerfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c0d568d1cf..68526761ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,9 +73,9 @@ script: docker cp temp-container-joystream-node:/joystream/runtime.compact.wasm joystream_runtime.wasm docker rm temp-container-joystream-node else - cargo test --release --verbose --all --target=${TARGET} && \ + BUILD_DUMMY_WASM_BINARY=0 cargo test --release --verbose --all --target=${TARGET} && \ BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --target=${TARGET} -- -D warnings && \ - cargo build --release --target=${TARGET} + BUILD_DUMMY_WASM_BINARY=0 WASM_BUILD_TOOLCHAIN=nightly-${NIGHTLY_RELEASE_DATE} cargo build --release --target=${TARGET} fi before_deploy: diff --git a/devops/dockerfiles/node-and-runtime/Dockerfile b/devops/dockerfiles/node-and-runtime/Dockerfile index 7ee95ffce9..35fc03ff3d 100644 --- a/devops/dockerfiles/node-and-runtime/Dockerfile +++ b/devops/dockerfiles/node-and-runtime/Dockerfile @@ -8,7 +8,7 @@ RUN BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release -- -D warnings RUN cargo test --release # Build joystream-node and its dependencies - runtime -RUN cargo build --release -p joystream-node +RUN BUILD_DUMMY_WASM_BINARY=0 cargo build --release -p joystream-node FROM debian:stretch LABEL description="Joystream node" From 0fcdf28c0c5b02016271c8dfba50243501515abd Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 25 May 2020 15:32:09 +0300 Subject: [PATCH 12/34] travis: clippy before test --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 68526761ca..af605fe6cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,9 +73,9 @@ script: docker cp temp-container-joystream-node:/joystream/runtime.compact.wasm joystream_runtime.wasm docker rm temp-container-joystream-node else - BUILD_DUMMY_WASM_BINARY=0 cargo test --release --verbose --all --target=${TARGET} && \ BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --target=${TARGET} -- -D warnings && \ - BUILD_DUMMY_WASM_BINARY=0 WASM_BUILD_TOOLCHAIN=nightly-${NIGHTLY_RELEASE_DATE} cargo build --release --target=${TARGET} + BUILD_DUMMY_WASM_BINARY=0 cargo test --release --verbose --all --target=${TARGET} && \ + WASM_BUILD_TOOLCHAIN=nightly-${NIGHTLY_RELEASE_DATE} cargo build --release --target=${TARGET} fi before_deploy: From f79739329ff9308a903bead54ef8c53c7413eb05 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 25 May 2020 19:16:11 +0300 Subject: [PATCH 13/34] travis: use nightly for clippy to avoid messing with env variables --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index af605fe6cc..c97a374fe6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,9 +73,9 @@ script: docker cp temp-container-joystream-node:/joystream/runtime.compact.wasm joystream_runtime.wasm docker rm temp-container-joystream-node else - BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --target=${TARGET} -- -D warnings && \ - BUILD_DUMMY_WASM_BINARY=0 cargo test --release --verbose --all --target=${TARGET} && \ - WASM_BUILD_TOOLCHAIN=nightly-${NIGHTLY_RELEASE_DATE} cargo build --release --target=${TARGET} + cargo +nightly clippy --release --target=${TARGET} -- -D warnings && \ + cargo +nightly test --release --verbose --all --target=${TARGET} && \ + cargo +nightly build --release --target=${TARGET} fi before_deploy: From 6fcd61a483ea8207ebb5f8938ae4db5d00140479 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 25 May 2020 20:14:46 +0300 Subject: [PATCH 14/34] travis: install clippy for nightly toolchain --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c97a374fe6..8a0105fed5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,7 @@ before_install: - rustup target add wasm32-unknown-unknown --toolchain nightly-${NIGHTLY_RELEASE_DATE} # travis installs rust using rustup with the "minimal" profile so these tools are not installed by default - rustup component add rustfmt - - rustup component add clippy + - rustup component add clippy --toolchain nightly-${NIGHTLY_RELEASE_DATE} - cargo fmt --all -- --check install: @@ -75,7 +75,7 @@ script: else cargo +nightly clippy --release --target=${TARGET} -- -D warnings && \ cargo +nightly test --release --verbose --all --target=${TARGET} && \ - cargo +nightly build --release --target=${TARGET} + WASM_BUILD_TOOLCHAIN=nightly-${NIGHTLY_RELEASE_DATE} cargo +nightly build --release --target=${TARGET} fi before_deploy: From 421ff7be45ddd047c381a2a2cf8fe42bb230b7e3 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 26 May 2020 12:01:10 +0300 Subject: [PATCH 15/34] travis, build scripts use nightly --- .travis.yml | 107 +++++------------- Cargo.lock | 2 +- .../dockerfiles/node-and-runtime/Dockerfile | 6 +- devops/git-hooks/pre-push | 4 +- runtime/Cargo.toml | 2 +- runtime/src/lib.rs | 2 +- scripts/cargo-build.sh | 4 + scripts/run-dev-chain.sh | 6 +- 8 files changed, 41 insertions(+), 92 deletions(-) create mode 100755 scripts/cargo-build.sh diff --git a/.travis.yml b/.travis.yml index 8a0105fed5..5566ecaedf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,99 +2,48 @@ language: rust # Caching of the runtime .wasm blob poses a problem. # See: https://github.com/Joystream/joystream/issues/466 -cache: cargo +# Always starting with a clean slate is probably better, it allows us to ensure +# the WASM runtime is always rebuilt. It also allows us to detect when certain upstream dependencies +# sometimes break the build. +# cache: cargo rust: - - 1.43.0 + - nightly matrix: include: - os: linux env: TARGET=x86_64-unknown-linux-gnu - # - os: linux - # env: TARGET=arm-unknown-linux-gnueabihf - # services: docker - # - os: osx - # env: TARGET=x86_64-apple-darwin - # - os: linux - # env: TARGET=wasm-blob - # services: docker + # Removed all other plaftorm builds sice the repo as growing in terms of activitly + # and CI checks are taking long to start due to concurrent no. of jobs + # one job should be sufficient for doing all manners of checks and unit nets, will defer + # building all platform binanires and wasm blob to a different system -before_install: - # This is not needed since travis will install rust stable as the default, and just specifying - # stable might be newer that version defined in the .travis.yml file and available - # as an env var: TRAVIS_RUST_VERSION - # - rustup default stable - # ensure main version is the default - - rustup default $TRAVIS_RUST_VERSION - # We need nightly for WASM build, we choose a specific version so the built and cached artifacts - # do not get invalidated every time a new nightly is released. - # Nightly isn't always released for all platforms on the same date, so we pick based on target - - | - if [ "$TARGET" = "x86_64-apple-darwin" ] - then - export NIGHTLY_RELEASE_DATE=2020-05-14 - else - export NIGHTLY_RELEASE_DATE=2020-05-23 - fi - - rustup update nightly-${NIGHTLY_RELEASE_DATE} - - rustup target add wasm32-unknown-unknown --toolchain nightly-${NIGHTLY_RELEASE_DATE} +install: + - rustup target add wasm32-unknown-unknown --toolchain nightly # travis installs rust using rustup with the "minimal" profile so these tools are not installed by default - - rustup component add rustfmt - - rustup component add clippy --toolchain nightly-${NIGHTLY_RELEASE_DATE} - - cargo fmt --all -- --check + - rustup component add rustfmt --tolchain nightly + # choosing to add clippy for the nightly toolchain only + # becuase we want to run it with nighly to avoid having to set BUILD_DUMMY_WASM_BINARY=0 + # setting that variable requires changing it in a later run of cargo bulid to ensure runtime/build.rs + # actually builds the runtime .. the behaviour is a bit odd so choosing to avoid messing with it. + - rustup component add clippy --toolchain nightly -install: - - | - if [ "$TARGET" = "arm-unknown-linux-gnueabihf" ] - then - docker pull joystream/rust-raspberry - fi +before_script: + - cargo +nightly fmt --all -- --check script: - - | - if [ "$TARGET" = "arm-unknown-linux-gnueabihf" ] - then - docker run -u root \ - --volume ${TRAVIS_BUILD_DIR}:/home/cross/project \ - joystream/rust-raspberry \ - test --release && \ - docker run -u root \ - --volume ${TRAVIS_BUILD_DIR}:/home/cross/project \ - joystream/rust-raspberry \ - build --release - sudo chmod a+r ${TRAVIS_BUILD_DIR}/target/${TARGET}/release/joystream-node - elif [ "$TARGET" = "wasm-blob" ] - then - docker build --tag joystream/node \ - --file ./devops/dockerfiles/node-and-runtime/Dockerfile \ - . - docker create --name temp-container-joystream-node joystream/node - docker cp temp-container-joystream-node:/joystream/runtime.compact.wasm joystream_runtime.wasm - docker rm temp-container-joystream-node - else - cargo +nightly clippy --release --target=${TARGET} -- -D warnings && \ - cargo +nightly test --release --verbose --all --target=${TARGET} && \ - WASM_BUILD_TOOLCHAIN=nightly-${NIGHTLY_RELEASE_DATE} cargo +nightly build --release --target=${TARGET} - fi + # we set release as build type for all steps to benefit from already compiled packages in prior steps + - cargo +nightly clippy --release --target=${TARGET} -- -D warnings + - cargo +nightly test --release --verbose --all --target=${TARGET} + - WASM_BUILD_TOOLCHAIN=nightly cargo +nightly build --release --target=${TARGET} before_deploy: - - | - if [ "$TARGET" = "wasm-blob" ] - then - export ASSET="joystream_runtime.wasm" - else - cp ./target/${TARGET}/release/joystream-node . - if [ "$TARGET" = "arm-unknown-linux-gnueabihf" ] - then - export FILENAME="joystream-node-armv7-linux-gnueabihf" - else - export FILENAME=`./joystream-node --version | sed -e "s/ /-/g"` - fi - tar -cf ${FILENAME}.tar ./joystream-node - gzip ${FILENAME}.tar - export ASSET=${FILENAME}.tar.gz - fi + - cp ./target/${TARGET}/release/joystream-node . + - FILENAME=`./joystream-node --version | sed -e "s/ /-/g"` + - tar -cf ${FILENAME}.tar ./joystream-node + - gzip ${FILENAME}.tar + - export ASSET=${FILENAME}.tar.gz deploy: - provider: releases diff --git a/Cargo.lock b/Cargo.lock index ae87b728cd..fa4e3c8bba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1614,7 +1614,7 @@ dependencies = [ [[package]] name = "joystream-node-runtime" -version = "6.14.0" +version = "6.13.0" dependencies = [ "parity-scale-codec", "safe-mix", diff --git a/devops/dockerfiles/node-and-runtime/Dockerfile b/devops/dockerfiles/node-and-runtime/Dockerfile index 35fc03ff3d..405d46116f 100644 --- a/devops/dockerfiles/node-and-runtime/Dockerfile +++ b/devops/dockerfiles/node-and-runtime/Dockerfile @@ -3,12 +3,8 @@ LABEL description="Compiles all workspace artifacts" WORKDIR /joystream COPY . /joystream -# Make sure tests pass before continuing -RUN BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release -- -D warnings -RUN cargo test --release - # Build joystream-node and its dependencies - runtime -RUN BUILD_DUMMY_WASM_BINARY=0 cargo build --release -p joystream-node +RUN cargo build --release -p joystream-node FROM debian:stretch LABEL description="Joystream node" diff --git a/devops/git-hooks/pre-push b/devops/git-hooks/pre-push index 9d718cdfe0..3129e05adc 100755 --- a/devops/git-hooks/pre-push +++ b/devops/git-hooks/pre-push @@ -2,7 +2,7 @@ set -e echo '+cargo test --release --all' -cargo test --release --all +cargo +nightly test --release --all echo '+cargo clippy --release --all -- -D warnings' -BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --all -- -D warnings \ No newline at end of file +cargo +nightly clippy --release --all -- -D warnings \ No newline at end of file diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index ff48869367..aa41d86893 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -5,7 +5,7 @@ edition = '2018' name = 'joystream-node-runtime' # Follow convention: https://github.com/Joystream/substrate-runtime-joystream/issues/1 # {Authoring}.{Spec}.{Impl} of the RuntimeVersion -version = '6.14.0' +version = '6.13.0' [features] default = ['std'] diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 41d67827df..4bae8353eb 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("joystream-node"), impl_name: create_runtime_str!("joystream-node"), authoring_version: 6, - spec_version: 14, + spec_version: 13, impl_version: 0, apis: RUNTIME_API_VERSIONS, }; diff --git a/scripts/cargo-build.sh b/scripts/cargo-build.sh new file mode 100755 index 0000000000..3de1b3c800 --- /dev/null +++ b/scripts/cargo-build.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -e + +cargo +nightly build --release \ No newline at end of file diff --git a/scripts/run-dev-chain.sh b/scripts/run-dev-chain.sh index cd3310e77e..1e5423d579 100755 --- a/scripts/run-dev-chain.sh +++ b/scripts/run-dev-chain.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash # Build release binary -cargo build --release -p joystream-node +cargo +nightly build --release -p joystream-node # Purge existing local chain -yes | cargo run --release -p joystream-node -- purge-chain --dev +yes | cargo +nightly run --release -p joystream-node -- purge-chain --dev # Run local development chain -cargo run --release -p joystream-node -- --dev +cargo +nightly run --release -p joystream-node -- --dev From 80749a70cc6ecdb029e1c4106c44532390a0198a Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 26 May 2020 12:24:00 +0300 Subject: [PATCH 16/34] travis: cache enabled --- .travis.yml | 17 ++++++++++------- package.json | 4 +++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5566ecaedf..3c6ee7823d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,20 +4,23 @@ language: rust # See: https://github.com/Joystream/joystream/issues/466 # Always starting with a clean slate is probably better, it allows us to ensure # the WASM runtime is always rebuilt. It also allows us to detect when certain upstream dependencies -# sometimes break the build. -# cache: cargo +# sometimes break the build. When cache is enabled do not use the produced WASM build. +# This also means the binary should not be used to produce the final chainspec file (because the same +# one is embedded in the binary) +cache: cargo rust: + # living on the edge.. - nightly matrix: include: - os: linux env: TARGET=x86_64-unknown-linux-gnu - # Removed all other plaftorm builds sice the repo as growing in terms of activitly - # and CI checks are taking long to start due to concurrent no. of jobs - # one job should be sufficient for doing all manners of checks and unit nets, will defer - # building all platform binanires and wasm blob to a different system + # Removed all other plaftorm builds sice the repo is growing in terms of activitly + # and CI checks are taking long to start due to concurrent number of jobs + # one job should be sufficient for doing all manners of checks and unit nets. Will defer + # building all platform binanires and wasm blob to a different system. install: - rustup target add wasm32-unknown-unknown --toolchain nightly @@ -39,7 +42,7 @@ script: - WASM_BUILD_TOOLCHAIN=nightly cargo +nightly build --release --target=${TARGET} before_deploy: - - cp ./target/${TARGET}/release/joystream-node . + - FILENAME=`./joystream-node --version | sed -e "s/ /-/g"` - tar -cf ${FILENAME}.tar ./joystream-node - gzip ${FILENAME}.tar diff --git a/package.json b/package.json index 152151b372..13671b0d71 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "license": "GPL-3.0-only", "scripts": { "test": "yarn && yarn workspaces run test", - "test-migration": "yarn && yarn workspaces run test-migration" + "test-migration": "yarn && yarn workspaces run test-migration", + "cargo-checks": "devops/git-hooks/pre-commit && devops/git-hooks/pre-push", + "cargo-build": "yarn cargo-checks && scripts/cargo-build.sh" }, "workspaces": [ "tests/network-tests" From ed157e49a10dd49b81b1b9e5ef2bfd9ba420d8b3 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 26 May 2020 12:30:37 +0300 Subject: [PATCH 17/34] travi: typo fix --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3c6ee7823d..8fccbf4815 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ matrix: install: - rustup target add wasm32-unknown-unknown --toolchain nightly # travis installs rust using rustup with the "minimal" profile so these tools are not installed by default - - rustup component add rustfmt --tolchain nightly + - rustup component add rustfmt --toolchain nightly # choosing to add clippy for the nightly toolchain only # becuase we want to run it with nighly to avoid having to set BUILD_DUMMY_WASM_BINARY=0 # setting that variable requires changing it in a later run of cargo bulid to ensure runtime/build.rs From 9fcd2aa590df40413ae0933a57b6271b7e9a87d9 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 26 May 2020 12:35:48 +0300 Subject: [PATCH 18/34] travis: rustfmt not available in nightly? --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8fccbf4815..8df827eae8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ matrix: install: - rustup target add wasm32-unknown-unknown --toolchain nightly # travis installs rust using rustup with the "minimal" profile so these tools are not installed by default - - rustup component add rustfmt --toolchain nightly + - rustup component add rustfmt # choosing to add clippy for the nightly toolchain only # becuase we want to run it with nighly to avoid having to set BUILD_DUMMY_WASM_BINARY=0 # setting that variable requires changing it in a later run of cargo bulid to ensure runtime/build.rs @@ -33,7 +33,7 @@ install: - rustup component add clippy --toolchain nightly before_script: - - cargo +nightly fmt --all -- --check + - cargo fmt --all -- --check script: # we set release as build type for all steps to benefit from already compiled packages in prior steps From 66a8fead122f939eff4e9f15755f10de1fcf0365 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 26 May 2020 12:52:44 +0300 Subject: [PATCH 19/34] travis: rust stable by default and add nightly --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8df827eae8..4f7da74d1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,7 @@ language: rust cache: cargo rust: - # living on the edge.. - - nightly + - stable matrix: include: @@ -23,6 +22,7 @@ matrix: # building all platform binanires and wasm blob to a different system. install: + - rustup update nightly - rustup target add wasm32-unknown-unknown --toolchain nightly # travis installs rust using rustup with the "minimal" profile so these tools are not installed by default - rustup component add rustfmt From 677ea26d987fba13dac17a317ed5e0b94012abcc Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 26 May 2020 13:33:40 +0300 Subject: [PATCH 20/34] runtime wasm builder: try newer version to ensure always building for host target --- package.json | 2 +- runtime/Cargo.toml | 2 +- runtime/build.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 13671b0d71..9f6df7a0b5 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "test": "yarn && yarn workspaces run test", "test-migration": "yarn && yarn workspaces run test-migration", "cargo-checks": "devops/git-hooks/pre-commit && devops/git-hooks/pre-push", - "cargo-build": "yarn cargo-checks && scripts/cargo-build.sh" + "cargo-build": "scripts/cargo-build.sh" }, "workspaces": [ "tests/network-tests" diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index aa41d86893..af968103a5 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -272,7 +272,7 @@ rev = 'c37bb08535c49a12320af7facfd555ce05cce2e8' [build-dependencies.wasm-builder-runner] package = 'substrate-wasm-builder-runner' -version = '1.0.4' +version = '1.0.5' [dependencies.forum] default_features = false diff --git a/runtime/build.rs b/runtime/build.rs index 02f0cdb0f5..828f0ef5c2 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -24,7 +24,7 @@ fn main() { } let file_name = "wasm_binary.rs"; - let wasm_builder_source = WasmBuilderSource::Crates("1.0.8"); + let wasm_builder_source = WasmBuilderSource::Crates("1.0.9"); // This instructs LLD to export __heap_base as a global variable, which is used by the // external memory allocator. let default_rust_flags = "-Clink-arg=--export=__heap_base"; From a6d7e11424fe3bf947ec5dce519e65f105f5f121 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 27 May 2020 15:44:32 +0300 Subject: [PATCH 21/34] travis: load cache, but dump it - just testing! --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4f7da74d1a..10c49c2154 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,6 +36,10 @@ before_script: - cargo fmt --all -- --check script: + # dump the cache + - cargo clean + - rm -fr ~/.cargo/git + - rm -fr ~/.cargo/registry # we set release as build type for all steps to benefit from already compiled packages in prior steps - cargo +nightly clippy --release --target=${TARGET} -- -D warnings - cargo +nightly test --release --verbose --all --target=${TARGET} From c41b5ee7032f4d62823103d72b504482bd4da35e Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 27 May 2020 16:18:10 +0300 Subject: [PATCH 22/34] travis: skipping clippy --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 10c49c2154..1051938479 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,8 @@ script: - rm -fr ~/.cargo/git - rm -fr ~/.cargo/registry # we set release as build type for all steps to benefit from already compiled packages in prior steps - - cargo +nightly clippy --release --target=${TARGET} -- -D warnings + # skipping clippy ... + # - cargo +nightly clippy --release --target=${TARGET} -- -D warnings - cargo +nightly test --release --verbose --all --target=${TARGET} - WASM_BUILD_TOOLCHAIN=nightly cargo +nightly build --release --target=${TARGET} From 18318650081879c122302de873c3f426f6bccbdc Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 27 May 2020 16:50:43 +0300 Subject: [PATCH 23/34] travis: -Z minimal-versions flag for cargo build --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1051938479..76f8a9e512 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,8 +43,8 @@ script: # we set release as build type for all steps to benefit from already compiled packages in prior steps # skipping clippy ... # - cargo +nightly clippy --release --target=${TARGET} -- -D warnings - - cargo +nightly test --release --verbose --all --target=${TARGET} - - WASM_BUILD_TOOLCHAIN=nightly cargo +nightly build --release --target=${TARGET} + - cargo +nightly -Z minimal-versions test --release --verbose --all --target=${TARGET} + - WASM_BUILD_TOOLCHAIN=nightly cargo +nightly -Z minimal-versions build --release --target=${TARGET} before_deploy: From e48ba1fcd4175910d2056372754ed02e6da5d01f Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 27 May 2020 19:16:45 +0300 Subject: [PATCH 24/34] travis: rust nightly lock to version 2020-05-22 build fails in newer version --- .travis.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 76f8a9e512..73095b9917 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,29 +22,25 @@ matrix: # building all platform binanires and wasm blob to a different system. install: - - rustup update nightly - - rustup target add wasm32-unknown-unknown --toolchain nightly + - rustup update install nightly-2020-05-22 + - rustup target add wasm32-unknown-unknown --toolchain nightly-2020-05-22 # travis installs rust using rustup with the "minimal" profile so these tools are not installed by default - rustup component add rustfmt # choosing to add clippy for the nightly toolchain only # becuase we want to run it with nighly to avoid having to set BUILD_DUMMY_WASM_BINARY=0 # setting that variable requires changing it in a later run of cargo bulid to ensure runtime/build.rs # actually builds the runtime .. the behaviour is a bit odd so choosing to avoid messing with it. - - rustup component add clippy --toolchain nightly + - rustup component add clippy --toolchain nightly-2020-05-22 before_script: - cargo fmt --all -- --check script: - # dump the cache - - cargo clean - - rm -fr ~/.cargo/git - - rm -fr ~/.cargo/registry # we set release as build type for all steps to benefit from already compiled packages in prior steps # skipping clippy ... - # - cargo +nightly clippy --release --target=${TARGET} -- -D warnings - - cargo +nightly -Z minimal-versions test --release --verbose --all --target=${TARGET} - - WASM_BUILD_TOOLCHAIN=nightly cargo +nightly -Z minimal-versions build --release --target=${TARGET} + - cargo +nightly clippy --release --target=${TARGET} -- -D warnings + - cargo +nightly test --release --verbose --all --target=${TARGET} + - WASM_BUILD_TOOLCHAIN=nightly-2020-05-22 cargo +nightly build --release --target=${TARGET} before_deploy: From 75d497ba8e005e4bc7ad01e3232d3762b8ce0133 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 27 May 2020 19:31:12 +0300 Subject: [PATCH 25/34] travis: typo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 73095b9917..614b573029 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ matrix: # building all platform binanires and wasm blob to a different system. install: - - rustup update install nightly-2020-05-22 + - rustup install nightly-2020-05-22 - rustup target add wasm32-unknown-unknown --toolchain nightly-2020-05-22 # travis installs rust using rustup with the "minimal" profile so these tools are not installed by default - rustup component add rustfmt From d68d86d065e4a03eb930c439615afbf28109cdad Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 27 May 2020 19:49:45 +0300 Subject: [PATCH 26/34] travis: correct nightly for all steps --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 614b573029..fb0453287f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,8 +38,8 @@ before_script: script: # we set release as build type for all steps to benefit from already compiled packages in prior steps # skipping clippy ... - - cargo +nightly clippy --release --target=${TARGET} -- -D warnings - - cargo +nightly test --release --verbose --all --target=${TARGET} + - cargo +nightly-2020-05-22 clippy --release --target=${TARGET} -- -D warnings + - cargo +nightly-2020-05-22 test --release --verbose --all --target=${TARGET} - WASM_BUILD_TOOLCHAIN=nightly-2020-05-22 cargo +nightly build --release --target=${TARGET} before_deploy: From f382ca3a2dc62471db5894223ce751b14eb4051f Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 27 May 2020 19:53:20 +0300 Subject: [PATCH 27/34] travis: rust nightly 2020-05-23 --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index fb0453287f..f4fb423376 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,15 +22,15 @@ matrix: # building all platform binanires and wasm blob to a different system. install: - - rustup install nightly-2020-05-22 - - rustup target add wasm32-unknown-unknown --toolchain nightly-2020-05-22 + - rustup install nightly-2020-05-23 + - rustup target add wasm32-unknown-unknown --toolchain nightly-2020-05-23 # travis installs rust using rustup with the "minimal" profile so these tools are not installed by default - rustup component add rustfmt # choosing to add clippy for the nightly toolchain only # becuase we want to run it with nighly to avoid having to set BUILD_DUMMY_WASM_BINARY=0 # setting that variable requires changing it in a later run of cargo bulid to ensure runtime/build.rs # actually builds the runtime .. the behaviour is a bit odd so choosing to avoid messing with it. - - rustup component add clippy --toolchain nightly-2020-05-22 + - rustup component add clippy --toolchain nightly-2020-05-23 before_script: - cargo fmt --all -- --check @@ -38,9 +38,9 @@ before_script: script: # we set release as build type for all steps to benefit from already compiled packages in prior steps # skipping clippy ... - - cargo +nightly-2020-05-22 clippy --release --target=${TARGET} -- -D warnings - - cargo +nightly-2020-05-22 test --release --verbose --all --target=${TARGET} - - WASM_BUILD_TOOLCHAIN=nightly-2020-05-22 cargo +nightly build --release --target=${TARGET} + - cargo +nightly-2020-05-23 clippy --release --target=${TARGET} -- -D warnings + - cargo +nightly-2020-05-23 test --release --verbose --all --target=${TARGET} + - WASM_BUILD_TOOLCHAIN=nightly-2020-05-23 cargo +nightly build --release --target=${TARGET} before_deploy: From fddbc222cc7cd1ea92a581ef438733e5866da9a2 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 27 May 2020 21:00:43 +0300 Subject: [PATCH 28/34] travis: too many clippy errors with nightly! --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4fb423376..f1b64a482d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ install: # becuase we want to run it with nighly to avoid having to set BUILD_DUMMY_WASM_BINARY=0 # setting that variable requires changing it in a later run of cargo bulid to ensure runtime/build.rs # actually builds the runtime .. the behaviour is a bit odd so choosing to avoid messing with it. - - rustup component add clippy --toolchain nightly-2020-05-23 + - rustup component add clippy before_script: - cargo fmt --all -- --check @@ -38,9 +38,9 @@ before_script: script: # we set release as build type for all steps to benefit from already compiled packages in prior steps # skipping clippy ... - - cargo +nightly-2020-05-23 clippy --release --target=${TARGET} -- -D warnings - - cargo +nightly-2020-05-23 test --release --verbose --all --target=${TARGET} - - WASM_BUILD_TOOLCHAIN=nightly-2020-05-23 cargo +nightly build --release --target=${TARGET} + - BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --target=${TARGET} -- -D warnings + - cargo test --release --verbose --all --target=${TARGET} + - BUILD_DUMMY_WASM_BINARY=0 WASM_BUILD_TOOLCHAIN=nightly-2020-05-23 cargo build --release --target=${TARGET} before_deploy: From 069c68f478eb6b9d2f21a428b894dabece2b2f6a Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 27 May 2020 21:19:44 +0300 Subject: [PATCH 29/34] travis: return cp task removed accidentally --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f1b64a482d..396deb9097 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,7 +43,7 @@ script: - BUILD_DUMMY_WASM_BINARY=0 WASM_BUILD_TOOLCHAIN=nightly-2020-05-23 cargo build --release --target=${TARGET} before_deploy: - + - cp ./target/${TARGET}/release/joystream-node . - FILENAME=`./joystream-node --version | sed -e "s/ /-/g"` - tar -cf ${FILENAME}.tar ./joystream-node - gzip ${FILENAME}.tar From a288ad74083abff63be47d948f429e53de509fd3 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 27 May 2020 22:18:47 +0300 Subject: [PATCH 30/34] travis: try to skip wasm build when running tests --- .travis.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 396deb9097..64bce7b971 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ language: rust # sometimes break the build. When cache is enabled do not use the produced WASM build. # This also means the binary should not be used to produce the final chainspec file (because the same # one is embedded in the binary) -cache: cargo +# cache: cargo rust: - stable @@ -38,9 +38,11 @@ before_script: script: # we set release as build type for all steps to benefit from already compiled packages in prior steps # skipping clippy ... + - cargo clean - BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --target=${TARGET} -- -D warnings - - cargo test --release --verbose --all --target=${TARGET} - - BUILD_DUMMY_WASM_BINARY=0 WASM_BUILD_TOOLCHAIN=nightly-2020-05-23 cargo build --release --target=${TARGET} + - BUILD_DUMMY_WASM_BINARY=1 cargo test --release --verbose --all --target=${TARGET} + - BUILD_DUMMY_WASM_BINARY=0 WASM_BUILD_TOOLCHAIN=nightly-2020-05-23 cargo build --release --target=${TARGET} -p joystream-node + - ls -l target/release/wbuild/joystream-node-runtime before_deploy: - cp ./target/${TARGET}/release/joystream-node . From 3a7d252e4888d32f5552b809da5e634dd215102d Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 27 May 2020 23:20:09 +0300 Subject: [PATCH 31/34] travis: fix path to target folder --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 64bce7b971..621d9351e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ language: rust # sometimes break the build. When cache is enabled do not use the produced WASM build. # This also means the binary should not be used to produce the final chainspec file (because the same # one is embedded in the binary) -# cache: cargo +cache: cargo rust: - stable @@ -42,7 +42,7 @@ script: - BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --target=${TARGET} -- -D warnings - BUILD_DUMMY_WASM_BINARY=1 cargo test --release --verbose --all --target=${TARGET} - BUILD_DUMMY_WASM_BINARY=0 WASM_BUILD_TOOLCHAIN=nightly-2020-05-23 cargo build --release --target=${TARGET} -p joystream-node - - ls -l target/release/wbuild/joystream-node-runtime + - ls -l ./target/${TARGET}/release/wbuild/joystream-node-runtime/ before_deploy: - cp ./target/${TARGET}/release/joystream-node . From a700e2738cfbf6643c48a534f4c45f179edccb8a Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 27 May 2020 23:22:22 +0300 Subject: [PATCH 32/34] travis: re-enable caching now that build is working --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 621d9351e8..0a67cafa04 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,6 @@ before_script: script: # we set release as build type for all steps to benefit from already compiled packages in prior steps # skipping clippy ... - - cargo clean - BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --target=${TARGET} -- -D warnings - BUILD_DUMMY_WASM_BINARY=1 cargo test --release --verbose --all --target=${TARGET} - BUILD_DUMMY_WASM_BINARY=0 WASM_BUILD_TOOLCHAIN=nightly-2020-05-23 cargo build --release --target=${TARGET} -p joystream-node From 0ad8eb24b535b60fe3bda2e1706ac397a5f74fe6 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 28 May 2020 00:17:51 +0300 Subject: [PATCH 33/34] build scripts: restore to using stable for test and clippy --- devops/git-hooks/pre-push | 6 ++++-- scripts/cargo-build.sh | 3 +-- scripts/run-dev-chain.sh | 6 +++--- setup.sh | 7 +++++++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/devops/git-hooks/pre-push b/devops/git-hooks/pre-push index 3129e05adc..f4a33ba866 100755 --- a/devops/git-hooks/pre-push +++ b/devops/git-hooks/pre-push @@ -2,7 +2,9 @@ set -e echo '+cargo test --release --all' -cargo +nightly test --release --all +BUILD_DUMMY_WASM_BINARY=1 cargo test --release --all echo '+cargo clippy --release --all -- -D warnings' -cargo +nightly clippy --release --all -- -D warnings \ No newline at end of file +BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --all -- -D warnings + + diff --git a/scripts/cargo-build.sh b/scripts/cargo-build.sh index 3de1b3c800..a5563623a8 100755 --- a/scripts/cargo-build.sh +++ b/scripts/cargo-build.sh @@ -1,4 +1,3 @@ #!/bin/sh -set -e -cargo +nightly build --release \ No newline at end of file +cargo build --release \ No newline at end of file diff --git a/scripts/run-dev-chain.sh b/scripts/run-dev-chain.sh index 1e5423d579..cd3310e77e 100755 --- a/scripts/run-dev-chain.sh +++ b/scripts/run-dev-chain.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash # Build release binary -cargo +nightly build --release -p joystream-node +cargo build --release -p joystream-node # Purge existing local chain -yes | cargo +nightly run --release -p joystream-node -- purge-chain --dev +yes | cargo run --release -p joystream-node -- purge-chain --dev # Run local development chain -cargo +nightly run --release -p joystream-node -- --dev +cargo run --release -p joystream-node -- --dev diff --git a/setup.sh b/setup.sh index 9260f9f155..56ab7a46c9 100755 --- a/setup.sh +++ b/setup.sh @@ -9,7 +9,14 @@ set -e # - skips installing substrate and subkey curl https://getsubstrate.io -sSf | bash -s -- --fast +source ~/.cargo/env + rustup component add rustfmt clippy # TODO: Install additional tools... + # - b2sum +# - nodejs +# - npm +# - yarn +# .... ? \ No newline at end of file From 245740e95446b29346689ab78dad89b4366db143 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 28 May 2020 10:00:16 +0300 Subject: [PATCH 34/34] git-hooks: keep cargo test and clippy in debug mode This way env var BUILD_DUMMY_WASM_BINARY with cargo build --release --- devops/git-hooks/pre-push | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devops/git-hooks/pre-push b/devops/git-hooks/pre-push index f4a33ba866..553608c38a 100755 --- a/devops/git-hooks/pre-push +++ b/devops/git-hooks/pre-push @@ -2,9 +2,9 @@ set -e echo '+cargo test --release --all' -BUILD_DUMMY_WASM_BINARY=1 cargo test --release --all +BUILD_DUMMY_WASM_BINARY=1 cargo test --all echo '+cargo clippy --release --all -- -D warnings' -BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --all -- -D warnings +BUILD_DUMMY_WASM_BINARY=1 cargo clippy --all -- -D warnings