From 5598ed9bf3356120dc84dc09fc00b1c798945d35 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 29 Nov 2019 16:12:16 +0100 Subject: [PATCH] Add WASM CI checks and make availability-store compile for WASM (#626) * Make availability-store compile for WASM * Use --manifest-path instead --- .gitlab-ci.yml | 21 +++++++++++++++++++-- availability-store/Cargo.toml | 4 +++- availability-store/src/lib.rs | 3 ++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e175b10c8924e..95db591412625 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,7 +40,7 @@ variables: .docker-env: &docker-env retry: max: 2 - when: + when: - runner_system_failure - unknown_failure - api_failure @@ -131,6 +131,23 @@ test-linux-stable: &test - sccache -s +check-web-wasm: &test + stage: test + <<: *test-refs + <<: *docker-env + <<: *compiler_info + script: + # WASM support is in progress. As more and more crates support WASM, we + # should add entries here. See https://github.com/paritytech/polkadot/issues/625 + - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path availability-store/Cargo.toml + - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path executor/Cargo.toml + - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path erasure-coding/Cargo.toml + - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path parachain/Cargo.toml + - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path primitives/Cargo.toml + - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path rpc/Cargo.toml + - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path runtime/Cargo.toml + - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path statement-table/Cargo.toml + - sccache -s build-linux-release: &build @@ -209,7 +226,7 @@ publish-docker-release: - docker build --build-arg VCS_REF="${CI_COMMIT_SHA}" --build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" - --tag $CONTAINER_IMAGE:$VERSION + --tag $CONTAINER_IMAGE:$VERSION --tag $CONTAINER_IMAGE:$EXTRATAG . - docker push $CONTAINER_IMAGE:$VERSION - docker push $CONTAINER_IMAGE:$EXTRATAG diff --git a/availability-store/Cargo.toml b/availability-store/Cargo.toml index 011d6de084998..2c76666686bae 100644 --- a/availability-store/Cargo.toml +++ b/availability-store/Cargo.toml @@ -12,5 +12,7 @@ log = "0.4.8" codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] } substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } kvdb = "0.1.1" -kvdb-rocksdb = "0.2" kvdb-memorydb = "0.1.2" + +[target.'cfg(not(target_os = "unknown"))'.dependencies] +kvdb-rocksdb = "0.2" diff --git a/availability-store/src/lib.rs b/availability-store/src/lib.rs index 0e2cee18252ad..9053bc67dc9c5 100644 --- a/availability-store/src/lib.rs +++ b/availability-store/src/lib.rs @@ -22,7 +22,6 @@ use codec::{Encode, Decode}; use kvdb::{KeyValueDB, DBTransaction}; -use kvdb_rocksdb::{Database, DatabaseConfig}; use polkadot_primitives::Hash; use polkadot_primitives::parachain::{Id as ParaId, BlockData, Message}; use log::warn; @@ -74,7 +73,9 @@ pub struct Store { impl Store { /// Create a new `Store` with given config on disk. + #[cfg(not(target_os = "unknown"))] pub fn new(config: Config) -> io::Result { + use kvdb_rocksdb::{Database, DatabaseConfig}; let mut db_config = DatabaseConfig::with_columns(Some(columns::NUM_COLUMNS)); if let Some(cache_size) = config.cache_size {