The procedural macro `#[maybe_async]` makes a method or every method of a trait "async" whenever the target_arch is `wasm32`, and leaves them untouched on every other platform. The macro `maybe_await!($e:expr)` can be used to call `maybe_async` methods on multi-platform code: it expands to `$e` on non-wasm32 platforms and to `$e.await` on wasm32. The macro `await_or_block!($e:expr)` can be used to contain async code as much as possible: it expands to `tokio::runtime::Runtime::new().unwrap().block_on($e)` on non-wasm32 platforms, and to `$e.await` on wasm32.
29 lines
1.1 KiB
YAML
29 lines
1.1 KiB
YAML
language: rust
|
|
rust:
|
|
- stable
|
|
before_script:
|
|
# Install a recent version of clang that supports wasm32
|
|
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
|
- sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main"
|
|
- sudo apt-get update
|
|
- sudo apt-get install -y clang-10 libc6-dev-i386
|
|
# Install the required components and targets
|
|
- rustup component add rustfmt
|
|
- rustup target add wasm32-unknown-unknown
|
|
script:
|
|
- cargo fmt -- --check --verbose
|
|
- cargo test --verbose --all
|
|
- cargo build --verbose --all
|
|
- cargo build --verbose --no-default-features --features=minimal
|
|
- cargo build --verbose --no-default-features --features=minimal,esplora
|
|
- cargo build --verbose --no-default-features --features=key-value-db
|
|
- cargo build --verbose --no-default-features --features=electrum
|
|
- CC="clang-10" CFLAGS="-I/usr/include" cargo build --verbose --no-default-features --features=cli-utils,esplora --target=wasm32-unknown-unknown
|
|
|
|
notifications:
|
|
email: false
|
|
|
|
before_cache:
|
|
- rm -rf "$TRAVIS_HOME/.cargo/registry/src"
|
|
cache: cargo
|