From f6a3e7e88d51699b0c5a3b8055d601a58a1c3e71 Mon Sep 17 00:00:00 2001 From: Lohann Paterno Coutinho Ferreira Date: Mon, 30 Oct 2023 19:02:49 +0000 Subject: [PATCH] Fix: enable astar metadata feature flag (#203) --- .github/workflows/ci.yaml | 93 +++++++++++++++++++++++++++------- chains/astar/server/Cargo.toml | 2 +- 2 files changed, 75 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 61c44888..c8658892 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,25 +1,25 @@ +name: test + on: push: branches: - master - staging + - release-v* pull_request: -name: rosetta-wallet - jobs: rustfmt: runs-on: self-hosted steps: - name: Checkout sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install rust toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable components: rustfmt, clippy - targets: x86_64-unknown-linux-musl - name: Install dprint run: cargo install --locked dprint @@ -38,35 +38,67 @@ jobs: severity: style scandir: './scripts' - clippy: + cargo-deny: + runs-on: self-hosted + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: cargo-deny check + uses: EmbarkStudios/cargo-deny-action@v1 + + # Test each client individually, once testing the whole workspace can hide some compilation errors + # ex: testing using --workspace enable the same feature flags for all crates + test-client: + needs: [rustfmt] + strategy: + matrix: + crate: [rosetta-server-astar, rosetta-server-bitcoin, rosetta-server-ethereum, rosetta-server-polkadot, rosetta-client] + name: ${{ matrix.crate }} runs-on: self-hosted steps: - name: Checkout sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 + + - run: sudo add-apt-repository ppa:ethereum/ethereum + - run: sudo apt-get update -y + - name: Install deps + run: sudo apt-get install -y musl-dev musl-tools solc - name: Install rust toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable components: clippy + target: x86_64-unknown-linux-musl + + - name: cargo clippy (${{ matrix.crate }}) + run: | + cargo clippy --locked -p ${{ matrix.crate }} --examples --tests -- \ + -Dwarnings \ + -Dclippy::unwrap_used \ + -Dclippy::expect_used \ + -Dclippy::nursery \ + -Dclippy::pedantic \ + -Aclippy::module_name_repetitions + + - name: Cleanup Docker + run: ./scripts/reset_docker.sh - - name: cargo clippy - run: cargo clippy --locked --workspace --examples --tests --all-features -- -D warnings -D clippy::unwrap_used -D clippy::expect_used -D clippy::nursery -D clippy::pedantic -A clippy::module_name_repetitions - - cargo-deny: - runs-on: self-hosted - steps: - - name: Checkout sources - uses: actions/checkout@v3 - - - name: cargo-deny check - uses: EmbarkStudios/cargo-deny-action@v1 + - name: Pull nodes + run: ./scripts/pull_nodes.sh + - name: test (${{ matrix.crate }}) + run: cargo test --locked -p ${{ matrix.crate }} + + # Test all crates, excluding the clients test: + needs: [rustfmt] runs-on: self-hosted + name: cargo test --workspace --all-features steps: - name: Checkout sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: sudo add-apt-repository ppa:ethereum/ethereum - run: sudo apt-get update -y @@ -77,7 +109,24 @@ jobs: uses: actions-rs/toolchain@v1 with: toolchain: stable + components: clippy target: x86_64-unknown-linux-musl + + - name: clippy + run: | + cargo clippy --locked --workspace --examples --tests --all-features \ + --exclude rosetta-server-astar \ + --exclude rosetta-server-bitcoin \ + --exclude rosetta-server-ethereum \ + --exclude rosetta-server-polkadot \ + --exclude rosetta-client \ + -- \ + -Dwarnings \ + -Dclippy::unwrap_used \ + -Dclippy::expect_used \ + -Dclippy::nursery \ + -Dclippy::pedantic \ + -Aclippy::module_name_repetitions - name: Cleanup Docker run: ./scripts/reset_docker.sh @@ -86,4 +135,10 @@ jobs: run: ./scripts/pull_nodes.sh - name: cargo test - run: cargo test --locked --all-features --workspace + run: | + cargo test --locked --workspace --all-features \ + --exclude rosetta-server-astar \ + --exclude rosetta-server-bitcoin \ + --exclude rosetta-server-ethereum \ + --exclude rosetta-server-polkadot \ + --exclude rosetta-client diff --git a/chains/astar/server/Cargo.toml b/chains/astar/server/Cargo.toml index 86e3b3d1..b44c7a81 100644 --- a/chains/astar/server/Cargo.toml +++ b/chains/astar/server/Cargo.toml @@ -14,7 +14,7 @@ futures = { version = "0.3", default-features = false, features = ["std"] } hex = "0.4" log = "0.4" parity-scale-codec = { workspace = true, features = ["derive"] } -rosetta-config-astar.workspace = true +rosetta-config-astar = { workspace = true, features = ["astar-metadata"] } rosetta-config-ethereum.workspace = true rosetta-core.workspace = true rosetta-server = { workspace = true, features = ["ws", "webpki-tls"] }