diff --git a/.github/workflows/sanity-checks.yml b/.github/workflows/sanity-checks.yml index 70ef6e387f..efbe604e89 100644 --- a/.github/workflows/sanity-checks.yml +++ b/.github/workflows/sanity-checks.yml @@ -5,34 +5,19 @@ concurrency: group: 'tests-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' cancel-in-progress: true permissions: - id-token: write - contents: read + id-token: write + contents: read jobs: test-n-lint: name: ${{ matrix.target }} runs-on: ubuntu-latest-8-cores strategy: matrix: - target: [test-integration] - # target: [test-general, test-integration, - # lint-fmt, lint-clippy, cargo-build, docs-build, lint-taplo] + target: [ test-general, test-integration, + lint-fmt, lint-clippy, cargo-build, docs-build, lint-taplo ] steps: - name: Check out code uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #3.5.2 - with: - submodules: 'recursive' - - name: Check submodule checkout status - id: check-submodule - run: | - if [ -d "runtime/integrations/tests/submodules/liquidity-pools" ]; then - echo "Submodule is checked out." - echo "ls -la runtime/integrations/tests/submodules/liquidity-pools" - echo "::set-output name=submodule_checked::true" - else - echo "Submodule is not checked out." - echo "::set-output name=submodule_checked::false" - exit 1 - fi - name: Prep build uses: ./.github/actions/prep-ubuntu @@ -41,34 +26,38 @@ jobs: # Cache needs Google credentials: GWIP: ${{ secrets.GWIP_SCCACHE }} GSA: ${{ secrets.GSA_SCCACHE }} + submodules: 'recursive' - name: Runing cargo ${{ matrix.target }} run: ./ci/run-check.sh env: TARGET: ${{ matrix.target }} - # RUSTC_WRAPPER: "sccache" - # SCCACHE_RECACHE: true + RUSTC_WRAPPER: "sccache" + + benchmark-check: + name: bench-check-${{ matrix.runtime }} + runs-on: ubuntu-latest #-4-cores + strategy: + matrix: + runtime: [ altair, centrifuge ] + steps: + - name: Check out code + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #3.5.2 - # benchmark-check: - # name: bench-check-${{ matrix.runtime }} - # runs-on: ubuntu-latest #-4-cores - # strategy: - # matrix: - # runtime: [altair, centrifuge] - # steps: - # - name: Check out code - # uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #3.5.2 + - name: Prep build + uses: ./.github/actions/prep-ubuntu + with: + cache: enabled + GWIP: ${{ secrets.GWIP_SCCACHE }} + GSA: ${{ secrets.GSA_SCCACHE }} - # - name: Prep build - # uses: ./.github/actions/prep-ubuntu - # with: - # cache: enabled - # GWIP: ${{ secrets.GWIP_SCCACHE }} - # GSA: ${{ secrets.GSA_SCCACHE }} + # Required for integration tests evm interaction + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 - # - name: Runing cargo ${{ matrix.target }} - # run: ./ci/run-check.sh - # env: - # TARGET: benchmark-check - # RUNTIME: ${{ matrix.runtime }} - # RUSTC_WRAPPER: "sccache" + - name: Runing cargo ${{ matrix.target }} + run: ./ci/run-check.sh + env: + TARGET: benchmark-check + RUNTIME: ${{ matrix.runtime }} + RUSTC_WRAPPER: "sccache" diff --git a/ci/run-check.sh b/ci/run-check.sh index de3530c368..167786a49f 100755 --- a/ci/run-check.sh +++ b/ci/run-check.sh @@ -9,29 +9,16 @@ rustup --version cargo --version case $TARGET in - cargo-build) - SCCACHE_RECACHE=true cargo build -p centrifuge-chain --release "$@" - ;; -# -# test-general) -# cargo test --workspace --release --features runtime-benchmarks,try-runtime --exclude runtime-integration-tests -# ;; + cargo-build) + cargo build -p centrifuge-chain --release "$@" + ;; + + test-general) + cargo test --workspace --release --features runtime-benchmarks,try-runtime --exclude runtime-integration-tests + ;; test-integration) - cargo test --release --package runtime-integration-tests --features fast-runtime & - CARGO_PID=$! - while true; do - if [ -d "target/debug/" ]; then - ls -la target/debug/build/runtime-integration*/out/ - ls -la target/debug/deps/runtime_integration*/out/ - break - else - echo "Folder not found" - sleep 3 - fi - done - wait $CARGO_PID - echo "Cargo test command has finished" + cargo test --release --package runtime-integration-tests ;; lint-fmt) diff --git a/runtime/integration-tests/Cargo.toml b/runtime/integration-tests/Cargo.toml index 8d42f3f59a..f564b210ec 100644 --- a/runtime/integration-tests/Cargo.toml +++ b/runtime/integration-tests/Cargo.toml @@ -71,8 +71,8 @@ staging-xcm-executor = { workspace = true, features = ["std"] } orml-traits = { workspace = true, features = ["std"] } +fp-evm = { workspace = true, features = ["std"] } fp-self-contained = { workspace = true, features = ["std"] } -fp-evm = { workspace = true, features = ["std"]} # Locals altair-runtime = { workspace = true, features = ["std"] } @@ -144,10 +144,10 @@ pallet-session = { workspace = true, features = ["std"] } pallet-sudo = { workspace = true, features = ["std"] } pallet-swaps = { workspace = true, features = ["std"] } pallet-timestamp = { workspace = true, features = ["std"] } +pallet-token-mux = { workspace = true, features = ["std"] } pallet-transaction-payment = { workspace = true, features = ["std"] } pallet-transfer-allowlist = { workspace = true, features = ["std"] } pallet-treasury = { workspace = true, features = ["std"] } -pallet-token-mux = { workspace = true, features = ["std"] } pallet-uniques = { workspace = true, features = ["std"] } pallet-utility = { workspace = true, features = ["std"] } pallet-vesting = { workspace = true, features = ["std"] } diff --git a/runtime/integration-tests/build.rs b/runtime/integration-tests/build.rs index 95ad263831..839eb57e77 100644 --- a/runtime/integration-tests/build.rs +++ b/runtime/integration-tests/build.rs @@ -20,7 +20,7 @@ fn main() { /* match Command::new("git") - .args(&["fetch", "--all", "--recurse-submodules=yes"]) + .args(&["pull", "--all", "--recurse-submodules=yes"]) .output() { Ok(o) if o.status.success() => {} @@ -107,7 +107,7 @@ fn main() { ); } Err(err) => { - println!("cargo:warning=Failed to execute git command: {}", err); + eprintln!("cargo:warning=Failed to execute git command: {}", err); } } } diff --git a/runtime/integration-tests/src/generic/utils/evm.rs b/runtime/integration-tests/src/generic/utils/evm.rs index bdf728628f..4f662322df 100644 --- a/runtime/integration-tests/src/generic/utils/evm.rs +++ b/runtime/integration-tests/src/generic/utils/evm.rs @@ -15,8 +15,12 @@ use sp_runtime::traits::Get; use crate::generic::{config::Runtime, utils::ESSENTIAL}; /// Liquidity-Pool solidity artifacts generated by build-script. -/// All needed contracts can be loaded from here -pub const LP_SOL_SOURCES: &str = env!("LP_SOL_SOURCES", "Build script failed to populate environment variable LP_SOL_SOURCES pointing to solidity source files."); +/// All needed contracts can be loaded from here. +/// +/// This panics if the solidity contracts were not built properly. This can +/// happen if the submodule was not pulled or the forge cli has not been +/// installed locally. +pub const LP_SOL_SOURCES: &str = env!("LP_SOL_SOURCES", "Build script failed to populate environment variable LP_SOL_SOURCES pointing to missing solidity source files in the 'target/*/build/integration-tests*/out' directory required for EVM integration tests.\n\nPlease check if you have pulled the 'liquidity-pools' submodule via `git pull --recurse-submodules` and if you have installed the forge cli, e.g. check `forge -V`."); #[derive(Clone, Debug, PartialEq)] pub struct DeployedContractInfo {