From 5e67c523465d2262a81ba957e70e20ec88f33c95 Mon Sep 17 00:00:00 2001 From: Itay Tsabary Date: Sun, 8 Dec 2024 08:09:17 +0200 Subject: [PATCH] chore(ci): create sequencer integration test workflow commit-id:55e84a9b --- .../workflows/sequencer_integration_tests.yml | 37 +++++++++++++++++++ .../starknet_integration_tests/src/utils.rs | 4 ++ .../tests/end_to_end_integration_test.rs | 10 ++++- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/sequencer_integration_tests.yml diff --git a/.github/workflows/sequencer_integration_tests.yml b/.github/workflows/sequencer_integration_tests.yml new file mode 100644 index 0000000000..7ae266dc0e --- /dev/null +++ b/.github/workflows/sequencer_integration_tests.yml @@ -0,0 +1,37 @@ +name: Sequencer-Integration-Tests-CI-Flow + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - auto_merge_enabled + - edited + +env: + SEQUENCER_INTEGRATION_TESTS: 1 + RUSTFLAGS: "-D warnings" + +# On PR events, cancel existing CI runs on this same PR for this workflow. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + build-sequencer-node: + runs-on: starkware-ubuntu-latest-large + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/bootstrap + - run: cargo build --bin starknet_sequencer_node + + run-sequencer-integration-tests: + needs: build-sequencer-node + runs-on: starkware-ubuntu-latest-large + steps: + - uses: actions/checkout@v4 + - name: "Run test end-to-end integration test" + run: | + cargo test --test end_to_end_integration_test + diff --git a/crates/starknet_integration_tests/src/utils.rs b/crates/starknet_integration_tests/src/utils.rs index 2cbf630e05..937014fa68 100644 --- a/crates/starknet_integration_tests/src/utils.rs +++ b/crates/starknet_integration_tests/src/utils.rs @@ -227,3 +227,7 @@ pub fn create_batcher_config( ..Default::default() } } + +pub fn run_integration_test() -> bool { + std::env::var("SEQUENCER_INTEGRATION_TESTS").is_ok() +} diff --git a/crates/starknet_integration_tests/tests/end_to_end_integration_test.rs b/crates/starknet_integration_tests/tests/end_to_end_integration_test.rs index e67b48af27..c25f7d4fe3 100644 --- a/crates/starknet_integration_tests/tests/end_to_end_integration_test.rs +++ b/crates/starknet_integration_tests/tests/end_to_end_integration_test.rs @@ -10,7 +10,11 @@ use starknet_api::block::BlockNumber; use starknet_api::core::{ContractAddress, Nonce}; use starknet_api::state::StateNumber; use starknet_integration_tests::integration_test_setup::IntegrationTestSetup; -use starknet_integration_tests::utils::{create_integration_test_tx_generator, send_account_txs}; +use starknet_integration_tests::utils::{ + create_integration_test_tx_generator, + run_integration_test, + send_account_txs, +}; use starknet_sequencer_infra::trace_util::configure_tracing; use starknet_sequencer_node::test_utils::compilation::spawn_run_node; use starknet_types_core::felt::Felt; @@ -59,6 +63,10 @@ async fn await_block( #[rstest] #[tokio::test] async fn test_end_to_end_integration(mut tx_generator: MultiAccountTransactionGenerator) { + if !run_integration_test() { + return; + } + const EXPECTED_BLOCK_NUMBER: BlockNumber = BlockNumber(15); configure_tracing();