From 061e921c3111e21aeacf4819d08d575b62617280 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Wed, 26 Aug 2020 10:56:15 +0200 Subject: [PATCH] Pull out all wasm builds into separate section --- .circleci/config.yml | 82 +++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 54 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1116c1f86..ab0f4ee20 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,6 +14,7 @@ workflows: - package_cw20 - package_cw721 - lint + - wasm-build deploy: jobs: - build_and_upload_contracts: @@ -37,16 +38,10 @@ jobs: - restore_cache: keys: - cargocache-cw1-subkeys-rust:1.44.1-{{ checksum "~/project/Cargo.lock" }} - - run: - name: Add wasm32 target - command: rustup target add wasm32-unknown-unknown - run: name: Unit Tests env: RUST_BACKTRACE=1 command: cargo unit-test --locked - - run: - name: Build Wasm - command: cargo wasm --locked - run: name: Build and run schema generator command: cargo schema --locked @@ -78,16 +73,10 @@ jobs: - restore_cache: keys: - cargocache-cw1-whitelist-rust:1.44.1-{{ checksum "~/project/Cargo.lock" }} - - run: - name: Add wasm32 target - command: rustup target add wasm32-unknown-unknown - run: name: Unit Tests env: RUST_BACKTRACE=1 command: cargo unit-test --locked - - run: - name: Build Wasm - command: cargo wasm --locked - run: name: Build and run schema generator command: cargo schema --locked @@ -119,16 +108,10 @@ jobs: - restore_cache: keys: - cargocache-cw20-base-rust:1.44.1-{{ checksum "~/project/Cargo.lock" }} - - run: - name: Add wasm32 target - command: rustup target add wasm32-unknown-unknown - run: name: Unit Tests env: RUST_BACKTRACE=1 command: cargo unit-test --locked - - run: - name: Build Wasm - command: cargo wasm --locked - run: name: Build and run schema generator command: cargo schema --locked @@ -160,16 +143,10 @@ jobs: - restore_cache: keys: - cargocache-cw20-escrow-rust:1.44.1-{{ checksum "~/project/Cargo.lock" }} - - run: - name: Add wasm32 target - command: rustup target add wasm32-unknown-unknown - run: name: Unit Tests env: RUST_BACKTRACE=1 command: cargo unit-test --locked - - run: - name: Build Wasm - command: cargo wasm --locked - run: name: Build and run schema generator command: cargo schema --locked @@ -201,16 +178,10 @@ jobs: - restore_cache: keys: - cargocache-cw20-staking-rust:1.44.1-{{ checksum "~/project/Cargo.lock" }} - - run: - name: Add wasm32 target - command: rustup target add wasm32-unknown-unknown - run: name: Unit Tests env: RUST_BACKTRACE=1 command: cargo unit-test --locked - - run: - name: Build Wasm - command: cargo wasm --locked - run: name: Build and run schema generator command: cargo schema --locked @@ -267,15 +238,9 @@ jobs: - restore_cache: keys: - cargocache-v2-cw1:1.44.1-{{ checksum "~/project/Cargo.lock" }} - - run: - name: Add wasm32 target - command: rustup target add wasm32-unknown-unknown && rustup target list --installed - run: name: Build library for native target command: cargo build --locked - - run: - name: Build library for wasm target - command: cargo wasm --locked - run: name: Run unit tests command: cargo test --locked @@ -310,15 +275,9 @@ jobs: - restore_cache: keys: - cargocache-v2-cw2:1.44.1-{{ checksum "~/project/Cargo.lock" }} - - run: - name: Add wasm32 target - command: rustup target add wasm32-unknown-unknown && rustup target list --installed - run: name: Build library for native target command: cargo build --locked - - run: - name: Build library for wasm target - command: cargo wasm --locked - run: name: Run unit tests command: cargo test --locked @@ -342,15 +301,9 @@ jobs: - restore_cache: keys: - cargocache-v2-cw20:1.44.1-{{ checksum "~/project/Cargo.lock" }} - - run: - name: Add wasm32 target - command: rustup target add wasm32-unknown-unknown && rustup target list --installed - run: name: Build library for native target command: cargo build --locked - - run: - name: Build library for wasm target - command: cargo wasm --locked - run: name: Run unit tests command: cargo test --locked @@ -385,15 +338,9 @@ jobs: - restore_cache: keys: - cargocache-v2-cw721:1.44.1-{{ checksum "~/project/Cargo.lock" }} - - run: - name: Add wasm32 target - command: rustup target add wasm32-unknown-unknown && rustup target list --installed - run: name: Build library for native target command: cargo build --locked - - run: - name: Build library for wasm target - command: cargo wasm --locked - run: name: Run unit tests command: cargo test --locked @@ -446,6 +393,33 @@ jobs: - target/debug/deps key: cargocache-v2-lint-rust:1.44.1-{{ checksum "Cargo.lock" }} + # this runs one time on the top level to ensure all contracts compile properly into wasm + # we don't run the wasm build and the reuse a lot of the same dependencies, so this should speed up CI time + # for all the other tests + wasm-build: + docker: + - image: rust:1.44.1 + steps: + - checkout: + path: ~/project + - run: + name: Version information + command: rustc --version; cargo --version; rustup --version + - restore_cache: + keys: + - cargocache-wasm-rust:1.44.1-{{ checksum "~/project/Cargo.lock" }} + - run: + name: Add wasm32 target + command: rustup target add wasm32-unknown-unknown + - run: + name: Build Wasm Release + command: cargo build --release --target wasm32-unknown-unknown --locked + - save_cache: + paths: + - /usr/local/cargo/registry + - target + key: cargocache-wasm-rust:1.44.1-{{ checksum "~/project/Cargo.lock" }} + # This job roughly follows the instructions from https://circleci.com/blog/publishing-to-github-releases-via-circleci/ build_and_upload_contracts: docker: