Skip to content

Commit

Permalink
Pull out all wasm builds into separate section
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Aug 26, 2020
1 parent c91ebef commit 061e921
Showing 1 changed file with 28 additions and 54 deletions.
82 changes: 28 additions & 54 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ workflows:
- package_cw20
- package_cw721
- lint
- wasm-build
deploy:
jobs:
- build_and_upload_contracts:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 061e921

Please sign in to comment.