diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..2bebe3d07 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,160 @@ +on: + pull_request: + push: + branches: + - master + +name: Continuous integration + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - name: Rust Cache + uses: Swatinem/rust-cache@v1.3.0 + + - uses: actions-rs/cargo@v1 + with: + command: check + args: --workspace --all-targets + + test: + name: Test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + - macOS-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - name: Rust Cache + uses: Swatinem/rust-cache@v1.3.0 + + - name: Remove msys64 # Workaround to resolve link error with C:\msys64\mingw64\bin\libclang.dll + if: runner.os == 'Windows' + run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse + + - name: Install dependencies + if: runner.os == 'Windows' + run: choco install llvm -y + + - run: rustup target add wasm32-unknown-unknown + + - name: Test no-default-features + uses: actions-rs/cargo@v1 + with: + command: test + args: --workspace --no-default-features + + - name: Test default features + uses: actions-rs/cargo@v1 + with: + command: test + args: --workspace + + - name: Test uint + uses: actions-rs/cargo@v1 + with: + command: test + args: -p uint --all-features + + - name: Test fixed-hash no_std + run: cargo test -p fixed-hash --no-default-features --features='byteorder,rustc-hex' + + - name: Test fixed-hash all-features + uses: actions-rs/cargo@v1 + with: + command: test + args: -p fixed-hash --all-features + + - name: Test primitive-types no_std + run: cargo test -p primitive-types --no-default-features --features='scale-info,num-traits,serde_no_std' + + - name: Test primitive-types all-features + uses: actions-rs/cargo@v1 + with: + command: test + args: -p primitive-types --all-features + + - name: Build ethereum-types no_std + run: cargo build -p ethereum-types --no-default-features --features='serialize,rlp' --target=wasm32-unknown-unknown + + - name: Test ethereum-types all-features + uses: actions-rs/cargo@v1 + with: + command: test + args: -p ethereum-types --all-features + + - name: Test ethbloom all-features + uses: actions-rs/cargo@v1 + with: + command: test + args: -p ethbloom --all-features + + - name: Test parity-crypto all-features + uses: actions-rs/cargo@v1 + with: + command: test + args: -p parity-crypto --all-features + + - name: Test uint on bigendian + if: runner.os == 'Linux' + uses: actions-rs/cargo@v1 + with: + use-cross: true + command: test + args: -p uint --target=mips64-unknown-linux-gnuabi64 + + - name: Test parity-util-mem on Android + if: runner.os == 'Linux' + uses: actions-rs/cargo@v1 + with: + use-cross: true + command: test + args: -p parity-util-mem --target=aarch64-linux-android + + - name: Test parity-util-mem estimate-heapsize + run: cargo test -p parity-util-mem --features='estimate-heapsize' + + - name: Test parity-util-mem jemalloc-global + run: cargo test -p parity-util-mem --features='jemalloc-global' + + - name: Test parity-util-mem mimalloc-global + if: runner.os != 'Windows' + run: cargo test -p parity-util-mem --features='mimalloc-global' + + - name: Test parity-util-mem dlmalloc-global + if: runner.os != 'Windows' + run: cargo test -p parity-util-mem --no-default-features --features='dlmalloc-global' + + fmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - run: rustup component add rustfmt + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 13e3a218e..000000000 --- a/.travis.yml +++ /dev/null @@ -1,69 +0,0 @@ -language: rust -branches: - only: - - master -matrix: - include: - - os: linux - rust: stable - before_script: - - rustup component add rustfmt - - os: linux - rust: nightly - script: - - cargo generate-lockfile --verbose && cargo update -p funty --precise "1.1.0" --verbose - - cargo check --workspace --benches - - os: linux - rust: stable - install: - - cargo install cross - script: - - cargo generate-lockfile --verbose && cargo update -p funty --precise "1.1.0" --verbose - - cross test --target=aarch64-linux-android -p parity-util-mem - - cross test --target=mips64-unknown-linux-gnuabi64 -p uint - - os: osx - osx_image: xcode11.3 - addons: - firefox: latest - rust: stable - allow_failures: - - rust: nightly -install: - - rustup target add wasm32-unknown-unknown - - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | sh - - source ~/.nvm/nvm.sh - - nvm install --lts - - npm install -g geckodriver@1.19.1 # https://github.com/rustwasm/wasm-bindgen/issues/2261 - - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - which geckodriver -script: - - cargo generate-lockfile --verbose && cargo update -p funty --precise "1.1.0" --verbose - - if [ "$TRAVIS_OS_NAME" == "linux" ]; then - cargo fmt -- --check; - fi - - cargo check --workspace --tests --benches - - cargo test --workspace --exclude uint --exclude fixed-hash --exclude parity-crypto - - if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then - cd contract-address/ && cargo test --features=external_doc && cd ..; - fi - - cd ethbloom/ && cargo test --no-default-features --features="rustc-hex" && cargo check --benches && cd .. - - cd ethereum-types/ && cargo build --no-default-features --features="serialize,rlp" --target=wasm32-unknown-unknown && cd .. - - cd fixed-hash/ && cargo test --all-features && cargo test --no-default-features --features="byteorder,rustc-hex" && cd .. - - cd uint/ && cargo test --all-features && cargo test --no-default-features && cd .. - - cd keccak-hash/ && cargo test --no-default-features && cd .. - - cd plain_hasher/ && cargo test --no-default-features && cargo check --benches && cd .. - - cd parity-bytes/ && cargo test --no-default-features && cd .. - - cd parity-crypto/ && cargo test --all-features && cd .. - - cd parity-util-mem/ && cargo test --features=estimate-heapsize && cd .. - - cd parity-util-mem/ && cargo test --features=jemalloc-global && cd .. - - cd parity-util-mem/ && cargo test --features=mimalloc-global && cd .. - - cd parity-util-mem/ && cargo test --no-default-features --features=dlmalloc-global && cd .. - - cd primitive-types/ && cargo test --all-features && cd .. - - cd primitive-types/ && cargo test --no-default-features --features=serde_no_std && cd .. - - cd primitive-types/ && cargo test --no-default-features --features=scale-info && cd .. - - cd primitive-types/ && cargo test --no-default-features --features=num-traits && cd .. - - cd rlp/ && cargo test --no-default-features && cargo check --benches && cd .. - - cd triehash/ && cargo check --benches && cd .. - - cd kvdb-web/ && wasm-pack test --headless --firefox && cd .. - - cd ethbloom/ && cargo test --all-features && cd .. - - cd ethereum-types/ && cargo test --all-features && cd .. diff --git a/Cargo.toml b/Cargo.toml index c3380e0da..3092027a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ "contract-address", "fixed-hash", diff --git a/README.md b/README.md index b4647e7e9..2a97d14e0 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,4 @@ -[![Build Status travis][travis-image]][travis-url] -[![Build Status appveyor][appveyor-image]][appveyor-url] - -[travis-image]: https://travis-ci.org/paritytech/parity-common.svg?branch=master -[travis-url]: https://travis-ci.org/paritytech/parity-common -[appveyor-image]: https://ci.appveyor.com/api/projects/status/github/paritytech/parity-common?branch=master&svg=true -[appveyor-url]: https://ci.appveyor.com/project/paritytech/parity-common/branch/master +[![Continuous integration](https://github.com/paritytech/parity-common/actions/workflows/ci.yml/badge.svg)](https://github.com/paritytech/parity-common/actions/workflows/ci.yml) # parity-common Collection of crates used in [Parity Technologies](https://www.paritytech.io/) projects diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 6a0725a92..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -environment: - matrix: - - FEATURES: "" - -platform: - - x86_64-pc-windows-msvc - -# avoid running tests twice -branches: - only: - - master - -install: - - curl -sSf -o rustup-init.exe https://win.rustup.rs/ - - rustup-init.exe -y --default-host %PLATFORM% - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - rustc -vV - - cargo -vV - -build_script: - - cargo generate-lockfile --verbose && cargo update -p funty --precise "1.1.0" --verbose - - cargo check --tests - - cargo build --all - -test_script: - - cargo test --all --exclude uint --exclude fixed-hash - - cd fixed-hash/ && cargo test --all-features && cd .. - - cd uint/ && cargo test --features=std,quickcheck --release && cd .. - - cd plain_hasher/ && cargo test --no-default-features && cd .. - - cd parity-util-mem/ && cargo test --no-default-features && cd .. - - cd parity-util-mem/ && cargo test --features=estimate-heapsize && cd .. - - cd parity-util-mem/ && cargo test && cd .. diff --git a/parity-util-mem/tests/derive.rs b/parity-util-mem/tests/derive.rs index 4fb5f7328..63825ba61 100644 --- a/parity-util-mem/tests/derive.rs +++ b/parity-util-mem/tests/derive.rs @@ -53,6 +53,7 @@ fn derive_ignore() { } #[test] +#[cfg(all(feature = "lru", feature = "hashbrown"))] fn derive_morecomplex() { #[derive(MallocSizeOf)] struct Trivia { diff --git a/triehash/src/lib.rs b/triehash/src/lib.rs index a60a24998..63f93a5f6 100644 --- a/triehash/src/lib.rs +++ b/triehash/src/lib.rs @@ -260,7 +260,9 @@ where #[cfg(test)] mod tests { - use super::{hex_prefix_encode, shared_prefix_len, trie_root}; + use super::*; + #[cfg(not(feature = "std"))] + use alloc::vec; use ethereum_types::H256; use hex_literal::hex; use keccak_hasher::KeccakHasher;