Browse Source

travis, build scripts use nightly

Mokhtar Naamani 4 years ago
parent
commit
421ff7be45

+ 28 - 79
.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

+ 1 - 1
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",

+ 1 - 5
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"

+ 2 - 2
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
+cargo +nightly clippy --release --all -- -D warnings

+ 1 - 1
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']

+ 1 - 1
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,
 };

+ 4 - 0
scripts/cargo-build.sh

@@ -0,0 +1,4 @@
+#!/bin/sh
+set -e
+
+cargo +nightly build --release

+ 3 - 3
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