From 4db251be657110751976f9510acfb60075319ad3 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 20 Nov 2025 22:47:19 +0400 Subject: [PATCH 01/58] ci --- .github/workflows/ci.yml | 196 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..a2880ba48 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,196 @@ +name: CI + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: [master, dev, chore/improve-ci] + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +env: + CARGO_TERM_COLOR: always + +jobs: + format: + name: Format Check + runs-on: ubuntu-latest + container: + image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest + # Su push sempre; su PR solo se non è draft + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + steps: + - name: Checkout magicblock-validator + uses: actions/checkout@v5 + with: + path: magicblock-validator + fetch-depth: 1 + + # Nessuna cache: fmt non compila roba pesante + + - name: Run ci-fmt + run: make ci-fmt + shell: bash + working-directory: magicblock-validator + + - name: Run ci-fmt in test-integration + run: | + cd test-integration + make ci-fmt + shell: bash + working-directory: magicblock-validator + + lint: + name: Lint Check + runs-on: extra-large + container: + image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + steps: + - name: Checkout magicblock-validator + uses: actions/checkout@v5 + with: + path: magicblock-validator + fetch-depth: 1 + + - name: Rust cache (lint) + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + magicblock-validator/target + magicblock-validator/test-integration/target + # Cache specifica per lint + branch/PR + key: > + v1-rust-lint-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}-${{ github.head_ref || github.ref_name }} + # Fallback: stessa Cargo.lock (qualsiasi branch) -> fallback globale OS-based + restore-keys: | + v1-rust-lint-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- + v1-rust-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- + v1-rust-${{ runner.os }}- + + - name: Run ci-lint + run: make ci-lint + shell: bash + working-directory: magicblock-validator + + - name: Run ci-lint in test-integration + run: | + cd test-integration + make ci-lint + shell: bash + working-directory: magicblock-validator + + unit-tests: + name: Unit Tests + runs-on: extra-large + container: + image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest + # Parte solo dopo format + lint (se uno dei due fallisce, questo job è skipped) + needs: [format, lint] + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + steps: + - name: Checkout magicblock-validator + uses: actions/checkout@v5 + with: + path: magicblock-validator + fetch-depth: 1 + + - name: Rust cache (unit) + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + magicblock-validator/target + magicblock-validator/test-integration/target + # Cache specifica per unit test + branch/PR + key: > + v1-rust-unit-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}-${{ github.head_ref || github.ref_name }} + restore-keys: | + v1-rust-unit-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- + v1-rust-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- + v1-rust-${{ runner.os }}- + + - name: Run unit tests + run: | + make ci-test-unit + shell: bash + working-directory: magicblock-validator + + integration-tests: + name: Integration Tests - ${{ matrix.batch_tests }} + needs: [format, lint] + runs-on: extra-large + container: + image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + strategy: + fail-fast: false + matrix: + batch_tests: + - "schedulecommit" + - "chainlink" + - "cloning" + - "restore_ledger" + - "magicblock_api" + - "config" + - "table_mania" + - "committor" + - "pubsub" + - "schedule_intents" + - "task-scheduler" + steps: + - name: Checkout magicblock-validator + uses: actions/checkout@v5 + with: + path: magicblock-validator + fetch-depth: 1 + + - name: Rust cache (integration) + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + magicblock-validator/target + magicblock-validator/test-integration/target + # Cache specifica per integration + branch/PR + key: > + v1-rust-int-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}-${{ github.head_ref || github.ref_name }} + restore-keys: | + v1-rust-int-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- + v1-rust-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- + v1-rust-${{ runner.os }}- + + - name: Run integration tests - ${{ matrix.batch_tests }} + run: | + make ci-test-integration + shell: bash + working-directory: magicblock-validator + env: + RUN_TESTS: ${{ matrix.batch_tests }} + + ci-status: + name: CI Status + runs-on: ubuntu-latest + if: always() + needs: + - format + - lint + - unit-tests + - integration-tests + steps: + - name: Check all jobs status + run: | + if [[ "${{ needs.format.result }}" != "success" || + "${{ needs.lint.result }}" != "success" || + "${{ needs.unit-tests.result }}" != "success" || + "${{ needs.integration-tests.result }}" != "success" ]]; then + echo "One or more CI jobs failed or were skipped" + exit 1 + fi + echo "All CI jobs passed successfully" From f77c101c1fabdb2d7380db21ec187b210079d646 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 20 Nov 2025 22:50:22 +0400 Subject: [PATCH 02/58] deleted old workflows --- .github/workflows/ci-fmt.yml | 38 ----------- .github/workflows/ci-lint.yml | 38 ----------- .github/workflows/ci-test-integration.yml | 82 ----------------------- .github/workflows/ci-test-unit.yml | 38 ----------- 4 files changed, 196 deletions(-) delete mode 100644 .github/workflows/ci-fmt.yml delete mode 100644 .github/workflows/ci-lint.yml delete mode 100644 .github/workflows/ci-test-integration.yml delete mode 100644 .github/workflows/ci-test-unit.yml diff --git a/.github/workflows/ci-fmt.yml b/.github/workflows/ci-fmt.yml deleted file mode 100644 index 7982fb0ba..000000000 --- a/.github/workflows/ci-fmt.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Run CI - Format - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -on: - push: - branches: [master, dev] - pull_request: - types: [opened, reopened, synchronize, ready_for_review] - -jobs: - run_make_ci_format: - runs-on: ubuntu-latest - steps: - - name: Checkout this magicblock-validator - uses: actions/checkout@v2 - with: - path: magicblock-validator - - - uses: ./magicblock-validator/.github/actions/setup-build-env - with: - build_cache_key_name: "magicblock-validator-ci-fmt-v001" - rust_toolchain_release: "nightly" - github_access_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - github_token: ${{ secrets.GITHUB_TOKEN }} - - - run: make ci-fmt - shell: bash - working-directory: magicblock-validator - - - name: Run ci-fmt in test-integration - run: | - cd test-integration - make ci-fmt - shell: bash - working-directory: magicblock-validator diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml deleted file mode 100644 index 7a83a1ade..000000000 --- a/.github/workflows/ci-lint.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Run CI - Lint - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -on: - push: - branches: [master, dev] - pull_request: - types: [opened, reopened, synchronize, ready_for_review] - -jobs: - run_make_ci_lint: - runs-on: ubuntu-latest - steps: - - name: Checkout this magicblock-validator - uses: actions/checkout@v2 - with: - path: magicblock-validator - - - uses: ./magicblock-validator/.github/actions/setup-build-env - with: - build_cache_key_name: "magicblock-validator-ci-lint-v002" - rust_toolchain_release: "1.91.1" - github_access_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - github_token: ${{ secrets.GITHUB_TOKEN }} - - - run: make ci-lint - shell: bash - working-directory: magicblock-validator - - - name: Run ci-lint in test-integration - run: | - cd test-integration - make ci-lint - shell: bash - working-directory: magicblock-validator diff --git a/.github/workflows/ci-test-integration.yml b/.github/workflows/ci-test-integration.yml deleted file mode 100644 index 5980aaec4..000000000 --- a/.github/workflows/ci-test-integration.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: Run CI - Integration Tests - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -on: - push: - branches: [master, dev] - pull_request: - types: [opened, reopened, synchronize, ready_for_review] - -jobs: - build: - runs-on: ubuntu-latest-m - name: Build Project - steps: - - name: Checkout this magicblock-validator - uses: actions/checkout@v5 - with: - path: magicblock-validator - - - uses: ./magicblock-validator/.github/actions/setup-build-env - with: - build_cache_key_name: "magicblock-validator-ci-test-integration-${{ github.ref_name }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}" - rust_toolchain_release: "1.91.1" - github_access_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - github_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: ./magicblock-validator/.github/actions/setup-solana - - - name: Build project and test programs - run: | - cargo build --locked - make -C test-integration programs - shell: bash - working-directory: magicblock-validator - - run_integration_tests: - needs: build - runs-on: ubuntu-latest-m - strategy: - matrix: - batch_tests: - - "schedulecommit" - - "chainlink" - - "cloning" - - "restore_ledger" - - "magicblock_api" - - "config" - - "table_mania" - - "committor" - - "pubsub" - - "schedule_intents" - - "task-scheduler" - fail-fast: false - name: Integration Tests - ${{ matrix.batch_tests }} - steps: - - name: Checkout this magicblock-validator - uses: actions/checkout@v5 - with: - path: magicblock-validator - - - uses: ./magicblock-validator/.github/actions/setup-build-env - with: - build_cache_key_name: "magicblock-validator-ci-test-integration-${{ github.ref_name }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}" - rust_toolchain_release: "1.84.1" - github_access_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - github_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: ./magicblock-validator/.github/actions/setup-solana - - - name: Run integration tests - ${{ matrix.batch_tests }} - run: | - sudo prlimit --pid $$ --nofile=1048576:1048576 - sudo sysctl fs.inotify.max_user_instances=1280 - sudo sysctl fs.inotify.max_user_watches=655360 - make ci-test-integration - shell: bash - working-directory: magicblock-validator - env: - RUN_TESTS: ${{ matrix.batch_tests }} diff --git a/.github/workflows/ci-test-unit.yml b/.github/workflows/ci-test-unit.yml deleted file mode 100644 index 8061769fe..000000000 --- a/.github/workflows/ci-test-unit.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Run CI - Unit Tests - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -on: - push: - branches: [master, dev] - pull_request: - types: [opened, reopened, synchronize, ready_for_review] - -jobs: - run_make_ci_test: - runs-on: ubuntu-latest-m - steps: - - name: Checkout this magicblock-validator - uses: actions/checkout@v2 - with: - path: magicblock-validator - - - uses: ./magicblock-validator/.github/actions/setup-build-env - with: - build_cache_key_name: "magicblock-validator-ci-test-unit-v001" - rust_toolchain_release: "1.91.1" - github_access_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - github_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: ./magicblock-validator/.github/actions/setup-solana - - - name: Run unit tests - run: | - sudo prlimit --pid $$ --nofile=1048576:1048576 - sudo sysctl fs.inotify.max_user_instances=1280 - sudo sysctl fs.inotify.max_user_watches=655360 - make ci-test-unit - shell: bash - working-directory: magicblock-validator From 2622c4f21fe2c77512f59c0873751252fcff83a3 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 20 Nov 2025 22:52:05 +0400 Subject: [PATCH 03/58] fix unit --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2880ba48..c1e2f80aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,6 +117,9 @@ jobs: - name: Run unit tests run: | + sudo prlimit --pid $$ --nofile=1048576:1048576 + sudo sysctl fs.inotify.max_user_instances=1280 + sudo sysctl fs.inotify.max_user_watches=655360 make ci-test-unit shell: bash working-directory: magicblock-validator From b68905b127fea8b02331abc3f6681a876ad53ffc Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Mon, 19 Jan 2026 15:49:00 +0100 Subject: [PATCH 04/58] debug --- .github/workflows/ci.yml | 328 +++++++++++++++++++-------------------- 1 file changed, 163 insertions(+), 165 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1e2f80aa..7e9ed504b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,189 +11,187 @@ on: types: [opened, reopened, synchronize, ready_for_review] env: - CARGO_TERM_COLOR: always + CARGO_TARGET_DIR: ${{ github.workspace }}/target jobs: format: name: Format Check - runs-on: ubuntu-latest - container: - image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest + runs-on: self-hosted # Su push sempre; su PR solo se non è draft if: github.event_name != 'pull_request' || github.event.pull_request.draft == false steps: - name: Checkout magicblock-validator uses: actions/checkout@v5 with: - path: magicblock-validator fetch-depth: 1 - # Nessuna cache: fmt non compila roba pesante + - name: Install Rust toolchain + run: | + rustup toolchain install nightly --profile default + rustup default nightly + rustc --version + cargo --version - name: Run ci-fmt run: make ci-fmt - shell: bash - working-directory: magicblock-validator - name: Run ci-fmt in test-integration run: | cd test-integration make ci-fmt - shell: bash - working-directory: magicblock-validator - - lint: - name: Lint Check - runs-on: extra-large - container: - image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - steps: - - name: Checkout magicblock-validator - uses: actions/checkout@v5 - with: - path: magicblock-validator - fetch-depth: 1 - - - name: Rust cache (lint) - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - magicblock-validator/target - magicblock-validator/test-integration/target - # Cache specifica per lint + branch/PR - key: > - v1-rust-lint-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}-${{ github.head_ref || github.ref_name }} - # Fallback: stessa Cargo.lock (qualsiasi branch) -> fallback globale OS-based - restore-keys: | - v1-rust-lint-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- - v1-rust-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- - v1-rust-${{ runner.os }}- - - - name: Run ci-lint - run: make ci-lint - shell: bash - working-directory: magicblock-validator - - - name: Run ci-lint in test-integration - run: | - cd test-integration - make ci-lint - shell: bash - working-directory: magicblock-validator - - unit-tests: - name: Unit Tests - runs-on: extra-large - container: - image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest - # Parte solo dopo format + lint (se uno dei due fallisce, questo job è skipped) - needs: [format, lint] - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - steps: - - name: Checkout magicblock-validator - uses: actions/checkout@v5 - with: - path: magicblock-validator - fetch-depth: 1 - - - name: Rust cache (unit) - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - magicblock-validator/target - magicblock-validator/test-integration/target - # Cache specifica per unit test + branch/PR - key: > - v1-rust-unit-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}-${{ github.head_ref || github.ref_name }} - restore-keys: | - v1-rust-unit-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- - v1-rust-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- - v1-rust-${{ runner.os }}- - - - name: Run unit tests - run: | - sudo prlimit --pid $$ --nofile=1048576:1048576 - sudo sysctl fs.inotify.max_user_instances=1280 - sudo sysctl fs.inotify.max_user_watches=655360 - make ci-test-unit - shell: bash - working-directory: magicblock-validator - integration-tests: - name: Integration Tests - ${{ matrix.batch_tests }} - needs: [format, lint] - runs-on: extra-large - container: - image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - strategy: - fail-fast: false - matrix: - batch_tests: - - "schedulecommit" - - "chainlink" - - "cloning" - - "restore_ledger" - - "magicblock_api" - - "config" - - "table_mania" - - "committor" - - "pubsub" - - "schedule_intents" - - "task-scheduler" - steps: - - name: Checkout magicblock-validator - uses: actions/checkout@v5 - with: - path: magicblock-validator - fetch-depth: 1 - - - name: Rust cache (integration) - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - magicblock-validator/target - magicblock-validator/test-integration/target - # Cache specifica per integration + branch/PR - key: > - v1-rust-int-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}-${{ github.head_ref || github.ref_name }} - restore-keys: | - v1-rust-int-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- - v1-rust-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- - v1-rust-${{ runner.os }}- - - - name: Run integration tests - ${{ matrix.batch_tests }} - run: | - make ci-test-integration - shell: bash - working-directory: magicblock-validator - env: - RUN_TESTS: ${{ matrix.batch_tests }} - - ci-status: - name: CI Status - runs-on: ubuntu-latest - if: always() - needs: - - format - - lint - - unit-tests - - integration-tests - steps: - - name: Check all jobs status - run: | - if [[ "${{ needs.format.result }}" != "success" || - "${{ needs.lint.result }}" != "success" || - "${{ needs.unit-tests.result }}" != "success" || - "${{ needs.integration-tests.result }}" != "success" ]]; then - echo "One or more CI jobs failed or were skipped" - exit 1 - fi - echo "All CI jobs passed successfully" +# lint: +# name: Lint Check +# runs-on: extra-large +# container: +# image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest +# if: github.event_name != 'pull_request' || github.event.pull_request.draft == false +# steps: +# - name: Checkout magicblock-validator +# uses: actions/checkout@v5 +# with: +# path: magicblock-validator +# fetch-depth: 1 +# +# - name: Rust cache (lint) +# uses: actions/cache@v4 +# with: +# path: | +# ~/.cargo/registry +# ~/.cargo/git +# magicblock-validator/target +# magicblock-validator/test-integration/target +# # Cache specifica per lint + branch/PR +# key: > +# v1-rust-lint-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}-${{ github.head_ref || github.ref_name }} +# # Fallback: stessa Cargo.lock (qualsiasi branch) -> fallback globale OS-based +# restore-keys: | +# v1-rust-lint-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- +# v1-rust-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- +# v1-rust-${{ runner.os }}- +# +# - name: Run ci-lint +# run: make ci-lint +# shell: bash +# working-directory: magicblock-validator +# +# - name: Run ci-lint in test-integration +# run: | +# cd test-integration +# make ci-lint +# shell: bash +# working-directory: magicblock-validator +# +# unit-tests: +# name: Unit Tests +# runs-on: extra-large +# container: +# image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest +# # Parte solo dopo format + lint (se uno dei due fallisce, questo job è skipped) +# needs: [format, lint] +# if: github.event_name != 'pull_request' || github.event.pull_request.draft == false +# steps: +# - name: Checkout magicblock-validator +# uses: actions/checkout@v5 +# with: +# path: magicblock-validator +# fetch-depth: 1 +# +# - name: Rust cache (unit) +# uses: actions/cache@v4 +# with: +# path: | +# ~/.cargo/registry +# ~/.cargo/git +# magicblock-validator/target +# magicblock-validator/test-integration/target +# # Cache specifica per unit test + branch/PR +# key: > +# v1-rust-unit-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}-${{ github.head_ref || github.ref_name }} +# restore-keys: | +# v1-rust-unit-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- +# v1-rust-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- +# v1-rust-${{ runner.os }}- +# +# - name: Run unit tests +# run: | +# sudo prlimit --pid $$ --nofile=1048576:1048576 +# sudo sysctl fs.inotify.max_user_instances=1280 +# sudo sysctl fs.inotify.max_user_watches=655360 +# make ci-test-unit +# shell: bash +# working-directory: magicblock-validator +# +# integration-tests: +# name: Integration Tests - ${{ matrix.batch_tests }} +# needs: [format, lint] +# runs-on: extra-large +# container: +# image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest +# if: github.event_name != 'pull_request' || github.event.pull_request.draft == false +# strategy: +# fail-fast: false +# matrix: +# batch_tests: +# - "schedulecommit" +# - "chainlink" +# - "cloning" +# - "restore_ledger" +# - "magicblock_api" +# - "config" +# - "table_mania" +# - "committor" +# - "pubsub" +# - "schedule_intents" +# - "task-scheduler" +# steps: +# - name: Checkout magicblock-validator +# uses: actions/checkout@v5 +# with: +# path: magicblock-validator +# fetch-depth: 1 +# +# - name: Rust cache (integration) +# uses: actions/cache@v4 +# with: +# path: | +# ~/.cargo/registry +# ~/.cargo/git +# magicblock-validator/target +# magicblock-validator/test-integration/target +# # Cache specifica per integration + branch/PR +# key: > +# v1-rust-int-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}-${{ github.head_ref || github.ref_name }} +# restore-keys: | +# v1-rust-int-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- +# v1-rust-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- +# v1-rust-${{ runner.os }}- +# +# - name: Run integration tests - ${{ matrix.batch_tests }} +# run: | +# make ci-test-integration +# shell: bash +# working-directory: magicblock-validator +# env: +# RUN_TESTS: ${{ matrix.batch_tests }} +# +# ci-status: +# name: CI Status +# runs-on: ubuntu-latest +# if: always() +# needs: +# - format +# - lint +# - unit-tests +# - integration-tests +# steps: +# - name: Check all jobs status +# run: | +# if [[ "${{ needs.format.result }}" != "success" || +# "${{ needs.lint.result }}" != "success" || +# "${{ needs.unit-tests.result }}" != "success" || +# "${{ needs.integration-tests.result }}" != "success" ]]; then +# echo "One or more CI jobs failed or were skipped" +# exit 1 +# fi +# echo "All CI jobs passed successfully" From f16e7b4d5b2b3589ff164938d63d68fc1f1116d7 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Mon, 19 Jan 2026 16:07:42 +0100 Subject: [PATCH 05/58] debug --- .github/workflows/ci.yml | 69 ++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e9ed504b..bedcb981c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ env: jobs: format: name: Format Check - runs-on: self-hosted + runs-on: self-hosted # TODO da spostare sul runner generico # Su push sempre; su PR solo se non è draft if: github.event_name != 'pull_request' || github.event.pull_request.draft == false steps: @@ -40,47 +40,32 @@ jobs: cd test-integration make ci-fmt -# lint: -# name: Lint Check -# runs-on: extra-large -# container: -# image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest -# if: github.event_name != 'pull_request' || github.event.pull_request.draft == false -# steps: -# - name: Checkout magicblock-validator -# uses: actions/checkout@v5 -# with: -# path: magicblock-validator -# fetch-depth: 1 -# -# - name: Rust cache (lint) -# uses: actions/cache@v4 -# with: -# path: | -# ~/.cargo/registry -# ~/.cargo/git -# magicblock-validator/target -# magicblock-validator/test-integration/target -# # Cache specifica per lint + branch/PR -# key: > -# v1-rust-lint-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}-${{ github.head_ref || github.ref_name }} -# # Fallback: stessa Cargo.lock (qualsiasi branch) -> fallback globale OS-based -# restore-keys: | -# v1-rust-lint-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- -# v1-rust-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- -# v1-rust-${{ runner.os }}- -# -# - name: Run ci-lint -# run: make ci-lint -# shell: bash -# working-directory: magicblock-validator -# -# - name: Run ci-lint in test-integration -# run: | -# cd test-integration -# make ci-lint -# shell: bash -# working-directory: magicblock-validator + lint: + name: Lint Check + runs-on: self-hosted + # Su push sempre; su PR solo se non è draft + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + steps: + - name: Checkout magicblock-validator + uses: actions/checkout@v5 + with: + fetch-depth: 1 + + - name: Install Rust toolchain + run: | + rustup toolchain install nightly --profile default + rustup default nightly + rustc --version + cargo --version + + - name: Run ci-lint + run: make ci-lint + + - name: Run ci-lint in test-integration + run: | + cd test-integration + make ci-lint + # # unit-tests: # name: Unit Tests From 50674fb0a10697bdc01256c3a7700bda02896baf Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Mon, 19 Jan 2026 16:12:33 +0100 Subject: [PATCH 06/58] debug --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bedcb981c..116ef7356 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,8 +27,8 @@ jobs: - name: Install Rust toolchain run: | - rustup toolchain install nightly --profile default - rustup default nightly + rustup toolchain install 1.84.1 --profile default + rustup default 1.84.1 rustc --version cargo --version @@ -53,8 +53,8 @@ jobs: - name: Install Rust toolchain run: | - rustup toolchain install nightly --profile default - rustup default nightly + rustup toolchain install 1.84.1 --profile default + rustup default 1.84.1 rustc --version cargo --version From e51a8ee8080f776a9ecc669ab13d1a473aedce71 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Mon, 19 Jan 2026 16:14:50 +0100 Subject: [PATCH 07/58] debug --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 116ef7356..ba5f4c7e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,7 @@ jobs: - name: Install Rust toolchain run: | rustup toolchain install 1.84.1 --profile default + rustup component add clippy --toolchain 1.84.1 rustup default 1.84.1 rustc --version cargo --version From e10e4efabd7084f225c81bb5fe3548fbd71784c5 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Mon, 19 Jan 2026 16:29:07 +0100 Subject: [PATCH 08/58] debug --- .github/workflows/ci.yml | 63 +++++++++++++++------------------------- 1 file changed, 23 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba5f4c7e7..3d0f982cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,46 +67,29 @@ jobs: cd test-integration make ci-lint -# -# unit-tests: -# name: Unit Tests -# runs-on: extra-large -# container: -# image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest -# # Parte solo dopo format + lint (se uno dei due fallisce, questo job è skipped) -# needs: [format, lint] -# if: github.event_name != 'pull_request' || github.event.pull_request.draft == false -# steps: -# - name: Checkout magicblock-validator -# uses: actions/checkout@v5 -# with: -# path: magicblock-validator -# fetch-depth: 1 -# -# - name: Rust cache (unit) -# uses: actions/cache@v4 -# with: -# path: | -# ~/.cargo/registry -# ~/.cargo/git -# magicblock-validator/target -# magicblock-validator/test-integration/target -# # Cache specifica per unit test + branch/PR -# key: > -# v1-rust-unit-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}-${{ github.head_ref || github.ref_name }} -# restore-keys: | -# v1-rust-unit-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- -# v1-rust-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- -# v1-rust-${{ runner.os }}- -# -# - name: Run unit tests -# run: | -# sudo prlimit --pid $$ --nofile=1048576:1048576 -# sudo sysctl fs.inotify.max_user_instances=1280 -# sudo sysctl fs.inotify.max_user_watches=655360 -# make ci-test-unit -# shell: bash -# working-directory: magicblock-validator + + unit-tests: + name: Unit Tests + runs-on: self-hosted + # Su push sempre; su PR solo se non è draft + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + needs: [format, lint] + steps: + - name: Checkout magicblock-validator + uses: actions/checkout@v5 + with: + fetch-depth: 1 + + - name: Install Rust toolchain + run: | + rustup toolchain install 1.84.1 --profile default + rustup default 1.84.1 + rustc --version + cargo --version + + - name: Run unit tests + run: | + make ci-test-unit # # integration-tests: # name: Integration Tests - ${{ matrix.batch_tests }} From ffdf3c6acf4b92fe6553b080498b96af2ab48e81 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Mon, 19 Jan 2026 16:46:54 +0100 Subject: [PATCH 09/58] debug --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d0f982cb..9dae35a83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,6 +87,15 @@ jobs: rustc --version cargo --version + - name: Install cargo-expand + run: | + if ! command -v cargo-expand &> /dev/null; then + echo "cargo-expand not found, installing..." + cargo install cargo-expand + else + echo "cargo-expand already installed" + fi + - name: Run unit tests run: | make ci-test-unit From e12e0cd883dc16056f8e7911695bebd9a7383534 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Mon, 19 Jan 2026 16:52:39 +0100 Subject: [PATCH 10/58] debug --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dae35a83..7e5109820 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,7 +91,7 @@ jobs: run: | if ! command -v cargo-expand &> /dev/null; then echo "cargo-expand not found, installing..." - cargo install cargo-expand + cargo install cargo-expand --version 1.0.118 else echo "cargo-expand already installed" fi From bc764dcefba96011ee3a1bf28863a9c9c0192d2a Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Mon, 19 Jan 2026 17:11:17 +0100 Subject: [PATCH 11/58] debug --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e5109820..36976728b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,8 +27,8 @@ jobs: - name: Install Rust toolchain run: | - rustup toolchain install 1.84.1 --profile default - rustup default 1.84.1 + rustup toolchain install 1.91.1 --profile default + rustup default 1.91.1 rustc --version cargo --version @@ -53,9 +53,9 @@ jobs: - name: Install Rust toolchain run: | - rustup toolchain install 1.84.1 --profile default - rustup component add clippy --toolchain 1.84.1 - rustup default 1.84.1 + rustup toolchain install 1.91.1 --profile default + rustup component add clippy --toolchain 1.91.1 + rustup default 1.91.1 rustc --version cargo --version @@ -82,8 +82,8 @@ jobs: - name: Install Rust toolchain run: | - rustup toolchain install 1.84.1 --profile default - rustup default 1.84.1 + rustup toolchain install 1.91.1 --profile default + rustup default 1.91.1 rustc --version cargo --version @@ -91,7 +91,7 @@ jobs: run: | if ! command -v cargo-expand &> /dev/null; then echo "cargo-expand not found, installing..." - cargo install cargo-expand --version 1.0.118 + cargo install cargo-expand else echo "cargo-expand already installed" fi From 49886ec317f4fb8991f823be7e62730fd5f76f5f Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Mon, 19 Jan 2026 17:29:15 +0100 Subject: [PATCH 12/58] debug --- .github/workflows/ci.yml | 135 ++++++++++++++++++--------------------- 1 file changed, 61 insertions(+), 74 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36976728b..571354909 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,77 +99,64 @@ jobs: - name: Run unit tests run: | make ci-test-unit -# -# integration-tests: -# name: Integration Tests - ${{ matrix.batch_tests }} -# needs: [format, lint] -# runs-on: extra-large -# container: -# image: ghcr.io/magicblock-labs/magicblock-validator-ci:latest -# if: github.event_name != 'pull_request' || github.event.pull_request.draft == false -# strategy: -# fail-fast: false -# matrix: -# batch_tests: -# - "schedulecommit" -# - "chainlink" -# - "cloning" -# - "restore_ledger" -# - "magicblock_api" -# - "config" -# - "table_mania" -# - "committor" -# - "pubsub" -# - "schedule_intents" -# - "task-scheduler" -# steps: -# - name: Checkout magicblock-validator -# uses: actions/checkout@v5 -# with: -# path: magicblock-validator -# fetch-depth: 1 -# -# - name: Rust cache (integration) -# uses: actions/cache@v4 -# with: -# path: | -# ~/.cargo/registry -# ~/.cargo/git -# magicblock-validator/target -# magicblock-validator/test-integration/target -# # Cache specifica per integration + branch/PR -# key: > -# v1-rust-int-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}-${{ github.head_ref || github.ref_name }} -# restore-keys: | -# v1-rust-int-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- -# v1-rust-${{ runner.os }}-${{ hashFiles('magicblock-validator/Cargo.lock') }}- -# v1-rust-${{ runner.os }}- -# -# - name: Run integration tests - ${{ matrix.batch_tests }} -# run: | -# make ci-test-integration -# shell: bash -# working-directory: magicblock-validator -# env: -# RUN_TESTS: ${{ matrix.batch_tests }} -# -# ci-status: -# name: CI Status -# runs-on: ubuntu-latest -# if: always() -# needs: -# - format -# - lint -# - unit-tests -# - integration-tests -# steps: -# - name: Check all jobs status -# run: | -# if [[ "${{ needs.format.result }}" != "success" || -# "${{ needs.lint.result }}" != "success" || -# "${{ needs.unit-tests.result }}" != "success" || -# "${{ needs.integration-tests.result }}" != "success" ]]; then -# echo "One or more CI jobs failed or were skipped" -# exit 1 -# fi -# echo "All CI jobs passed successfully" + + integration-tests: + name: Integration Tests - ${{ matrix.batch_tests }} + runs-on: self-hosted + # Su push sempre; su PR solo se non è draft + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + needs: [format, lint, unit-tests] + strategy: + fail-fast: false + matrix: + batch_tests: + - "schedulecommit" + - "chainlink" + - "cloning" + - "restore_ledger" + - "magicblock_api" + - "config" + - "table_mania" + - "committor" + - "pubsub" + - "schedule_intents" + - "task-scheduler" + steps: + - name: Checkout magicblock-validator + uses: actions/checkout@v5 + with: + fetch-depth: 1 + + - name: Install Rust toolchain + run: | + rustup toolchain install 1.91.1 --profile default + rustup default 1.91.1 + rustc --version + cargo --version + + - name: Run integration tests - ${{ matrix.batch_tests }} + run: | + make ci-test-integration + env: + RUN_TESTS: ${{ matrix.batch_tests }} + + ci-status: + name: CI Status + runs-on: ubuntu-latest + if: always() + needs: + - format + - lint + - unit-tests + - integration-tests + steps: + - name: Check all jobs status + run: | + if [[ "${{ needs.format.result }}" != "success" || + "${{ needs.lint.result }}" != "success" || + "${{ needs.unit-tests.result }}" != "success" || + "${{ needs.integration-tests.result }}" != "success" ]]; then + echo "One or more CI jobs failed or were skipped" + exit 1 + fi + echo "All CI jobs passed successfully" From ce52d97a59fba0fac2d4c2a291271f66691a0551 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Mon, 19 Jan 2026 17:49:48 +0100 Subject: [PATCH 13/58] debug --- .github/workflows/ci.yml | 65 ++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 571354909..dfc2cce46 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,44 +68,44 @@ jobs: make ci-lint - unit-tests: - name: Unit Tests - runs-on: self-hosted - # Su push sempre; su PR solo se non è draft - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - needs: [format, lint] - steps: - - name: Checkout magicblock-validator - uses: actions/checkout@v5 - with: - fetch-depth: 1 - - - name: Install Rust toolchain - run: | - rustup toolchain install 1.91.1 --profile default - rustup default 1.91.1 - rustc --version - cargo --version - - - name: Install cargo-expand - run: | - if ! command -v cargo-expand &> /dev/null; then - echo "cargo-expand not found, installing..." - cargo install cargo-expand - else - echo "cargo-expand already installed" - fi - - - name: Run unit tests - run: | - make ci-test-unit +# unit-tests: +# name: Unit Tests +# runs-on: self-hosted +# # Su push sempre; su PR solo se non è draft +# if: github.event_name != 'pull_request' || github.event.pull_request.draft == false +# needs: [format, lint] +# steps: +# - name: Checkout magicblock-validator +# uses: actions/checkout@v5 +# with: +# fetch-depth: 1 +# +# - name: Install Rust toolchain +# run: | +# rustup toolchain install 1.91.1 --profile default +# rustup default 1.91.1 +# rustc --version +# cargo --version +# +# - name: Install cargo-expand +# run: | +# if ! command -v cargo-expand &> /dev/null; then +# echo "cargo-expand not found, installing..." +# cargo install cargo-expand +# else +# echo "cargo-expand already installed" +# fi +# +# - name: Run unit tests +# run: | +# make ci-test-unit integration-tests: name: Integration Tests - ${{ matrix.batch_tests }} runs-on: self-hosted # Su push sempre; su PR solo se non è draft if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - needs: [format, lint, unit-tests] + needs: [format, lint] strategy: fail-fast: false matrix: @@ -147,7 +147,6 @@ jobs: needs: - format - lint - - unit-tests - integration-tests steps: - name: Check all jobs status From ec96e8e6907398c1d4b8f41e8c71ebaa27d08eae Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Tue, 20 Jan 2026 10:25:44 +0100 Subject: [PATCH 14/58] debug --- .github/workflows/ci.yml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfc2cce46..22717b733 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,22 +140,22 @@ jobs: env: RUN_TESTS: ${{ matrix.batch_tests }} - ci-status: - name: CI Status - runs-on: ubuntu-latest - if: always() - needs: - - format - - lint - - integration-tests - steps: - - name: Check all jobs status - run: | - if [[ "${{ needs.format.result }}" != "success" || - "${{ needs.lint.result }}" != "success" || - "${{ needs.unit-tests.result }}" != "success" || - "${{ needs.integration-tests.result }}" != "success" ]]; then - echo "One or more CI jobs failed or were skipped" - exit 1 - fi - echo "All CI jobs passed successfully" +# ci-status: +# name: CI Status +# runs-on: ubuntu-latest +# if: always() +# needs: +# - format +# - lint +# - integration-tests +# steps: +# - name: Check all jobs status +# run: | +# if [[ "${{ needs.format.result }}" != "success" || +# "${{ needs.lint.result }}" != "success" || +# "${{ needs.unit-tests.result }}" != "success" || +# "${{ needs.integration-tests.result }}" != "success" ]]; then +# echo "One or more CI jobs failed or were skipped" +# exit 1 +# fi +# echo "All CI jobs passed successfully" From e92e1ae013f80e43e4e7d8af204596384a8cd2bc Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Tue, 20 Jan 2026 13:20:49 +0100 Subject: [PATCH 15/58] debug --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22717b733..497ca6272 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,6 @@ jobs: - name: Install Rust toolchain run: | - rustup toolchain install 1.91.1 --profile default rustup default 1.91.1 rustc --version cargo --version @@ -53,7 +52,6 @@ jobs: - name: Install Rust toolchain run: | - rustup toolchain install 1.91.1 --profile default rustup component add clippy --toolchain 1.91.1 rustup default 1.91.1 rustc --version @@ -82,7 +80,6 @@ jobs: # # - name: Install Rust toolchain # run: | -# rustup toolchain install 1.91.1 --profile default # rustup default 1.91.1 # rustc --version # cargo --version @@ -129,7 +126,6 @@ jobs: - name: Install Rust toolchain run: | - rustup toolchain install 1.91.1 --profile default rustup default 1.91.1 rustc --version cargo --version From 110014d08cac0a72e5afa96bca6bdeda7faa5497 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Tue, 20 Jan 2026 13:33:30 +0100 Subject: [PATCH 16/58] debug --- .github/workflows/ci.yml | 107 ++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 51 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 497ca6272..dc7445d8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,56 +14,56 @@ env: CARGO_TARGET_DIR: ${{ github.workspace }}/target jobs: - format: - name: Format Check - runs-on: self-hosted # TODO da spostare sul runner generico - # Su push sempre; su PR solo se non è draft - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - steps: - - name: Checkout magicblock-validator - uses: actions/checkout@v5 - with: - fetch-depth: 1 - - - name: Install Rust toolchain - run: | - rustup default 1.91.1 - rustc --version - cargo --version - - - name: Run ci-fmt - run: make ci-fmt - - - name: Run ci-fmt in test-integration - run: | - cd test-integration - make ci-fmt - - lint: - name: Lint Check - runs-on: self-hosted - # Su push sempre; su PR solo se non è draft - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - steps: - - name: Checkout magicblock-validator - uses: actions/checkout@v5 - with: - fetch-depth: 1 - - - name: Install Rust toolchain - run: | - rustup component add clippy --toolchain 1.91.1 - rustup default 1.91.1 - rustc --version - cargo --version - - - name: Run ci-lint - run: make ci-lint - - - name: Run ci-lint in test-integration - run: | - cd test-integration - make ci-lint +# format: +# name: Format Check +# runs-on: self-hosted # TODO da spostare sul runner generico +# # Su push sempre; su PR solo se non è draft +# if: github.event_name != 'pull_request' || github.event.pull_request.draft == false +# steps: +# - name: Checkout magicblock-validator +# uses: actions/checkout@v5 +# with: +# fetch-depth: 1 +# +# - name: Install Rust toolchain +# run: | +# rustup default 1.91.1 +# rustc --version +# cargo --version +# +# - name: Run ci-fmt +# run: make ci-fmt +# +# - name: Run ci-fmt in test-integration +# run: | +# cd test-integration +# make ci-fmt +# +# lint: +# name: Lint Check +# runs-on: self-hosted +# # Su push sempre; su PR solo se non è draft +# if: github.event_name != 'pull_request' || github.event.pull_request.draft == false +# steps: +# - name: Checkout magicblock-validator +# uses: actions/checkout@v5 +# with: +# fetch-depth: 1 +# +# - name: Install Rust toolchain +# run: | +# rustup component add clippy --toolchain 1.91.1 +# rustup default 1.91.1 +# rustc --version +# cargo --version +# +# - name: Run ci-lint +# run: make ci-lint +# +# - name: Run ci-lint in test-integration +# run: | +# cd test-integration +# make ci-lint # unit-tests: @@ -102,7 +102,7 @@ jobs: runs-on: self-hosted # Su push sempre; su PR solo se non è draft if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - needs: [format, lint] + # needs: [format, lint] strategy: fail-fast: false matrix: @@ -130,6 +130,11 @@ jobs: rustc --version cargo --version + - name: Checkout magicblock-validator + run: | + echo $PATH + echo $GITHUB_PATH + - name: Run integration tests - ${{ matrix.batch_tests }} run: | make ci-test-integration From 9623924e8a576b166d2e86f6d237eb97eb99e43e Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Tue, 20 Jan 2026 13:46:45 +0100 Subject: [PATCH 17/58] debug --- .github/workflows/ci.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc7445d8e..47924832c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,13 +130,10 @@ jobs: rustc --version cargo --version - - name: Checkout magicblock-validator - run: | - echo $PATH - echo $GITHUB_PATH - - name: Run integration tests - ${{ matrix.batch_tests }} run: | + # Rimuoviamo mold solo per questo step perché il linker SBF non lo supporta + export RUSTFLAGS="" make ci-test-integration env: RUN_TESTS: ${{ matrix.batch_tests }} From 8f63fddd7b13e4d36046aedebb86dabd85609e48 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Tue, 20 Jan 2026 16:49:59 +0100 Subject: [PATCH 18/58] debug --- .github/workflows/ci.yml | 178 +++++++++++++++++++-------------------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47924832c..15e85414a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,36 +14,64 @@ env: CARGO_TARGET_DIR: ${{ github.workspace }}/target jobs: -# format: -# name: Format Check -# runs-on: self-hosted # TODO da spostare sul runner generico -# # Su push sempre; su PR solo se non è draft -# if: github.event_name != 'pull_request' || github.event.pull_request.draft == false -# steps: -# - name: Checkout magicblock-validator -# uses: actions/checkout@v5 -# with: -# fetch-depth: 1 -# -# - name: Install Rust toolchain -# run: | -# rustup default 1.91.1 -# rustc --version -# cargo --version -# -# - name: Run ci-fmt -# run: make ci-fmt -# -# - name: Run ci-fmt in test-integration -# run: | -# cd test-integration -# make ci-fmt -# -# lint: -# name: Lint Check + format: + name: Format Check + runs-on: self-hosted + # Su push sempre; su PR solo se non è draft + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + steps: + - name: Checkout magicblock-validator + uses: actions/checkout@v5 + with: + fetch-depth: 1 + + - name: Install Rust toolchain + run: | + rustup default 1.91.1 + rustc --version + cargo --version + + - name: Run ci-fmt + run: make ci-fmt + + - name: Run ci-fmt in test-integration + run: | + cd test-integration + make ci-fmt + + lint: + name: Lint Check + runs-on: self-hosted + # Su push sempre; su PR solo se non è draft + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + steps: + - name: Checkout magicblock-validator + uses: actions/checkout@v5 + with: + fetch-depth: 1 + + - name: Install Rust toolchain + run: | + rustup component add clippy --toolchain 1.91.1 + rustup default 1.91.1 + rustc --version + cargo --version + + - name: Run ci-lint + run: make ci-lint + + - name: Run ci-lint in test-integration + run: | + cd test-integration + make ci-lint + + +# unit-tests: +# name: Unit Tests # runs-on: self-hosted # # Su push sempre; su PR solo se non è draft # if: github.event_name != 'pull_request' || github.event.pull_request.draft == false +# needs: [format, lint] # steps: # - name: Checkout magicblock-validator # uses: actions/checkout@v5 @@ -52,26 +80,44 @@ jobs: # # - name: Install Rust toolchain # run: | -# rustup component add clippy --toolchain 1.91.1 # rustup default 1.91.1 # rustc --version # cargo --version # -# - name: Run ci-lint -# run: make ci-lint +# - name: Install cargo-expand +# run: | +# if ! command -v cargo-expand &> /dev/null; then +# echo "cargo-expand not found, installing..." +# cargo install cargo-expand +# else +# echo "cargo-expand already installed" +# fi # -# - name: Run ci-lint in test-integration +# - name: Run unit tests # run: | -# cd test-integration -# make ci-lint - +# make ci-test-unit -# unit-tests: -# name: Unit Tests +# integration-tests: +# name: Integration Tests - ${{ matrix.batch_tests }} # runs-on: self-hosted # # Su push sempre; su PR solo se non è draft # if: github.event_name != 'pull_request' || github.event.pull_request.draft == false -# needs: [format, lint] +# # needs: [format, lint] +# strategy: +# fail-fast: false +# matrix: +# batch_tests: +# - "schedulecommit" +# - "chainlink" +# - "cloning" +# - "restore_ledger" +# - "magicblock_api" +# - "config" +# - "table_mania" +# - "committor" +# - "pubsub" +# - "schedule_intents" +# - "task-scheduler" # steps: # - name: Checkout magicblock-validator # uses: actions/checkout@v5 @@ -84,59 +130,13 @@ jobs: # rustc --version # cargo --version # -# - name: Install cargo-expand +# - name: Run integration tests - ${{ matrix.batch_tests }} # run: | -# if ! command -v cargo-expand &> /dev/null; then -# echo "cargo-expand not found, installing..." -# cargo install cargo-expand -# else -# echo "cargo-expand already installed" -# fi -# -# - name: Run unit tests -# run: | -# make ci-test-unit - - integration-tests: - name: Integration Tests - ${{ matrix.batch_tests }} - runs-on: self-hosted - # Su push sempre; su PR solo se non è draft - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - # needs: [format, lint] - strategy: - fail-fast: false - matrix: - batch_tests: - - "schedulecommit" - - "chainlink" - - "cloning" - - "restore_ledger" - - "magicblock_api" - - "config" - - "table_mania" - - "committor" - - "pubsub" - - "schedule_intents" - - "task-scheduler" - steps: - - name: Checkout magicblock-validator - uses: actions/checkout@v5 - with: - fetch-depth: 1 - - - name: Install Rust toolchain - run: | - rustup default 1.91.1 - rustc --version - cargo --version - - - name: Run integration tests - ${{ matrix.batch_tests }} - run: | - # Rimuoviamo mold solo per questo step perché il linker SBF non lo supporta - export RUSTFLAGS="" - make ci-test-integration - env: - RUN_TESTS: ${{ matrix.batch_tests }} +# # Rimuoviamo mold solo per questo step perché il linker SBF non lo supporta +# export RUSTFLAGS="" +# make ci-test-integration +# env: +# RUN_TESTS: ${{ matrix.batch_tests }} # ci-status: # name: CI Status From b6c51eec9ffd85e19394a05867f7be024e36902f Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Tue, 20 Jan 2026 17:16:49 +0100 Subject: [PATCH 19/58] debug --- .github/workflows/ci.yml | 58 +++++++++++----------------------------- 1 file changed, 15 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15e85414a..0aef10617 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,12 +25,6 @@ jobs: with: fetch-depth: 1 - - name: Install Rust toolchain - run: | - rustup default 1.91.1 - rustc --version - cargo --version - - name: Run ci-fmt run: make ci-fmt @@ -50,13 +44,6 @@ jobs: with: fetch-depth: 1 - - name: Install Rust toolchain - run: | - rustup component add clippy --toolchain 1.91.1 - rustup default 1.91.1 - rustc --version - cargo --version - - name: Run ci-lint run: make ci-lint @@ -66,36 +53,21 @@ jobs: make ci-lint -# unit-tests: -# name: Unit Tests -# runs-on: self-hosted -# # Su push sempre; su PR solo se non è draft -# if: github.event_name != 'pull_request' || github.event.pull_request.draft == false -# needs: [format, lint] -# steps: -# - name: Checkout magicblock-validator -# uses: actions/checkout@v5 -# with: -# fetch-depth: 1 -# -# - name: Install Rust toolchain -# run: | -# rustup default 1.91.1 -# rustc --version -# cargo --version -# -# - name: Install cargo-expand -# run: | -# if ! command -v cargo-expand &> /dev/null; then -# echo "cargo-expand not found, installing..." -# cargo install cargo-expand -# else -# echo "cargo-expand already installed" -# fi -# -# - name: Run unit tests -# run: | -# make ci-test-unit + unit-tests: + name: Unit Tests + runs-on: self-hosted + # Su push sempre; su PR solo se non è draft + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + needs: [format, lint] + steps: + - name: Checkout magicblock-validator + uses: actions/checkout@v5 + with: + fetch-depth: 1 + + - name: Run unit tests + run: | + make ci-test-unit # integration-tests: # name: Integration Tests - ${{ matrix.batch_tests }} From f1ddfbdefd22649ffe973e2e519796013ea1b950 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 16:04:02 +0100 Subject: [PATCH 20/58] debug --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0aef10617..374083c20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,8 @@ jobs: - name: Run unit tests run: | - make ci-test-unit +# make ci-test-unit + cargo test --test test_ledger_truncator # integration-tests: # name: Integration Tests - ${{ matrix.batch_tests }} From b55967e509aaad463f365629cbc33499cab278fb Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 16:04:54 +0100 Subject: [PATCH 21/58] debug --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 374083c20..dde11bc2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,6 @@ jobs: - name: Run unit tests run: | -# make ci-test-unit cargo test --test test_ledger_truncator # integration-tests: From 1b30d291f8e96ddc27315704f98f6ae089911fff Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 16:12:56 +0100 Subject: [PATCH 22/58] debug --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dde11bc2b..4947636bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,6 @@ jobs: runs-on: self-hosted # Su push sempre; su PR solo se non è draft if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - needs: [format, lint] steps: - name: Checkout magicblock-validator uses: actions/checkout@v5 @@ -67,7 +66,7 @@ jobs: - name: Run unit tests run: | - cargo test --test test_ledger_truncator + make ci-test-unit # integration-tests: # name: Integration Tests - ${{ matrix.batch_tests }} From 785d190e9758f55ce242aecf0c9c72bcdb50c2e4 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 16:52:53 +0100 Subject: [PATCH 23/58] debug --- .github/workflows/ci.yml | 131 +++++++++++++++++++++------------------ 1 file changed, 69 insertions(+), 62 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4947636bd..6a970f213 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,6 +58,9 @@ jobs: runs-on: self-hosted # Su push sempre; su PR solo se non è draft if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + needs: + - format + - lint steps: - name: Checkout magicblock-validator uses: actions/checkout@v5 @@ -66,65 +69,69 @@ jobs: - name: Run unit tests run: | - make ci-test-unit - -# integration-tests: -# name: Integration Tests - ${{ matrix.batch_tests }} -# runs-on: self-hosted -# # Su push sempre; su PR solo se non è draft -# if: github.event_name != 'pull_request' || github.event.pull_request.draft == false -# # needs: [format, lint] -# strategy: -# fail-fast: false -# matrix: -# batch_tests: -# - "schedulecommit" -# - "chainlink" -# - "cloning" -# - "restore_ledger" -# - "magicblock_api" -# - "config" -# - "table_mania" -# - "committor" -# - "pubsub" -# - "schedule_intents" -# - "task-scheduler" -# steps: -# - name: Checkout magicblock-validator -# uses: actions/checkout@v5 -# with: -# fetch-depth: 1 -# -# - name: Install Rust toolchain -# run: | -# rustup default 1.91.1 -# rustc --version -# cargo --version -# -# - name: Run integration tests - ${{ matrix.batch_tests }} -# run: | -# # Rimuoviamo mold solo per questo step perché il linker SBF non lo supporta -# export RUSTFLAGS="" -# make ci-test-integration -# env: -# RUN_TESTS: ${{ matrix.batch_tests }} - -# ci-status: -# name: CI Status -# runs-on: ubuntu-latest -# if: always() -# needs: -# - format -# - lint -# - integration-tests -# steps: -# - name: Check all jobs status -# run: | -# if [[ "${{ needs.format.result }}" != "success" || -# "${{ needs.lint.result }}" != "success" || -# "${{ needs.unit-tests.result }}" != "success" || -# "${{ needs.integration-tests.result }}" != "success" ]]; then -# echo "One or more CI jobs failed or were skipped" -# exit 1 -# fi -# echo "All CI jobs passed successfully" + RUST_TEST_THREADS=1 make ci-test-unit + + integration-tests: + name: Integration Tests - ${{ matrix.batch_tests }} + runs-on: self-hosted + # Su push sempre; su PR solo se non è draft + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + needs: + - format + - lint + - unit-tests + strategy: + fail-fast: false + matrix: + batch_tests: + - "schedulecommit" + - "chainlink" + - "cloning" + - "restore_ledger" + - "magicblock_api" + - "config" + - "table_mania" + - "committor" + - "pubsub" + - "schedule_intents" + - "task-scheduler" + steps: + - name: Checkout magicblock-validator + uses: actions/checkout@v5 + with: + fetch-depth: 1 + + - name: Install Rust toolchain + run: | + rustup default 1.91.1 + rustc --version + cargo --version + + - name: Run integration tests - ${{ matrix.batch_tests }} + run: | + # Rimuoviamo mold solo per questo step perché il linker SBF non lo supporta + export RUSTFLAGS="" + make ci-test-integration + env: + RUN_TESTS: ${{ matrix.batch_tests }} + + ci-status: + name: CI Status + runs-on: ubuntu-latest + if: always() + needs: + - format + - lint + - unit-tests + - integration-tests + steps: + - name: Check all jobs status + run: | + if [[ "${{ needs.format.result }}" != "success" || + "${{ needs.lint.result }}" != "success" || + "${{ needs.unit-tests.result }}" != "success" || + "${{ needs.integration-tests.result }}" != "success" ]]; then + echo "One or more CI jobs failed or were skipped" + exit 1 + fi + echo "All CI jobs passed successfully" From 794fe351509d69a4b59a000c016f8d3d5708af67 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 18:08:40 +0100 Subject: [PATCH 24/58] debug --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a970f213..47368d215 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,9 +58,6 @@ jobs: runs-on: self-hosted # Su push sempre; su PR solo se non è draft if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - needs: - - format - - lint steps: - name: Checkout magicblock-validator uses: actions/checkout@v5 From 594d556b68985e318020944e67584bdff233c1b6 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 18:39:29 +0100 Subject: [PATCH 25/58] debig --- .github/workflows/ci.yml | 85 ++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 55 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47368d215..1aa61c9e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,101 +12,82 @@ on: env: CARGO_TARGET_DIR: ${{ github.workspace }}/target + CARGO_BUILD_JOBS: 4 jobs: + setup-affinity: + name: Setup Affinity + runs-on: self-hosted + outputs: + runner_idx: ${{ steps.select.outputs.idx }} + steps: + - id: select + run: | + IDX=$(echo -n "${{ github.ref_name }}" | cksum | awk '{print ($1 % 10) + 1}') + echo "idx=$IDX" >> $GITHUB_OUTPUT + format: name: Format Check - runs-on: self-hosted - # Su push sempre; su PR solo se non è draft + needs: setup-affinity + runs-on: [self-hosted, "self-hosted-${{ needs.setup-affinity.outputs.runner_idx }}"] if: github.event_name != 'pull_request' || github.event.pull_request.draft == false steps: - name: Checkout magicblock-validator uses: actions/checkout@v5 with: fetch-depth: 1 - - - name: Run ci-fmt - run: make ci-fmt - - - name: Run ci-fmt in test-integration + - name: Run fmt run: | - cd test-integration make ci-fmt + cd test-integration && make ci-fmt lint: name: Lint Check - runs-on: self-hosted - # Su push sempre; su PR solo se non è draft + needs: setup-affinity + runs-on: [self-hosted, "self-hosted-${{ needs.setup-affinity.outputs.runner_idx }}"] if: github.event_name != 'pull_request' || github.event.pull_request.draft == false steps: - name: Checkout magicblock-validator uses: actions/checkout@v5 with: fetch-depth: 1 - - name: Run ci-lint - run: make ci-lint - - - name: Run ci-lint in test-integration run: | - cd test-integration + export RUSTC_WRAPPER="" + export CARGO_INCREMENTAL=1 + export CARGO_BUILD_JOBS=20 make ci-lint - + cd test-integration && make ci-lint unit-tests: name: Unit Tests - runs-on: self-hosted - # Su push sempre; su PR solo se non è draft + needs: setup-affinity + runs-on: [self-hosted, "self-hosted-${{ needs.setup-affinity.outputs.runner_idx }}"] if: github.event_name != 'pull_request' || github.event.pull_request.draft == false steps: - name: Checkout magicblock-validator uses: actions/checkout@v5 with: fetch-depth: 1 - - name: Run unit tests - run: | - RUST_TEST_THREADS=1 make ci-test-unit + run: RUST_TEST_THREADS=1 make ci-test-unit integration-tests: name: Integration Tests - ${{ matrix.batch_tests }} + needs: [setup-affinity, format, lint, unit-tests] runs-on: self-hosted - # Su push sempre; su PR solo se non è draft if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - needs: - - format - - lint - - unit-tests strategy: fail-fast: false matrix: - batch_tests: - - "schedulecommit" - - "chainlink" - - "cloning" - - "restore_ledger" - - "magicblock_api" - - "config" - - "table_mania" - - "committor" - - "pubsub" - - "schedule_intents" - - "task-scheduler" + batch_tests: ["schedulecommit", "chainlink", "cloning", "restore_ledger", "magicblock_api", "config", "table_mania", "committor", "pubsub", "schedule_intents", "task-scheduler"] steps: - name: Checkout magicblock-validator uses: actions/checkout@v5 with: fetch-depth: 1 - - - name: Install Rust toolchain - run: | - rustup default 1.91.1 - rustc --version - cargo --version - - - name: Run integration tests - ${{ matrix.batch_tests }} + - name: Run integration tests run: | - # Rimuoviamo mold solo per questo step perché il linker SBF non lo supporta export RUSTFLAGS="" make ci-test-integration env: @@ -116,11 +97,7 @@ jobs: name: CI Status runs-on: ubuntu-latest if: always() - needs: - - format - - lint - - unit-tests - - integration-tests + needs: [format, lint, unit-tests, integration-tests] steps: - name: Check all jobs status run: | @@ -128,7 +105,5 @@ jobs: "${{ needs.lint.result }}" != "success" || "${{ needs.unit-tests.result }}" != "success" || "${{ needs.integration-tests.result }}" != "success" ]]; then - echo "One or more CI jobs failed or were skipped" exit 1 - fi - echo "All CI jobs passed successfully" + fi \ No newline at end of file From da06109c5630e4155ef2a5b7bf5432c8555e066d Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 19:43:59 +0100 Subject: [PATCH 26/58] debug --- .github/workflows/ci.yml | 142 ++++++++++++++++++++------------------- 1 file changed, 72 insertions(+), 70 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1aa61c9e6..ed32e7369 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,100 +10,102 @@ on: pull_request: types: [opened, reopened, synchronize, ready_for_review] -env: - CARGO_TARGET_DIR: ${{ github.workspace }}/target - CARGO_BUILD_JOBS: 4 - jobs: - setup-affinity: - name: Setup Affinity + # 1. Calcolo della directory Target Globale + prepare-env: runs-on: self-hosted outputs: - runner_idx: ${{ steps.select.outputs.idx }} + target_dir: ${{ steps.calc.outputs.dir }} steps: - - id: select + - id: calc run: | - IDX=$(echo -n "${{ github.ref_name }}" | cksum | awk '{print ($1 % 10) + 1}') - echo "idx=$IDX" >> $GITHUB_OUTPUT + # Sostituisce gli slash nel nome branch con trattini + SAFE_BRANCH=$(echo "${{ github.ref_name }}" | tr '/' '-') + # Definisce il path assoluto condiviso + TARGET_DIR="/var/lib/gh-runners/global-targets/${{ github.event.repository.name }}-${SAFE_BRANCH}" + mkdir -p "$TARGET_DIR" + echo "dir=$TARGET_DIR" >> $GITHUB_OUTPUT - format: - name: Format Check - needs: setup-affinity - runs-on: [self-hosted, "self-hosted-${{ needs.setup-affinity.outputs.runner_idx }}"] - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + # 2. FASE DI BUILD MONOLITICA (Con Internet) + build-everything: + needs: prepare-env + runs-on: self-hosted + env: + # SOVRASCRITTURE RISPETTO AL RUNNER .ENV + # Usiamo la target persistente calcolata sopra + CARGO_TARGET_DIR: ${{ needs.prepare-env.outputs.target_dir }} + # Disabilitiamo sccache per favorire l'incrementale locale (più veloce su disco) + RUSTC_WRAPPER: "" + # Attiviamo l'incrementale per build rapide su modifiche piccole + CARGO_INCREMENTAL: 1 + # Usiamo 30 core (invece dei 4 di default) perché giriamo da soli + CARGO_BUILD_JOBS: 30 steps: - - name: Checkout magicblock-validator - uses: actions/checkout@v5 + - uses: actions/checkout@v5 with: - fetch-depth: 1 - - name: Run fmt - run: | - make ci-fmt - cd test-integration && make ci-fmt + submodules: recursive - lint: - name: Lint Check - needs: setup-affinity - runs-on: [self-hosted, "self-hosted-${{ needs.setup-affinity.outputs.runner_idx }}"] - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - steps: - - name: Checkout magicblock-validator - uses: actions/checkout@v5 - with: - fetch-depth: 1 - - name: Run ci-lint + - name: Build Everything & Pre-fetch dependencies run: | - export RUSTC_WRAPPER="" - export CARGO_INCREMENTAL=1 - export CARGO_BUILD_JOBS=20 + # 1. Build SBF (Programmi Solana) + make build-sbf + + # 2. Build Binaries & Test Runner + cargo build --bins --tests + + # 3. Fast Checks (Format, Lint, Unit) + # Eseguiamo qui i check veloci sfruttando i binari appena compilati + make ci-fmt make ci-lint - cd test-integration && make ci-lint + RUST_TEST_THREADS=1 make ci-test-unit + + # 4. PRE-FETCH per i test di integrazione + # Scarica e compila tutte le dipendenze dei test, ma NON li esegue (--no-run). + # Fondamentale per far funzionare lo step successivo offline. + cargo test --test '*' --no-run - unit-tests: - name: Unit Tests - needs: setup-affinity - runs-on: [self-hosted, "self-hosted-${{ needs.setup-affinity.outputs.runner_idx }}"] - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false - steps: - - name: Checkout magicblock-validator - uses: actions/checkout@v5 - with: - fetch-depth: 1 - - name: Run unit tests - run: RUST_TEST_THREADS=1 make ci-test-unit - - integration-tests: - name: Integration Tests - ${{ matrix.batch_tests }} - needs: [setup-affinity, format, lint, unit-tests] + # 3. FASE DI ESECUZIONE PARALLELA (ISOLATA - NO INTERNET) + integration-matrix: + needs: [prepare-env, build-everything] runs-on: self-hosted - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false strategy: fail-fast: false matrix: - batch_tests: ["schedulecommit", "chainlink", "cloning", "restore_ledger", "magicblock_api", "config", "table_mania", "committor", "pubsub", "schedule_intents", "task-scheduler"] + batch_tests: ["schedulecommit", "chainlink", "cloning", "restore_ledger", "table_mania", "committor", "pubsub", "task-scheduler"] + env: + # Punta alla stessa target directory già compilata dallo step precedente + CARGO_TARGET_DIR: ${{ needs.prepare-env.outputs.target_dir }} + # Forza Cargo a non cercare internet (siamo dentro un namespace isolato) + CARGO_NET_OFFLINE: "true" + # Disabilita wrapper inutili in esecuzione + RUSTC_WRAPPER: "" + # Pulisce flag che potrebbero dar fastidio all'esecuzione + RUSTFLAGS: "" steps: - - name: Checkout magicblock-validator - uses: actions/checkout@v5 + - uses: actions/checkout@v5 with: - fetch-depth: 1 - - name: Run integration tests + submodules: recursive + + - name: Run ${{ matrix.batch_tests }} (Network Namespace) run: | - export RUSTFLAGS="" - make ci-test-integration + # 'unshare -r -n' crea una bolla di rete vuota. + # Dentro questa bolla, la porta 8899 è libera per tutti i 10 job contemporaneamente. + # 'ip link set lo up' accende localhost dentro la bolla. + + unshare -r -n sh -c "ip link set lo up && make ci-test-integration" env: RUN_TESTS: ${{ matrix.batch_tests }} ci-status: - name: CI Status - runs-on: ubuntu-latest if: always() - needs: [format, lint, unit-tests, integration-tests] + needs: [build-everything, integration-matrix] + runs-on: ubuntu-latest steps: - - name: Check all jobs status + - name: Check Status run: | - if [[ "${{ needs.format.result }}" != "success" || - "${{ needs.lint.result }}" != "success" || - "${{ needs.unit-tests.result }}" != "success" || - "${{ needs.integration-tests.result }}" != "success" ]]; then + if [[ "${{ needs.build-everything.result }}" != "success" || + "${{ needs.integration-matrix.result }}" != "success" ]]; then + echo "CI Failed" exit 1 - fi \ No newline at end of file + fi + echo "CI Passed" \ No newline at end of file From 512b0416030a1637338994413477edf700cbf173 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 19:47:46 +0100 Subject: [PATCH 27/58] debug --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed32e7369..26e4de9c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: - name: Build Everything & Pre-fetch dependencies run: | # 1. Build SBF (Programmi Solana) - make build-sbf + make -C test-integration programs # 2. Build Binaries & Test Runner cargo build --bins --tests From 90fb8cf5e053370b53580aa7996f5ac61da1e0da Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 19:51:41 +0100 Subject: [PATCH 28/58] debug --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26e4de9c4..88b578fa4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,7 @@ jobs: CARGO_TARGET_DIR: ${{ needs.prepare-env.outputs.target_dir }} # Disabilitiamo sccache per favorire l'incrementale locale (più veloce su disco) RUSTC_WRAPPER: "" + RUSTFLAGS: "" # Attiviamo l'incrementale per build rapide su modifiche piccole CARGO_INCREMENTAL: 1 # Usiamo 30 core (invece dei 4 di default) perché giriamo da soli From 4b77c4294307b2279fe246fab98293e172ae327f Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 19:59:08 +0100 Subject: [PATCH 29/58] debug --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88b578fa4..577d3882c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,6 @@ jobs: runs-on: self-hosted env: # SOVRASCRITTURE RISPETTO AL RUNNER .ENV - # Usiamo la target persistente calcolata sopra CARGO_TARGET_DIR: ${{ needs.prepare-env.outputs.target_dir }} # Disabilitiamo sccache per favorire l'incrementale locale (più veloce su disco) RUSTC_WRAPPER: "" From 3ca20268a13ed341c5b85354342b43deb4645840 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 20:08:00 +0100 Subject: [PATCH 30/58] debug --- .github/workflows/ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 577d3882c..f68a5f324 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,6 +86,16 @@ jobs: with: submodules: recursive + - name: Restore timestamps to satisfy Cargo cache + run: | + echo "Syncing file timestamps to commit time..." + # Ottieni la data dell'ultimo commit + COMMIT_TIME=$(git show -s --format=%ci HEAD) + # Applica quella data a tutti i file (escludendo la cartella .git per velocità) + # Questo è velocissimo sui tuoi 40 core + find . -type f -not -path "./.git/*" -exec touch -d "$COMMIT_TIME" {} + + echo "Timestamps synced to $COMMIT_TIME" + - name: Run ${{ matrix.batch_tests }} (Network Namespace) run: | # 'unshare -r -n' crea una bolla di rete vuota. From 19e670677ba0bb09245ab02a3aa25a89ed50905a Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 20:57:12 +0100 Subject: [PATCH 31/58] debug --- .github/workflows/ci.yml | 107 +++++++++++++++++++++++++++++---------- 1 file changed, 79 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f68a5f324..09c4a6266 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ on: types: [opened, reopened, synchronize, ready_for_review] jobs: - # 1. Calcolo della directory Target Globale + # 1. Compute shared global target directory (per branch) prepare-env: runs-on: self-hosted outputs: @@ -19,26 +19,26 @@ jobs: steps: - id: calc run: | - # Sostituisce gli slash nel nome branch con trattini + # Replace slashes in branch name to make it filesystem-safe SAFE_BRANCH=$(echo "${{ github.ref_name }}" | tr '/' '-') - # Definisce il path assoluto condiviso + # Define the global shared target directory for this repo + branch TARGET_DIR="/var/lib/gh-runners/global-targets/${{ github.event.repository.name }}-${SAFE_BRANCH}" mkdir -p "$TARGET_DIR" echo "dir=$TARGET_DIR" >> $GITHUB_OUTPUT - # 2. FASE DI BUILD MONOLITICA (Con Internet) + # 2. MONOLITHIC BUILD PHASE (with Internet) build-everything: needs: prepare-env runs-on: self-hosted env: - # SOVRASCRITTURE RISPETTO AL RUNNER .ENV + # Override runner defaults CARGO_TARGET_DIR: ${{ needs.prepare-env.outputs.target_dir }} - # Disabilitiamo sccache per favorire l'incrementale locale (più veloce su disco) + # Disable sccache to favor local incremental builds on disk RUSTC_WRAPPER: "" RUSTFLAGS: "" - # Attiviamo l'incrementale per build rapide su modifiche piccole + # Enable incremental builds for faster small changes CARGO_INCREMENTAL: 1 - # Usiamo 30 core (invece dei 4 di default) perché giriamo da soli + # Use many cores because this job runs alone on the runner CARGO_BUILD_JOBS: 30 steps: - uses: actions/checkout@v5 @@ -47,24 +47,46 @@ jobs: - name: Build Everything & Pre-fetch dependencies run: | - # 1. Build SBF (Programmi Solana) + # 1. Build SBF (Solana programs) for integration tests make -C test-integration programs - # 2. Build Binaries & Test Runner + # 2. Build binaries & test runner cargo build --bins --tests - # 3. Fast Checks (Format, Lint, Unit) - # Eseguiamo qui i check veloci sfruttando i binari appena compilati + # 3. Fast checks (format, lint, unit tests) make ci-fmt make ci-lint RUST_TEST_THREADS=1 make ci-test-unit - # 4. PRE-FETCH per i test di integrazione - # Scarica e compila tutte le dipendenze dei test, ma NON li esegue (--no-run). - # Fondamentale per far funzionare lo step successivo offline. + # 4. PRE-FETCH for integration tests + # Download and compile test dependencies, but do NOT run tests. cargo test --test '*' --no-run - # 3. FASE DI ESECUZIONE PARALLELA (ISOLATA - NO INTERNET) + # 5. SAVE SBF ARTIFACTS INTO THE GLOBAL TARGET + # This allows matrix jobs to reuse the same .so files without rebuilding. + SBF_CACHE_DIR="$CARGO_TARGET_DIR/sbf-artifacts" + echo "Saving SBF artifacts into $SBF_CACHE_DIR ..." + mkdir -p "$SBF_CACHE_DIR/test-integration" "$SBF_CACHE_DIR/root" + + # SBF programs built under test-integration (DEPLOY_DIR) + if ls test-integration/target/deploy/*.so >/dev/null 2>&1; then + cp test-integration/target/deploy/*.so "$SBF_CACHE_DIR/test-integration/" + echo "Copied test-integration SBFs to cache:" + ls -1 "$SBF_CACHE_DIR/test-integration/" + else + echo "WARNING: no SBFs found in test-integration/target/deploy" + fi + + # Committor program built under root target/deploy (ROOT_DEPLOY_DIR = ../target/deploy) + if ls target/deploy/*.so >/dev/null 2>&1; then + cp target/deploy/*.so "$SBF_CACHE_DIR/root/" + echo "Copied root SBFs to cache:" + ls -1 "$SBF_CACHE_DIR/root/" + else + echo "WARNING: no SBFs found in target/deploy" + fi + + # 3. PARALLEL INTEGRATION TEST PHASE (isolated network - no Internet) integration-matrix: needs: [prepare-env, build-everything] runs-on: self-hosted @@ -73,13 +95,13 @@ jobs: matrix: batch_tests: ["schedulecommit", "chainlink", "cloning", "restore_ledger", "table_mania", "committor", "pubsub", "task-scheduler"] env: - # Punta alla stessa target directory già compilata dallo step precedente + # Point Cargo to the same global target directory from the build phase CARGO_TARGET_DIR: ${{ needs.prepare-env.outputs.target_dir }} - # Forza Cargo a non cercare internet (siamo dentro un namespace isolato) + # Force Cargo not to hit the network (we are inside a network namespace) CARGO_NET_OFFLINE: "true" - # Disabilita wrapper inutili in esecuzione + # Disable any wrappers that might interfere during test execution RUSTC_WRAPPER: "" - # Pulisce flag che potrebbero dar fastidio all'esecuzione + # Clear potentially problematic flags RUSTFLAGS: "" steps: - uses: actions/checkout@v5 @@ -89,23 +111,52 @@ jobs: - name: Restore timestamps to satisfy Cargo cache run: | echo "Syncing file timestamps to commit time..." - # Ottieni la data dell'ultimo commit + # Get the commit timestamp of HEAD COMMIT_TIME=$(git show -s --format=%ci HEAD) - # Applica quella data a tutti i file (escludendo la cartella .git per velocità) - # Questo è velocissimo sui tuoi 40 core + # Apply that timestamp to all files (excluding .git for speed) find . -type f -not -path "./.git/*" -exec touch -d "$COMMIT_TIME" {} + echo "Timestamps synced to $COMMIT_TIME" + - name: Restore prebuilt SBF programs from Global Target + run: | + SBF_CACHE_DIR="$CARGO_TARGET_DIR/sbf-artifacts" + echo "Restoring SBF artifacts from $SBF_CACHE_DIR ..." + + # 1) Restore SBFs for test-integration (DEPLOY_DIR) + LOCAL_DEPLOY_TEST="test-integration/target/deploy" + mkdir -p "$LOCAL_DEPLOY_TEST" + if ls "$SBF_CACHE_DIR/test-integration"/*.so >/dev/null 2>&1; then + cp "$SBF_CACHE_DIR/test-integration"/*.so "$LOCAL_DEPLOY_TEST/" + # Touch to ensure the .so files are newer than sources (so Make will not rebuild them) + touch "$LOCAL_DEPLOY_TEST"/*.so + echo "Restored test-integration SBFs:" + ls -1 "$LOCAL_DEPLOY_TEST/" + else + echo "WARNING: no cached SBFs found for test-integration" + fi + + # 2) Restore SBFs for root target (committor program, ROOT_DEPLOY_DIR) + LOCAL_DEPLOY_ROOT="target/deploy" + mkdir -p "$LOCAL_DEPLOY_ROOT" + if ls "$SBF_CACHE_DIR/root"/*.so >/dev/null 2>&1; then + cp "$SBF_CACHE_DIR/root"/*.so "$LOCAL_DEPLOY_ROOT/" + touch "$LOCAL_DEPLOY_ROOT"/*.so + echo "Restored root SBFs:" + ls -1 "$LOCAL_DEPLOY_ROOT/" + else + echo "WARNING: no cached SBFs found for root" + fi + - name: Run ${{ matrix.batch_tests }} (Network Namespace) run: | - # 'unshare -r -n' crea una bolla di rete vuota. - # Dentro questa bolla, la porta 8899 è libera per tutti i 10 job contemporaneamente. - # 'ip link set lo up' accende localhost dentro la bolla. - + # 'unshare -r -n' creates an isolated network namespace. + # Inside this bubble, port 8899 is free for all 10 jobs at the same time. + # 'ip link set lo up' brings up the loopback interface inside the namespace. unshare -r -n sh -c "ip link set lo up && make ci-test-integration" env: RUN_TESTS: ${{ matrix.batch_tests }} + # 4. Aggregate status for CI (single green/red check) ci-status: if: always() needs: [build-everything, integration-matrix] @@ -118,4 +169,4 @@ jobs: echo "CI Failed" exit 1 fi - echo "CI Passed" \ No newline at end of file + echo "CI Passed" From 6da3f616d0605ab68dbff9dd7c60bb9bc61a8a78 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 21:18:25 +0100 Subject: [PATCH 32/58] debug --- test-integration/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test-integration/Makefile b/test-integration/Makefile index 95ff8551e..038f8c77c 100644 --- a/test-integration/Makefile +++ b/test-integration/Makefile @@ -30,7 +30,13 @@ list-programs: programs: $(PROGRAMS_SO) test: $(PROGRAMS_SO) - $(MAKE) chainlink-prep-programs -C ./test-chainlink && \ + @# Only prepare chainlink programs when running chainlink tests + @if [ -z "$(RUN_TESTS)" ] || [ "$(RUN_TESTS)" = "chainlink" ]; then \ + echo "Preparing chainlink programs (RUN_TESTS=$(RUN_TESTS))"; \ + $(MAKE) chainlink-prep-programs -C ./test-chainlink; \ + else \ + echo "Skipping chainlink-prep-programs for RUN_TESTS=$(RUN_TESTS)"; \ + fi RUST_BACKTRACE=1 \ RUST_LOG=$(RUST_LOG) \ cargo run --package test-runner --bin run-tests From 18e1f3dd4280c74e66fc8afb9a43a5dac82caad7 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 21:30:36 +0100 Subject: [PATCH 33/58] debug --- test-integration/Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test-integration/Makefile b/test-integration/Makefile index 038f8c77c..adb71e25c 100644 --- a/test-integration/Makefile +++ b/test-integration/Makefile @@ -1,5 +1,6 @@ # Makefile for building and testing Solana programs and test suitesk DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +TEST_RUNNER_BIN := $(DIR)../target/debug/run-tests DEPLOY_DIR := $(DIR)target/deploy ROOT_DEPLOY_DIR := $(DIR)../target/deploy @@ -37,9 +38,15 @@ test: $(PROGRAMS_SO) else \ echo "Skipping chainlink-prep-programs for RUN_TESTS=$(RUN_TESTS)"; \ fi - RUST_BACKTRACE=1 \ - RUST_LOG=$(RUST_LOG) \ - cargo run --package test-runner --bin run-tests + @# Prefer running the prebuilt test-runner binary to avoid concurrent Cargo locking + @if [ -x "$(TEST_RUNNER_BIN)" ]; then \ + echo "Using prebuilt test-runner binary: $(TEST_RUNNER_BIN)"; \ + RUST_BACKTRACE=1 RUST_LOG=$(RUST_LOG) $(TEST_RUNNER_BIN); \ + else \ + echo "test-runner binary not found, falling back to 'cargo run'"; \ + RUST_BACKTRACE=1 RUST_LOG=$(RUST_LOG) cargo run --package test-runner --bin run-tests; \ + fi + test-force-mb: $(PROGRAMS_SO) RUST_LOG=$(RUST_LOG) \ From 1970d4080fa921b777163584daed4ba46d04f6ec Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 21:38:25 +0100 Subject: [PATCH 34/58] debug --- .github/workflows/ci.yml | 2 +- magicblock-ledger/tests/test_ledger_truncator.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09c4a6266..048e7bf7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: # 3. Fast checks (format, lint, unit tests) make ci-fmt make ci-lint - RUST_TEST_THREADS=1 make ci-test-unit + make ci-test-unit # 4. PRE-FETCH for integration tests # Download and compile test dependencies, but do NOT run tests. diff --git a/magicblock-ledger/tests/test_ledger_truncator.rs b/magicblock-ledger/tests/test_ledger_truncator.rs index 6801ae086..766be87ee 100644 --- a/magicblock-ledger/tests/test_ledger_truncator.rs +++ b/magicblock-ledger/tests/test_ledger_truncator.rs @@ -77,6 +77,7 @@ async fn test_truncator_not_purged_size() { } // Tests that ledger got truncated but not after finality slot +#[ignore = "Flaky test"] #[tokio::test] async fn test_truncator_non_empty_ledger() { init_logger!(); From c90a5e380b0cd00cec7e7f8122c9e961496f46fa Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 21 Jan 2026 21:43:45 +0100 Subject: [PATCH 35/58] debug --- test-integration/Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test-integration/Makefile b/test-integration/Makefile index adb71e25c..05592d5fd 100644 --- a/test-integration/Makefile +++ b/test-integration/Makefile @@ -1,9 +1,15 @@ # Makefile for building and testing Solana programs and test suitesk DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -TEST_RUNNER_BIN := $(DIR)../target/debug/run-tests DEPLOY_DIR := $(DIR)target/deploy ROOT_DEPLOY_DIR := $(DIR)../target/deploy +# Use CARGO_TARGET_DIR if provided by the environment (CI), +# otherwise default to ../target for local development. +CARGO_TARGET_DIR ?= $(DIR)../target + +# Prebuilt test-runner binary path (dev profile) +TEST_RUNNER_BIN := $(CARGO_TARGET_DIR)/debug/run-tests + RUST_LOG ?= 'warn,geyser_plugin=warn,magicblock=trace,magicblock_chainlink::remote_account_provider::chain_pubsub_actor=debug,rpc=trace,bank=trace,banking_stage=warn,solana_geyser_plugin_manager=warn,solana_svm=warn,test_tools=trace,schedulecommit_test=trace,' FLEXI_COUNTER_DIR := $(DIR)programs/flexi-counter @@ -47,7 +53,6 @@ test: $(PROGRAMS_SO) RUST_BACKTRACE=1 RUST_LOG=$(RUST_LOG) cargo run --package test-runner --bin run-tests; \ fi - test-force-mb: $(PROGRAMS_SO) RUST_LOG=$(RUST_LOG) \ FORCE_MAGIC_BLOCK_VALIDATOR=1 \ From 0294544053795e1554a2783631d74592554201e6 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 22 Jan 2026 14:50:29 +0100 Subject: [PATCH 36/58] debug --- .github/workflows/ci.yml | 18 ++++++++++++++++-- test-integration/Makefile | 4 ++-- test-integration/test-runner/bin/run_tests.rs | 5 ++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 048e7bf7c..dcdd5415b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,14 +95,17 @@ jobs: matrix: batch_tests: ["schedulecommit", "chainlink", "cloning", "restore_ledger", "table_mania", "committor", "pubsub", "task-scheduler"] env: - # Point Cargo to the same global target directory from the build phase - CARGO_TARGET_DIR: ${{ needs.prepare-env.outputs.target_dir }} + # Use local target dir to avoid locking issues between parallel runners + # CARGO_TARGET_DIR: ${{ needs.prepare-env.outputs.target_dir }} # Force Cargo not to hit the network (we are inside a network namespace) CARGO_NET_OFFLINE: "true" # Disable any wrappers that might interfere during test execution RUSTC_WRAPPER: "" # Clear potentially problematic flags RUSTFLAGS: "" + # Limit concurrency per runner to avoid oversubscribing the shared host + CARGO_BUILD_JOBS: 4 + NEXTEST_RETRIES: 0 steps: - uses: actions/checkout@v5 with: @@ -117,6 +120,17 @@ jobs: find . -type f -not -path "./.git/*" -exec touch -d "$COMMIT_TIME" {} + echo "Timestamps synced to $COMMIT_TIME" + - name: Copy Pre-built Artifacts to Local Target + run: | + GLOBAL_TARGET="${{ needs.prepare-env.outputs.target_dir }}" + echo "Copying artifacts from $GLOBAL_TARGET to ./target ..." + mkdir -p target + # Use recursive copy. -u only copies if source is newer/different (though here it's fresh) + cp -r "$GLOBAL_TARGET"/* target/ + # Ensure timestamps are preserved/updated so cargo doesn't rebuild + find target -name "*.d" -exec touch {} + + find target -name "*.rlib" -exec touch {} + + - name: Restore prebuilt SBF programs from Global Target run: | SBF_CACHE_DIR="$CARGO_TARGET_DIR/sbf-artifacts" diff --git a/test-integration/Makefile b/test-integration/Makefile index 05592d5fd..9f646df63 100644 --- a/test-integration/Makefile +++ b/test-integration/Makefile @@ -47,10 +47,10 @@ test: $(PROGRAMS_SO) @# Prefer running the prebuilt test-runner binary to avoid concurrent Cargo locking @if [ -x "$(TEST_RUNNER_BIN)" ]; then \ echo "Using prebuilt test-runner binary: $(TEST_RUNNER_BIN)"; \ - RUST_BACKTRACE=1 RUST_LOG=$(RUST_LOG) $(TEST_RUNNER_BIN); \ + CARGO_TEST_THREADS=$${CARGO_TEST_THREADS:-1} CARGO_MANIFEST_DIR=$(DIR)test-runner RUST_BACKTRACE=1 RUST_LOG=$(RUST_LOG) $(TEST_RUNNER_BIN); \ else \ echo "test-runner binary not found, falling back to 'cargo run'"; \ - RUST_BACKTRACE=1 RUST_LOG=$(RUST_LOG) cargo run --package test-runner --bin run-tests; \ + CARGO_TEST_THREADS=$${CARGO_TEST_THREADS:-1} RUST_BACKTRACE=1 RUST_LOG=$(RUST_LOG) cargo run --package test-runner --bin run-tests; \ fi test-force-mb: $(PROGRAMS_SO) diff --git a/test-integration/test-runner/bin/run_tests.rs b/test-integration/test-runner/bin/run_tests.rs index 6a5a6e9c7..6dd505e23 100644 --- a/test-integration/test-runner/bin/run_tests.rs +++ b/test-integration/test-runner/bin/run_tests.rs @@ -790,7 +790,10 @@ fn run_test( if let Some(test) = config.test { cmd.arg(format!("'{}'", test)); } - cmd.arg("--").arg("--test-threads=1").arg("--nocapture"); + let test_threads = std::env::var("CARGO_TEST_THREADS").unwrap_or_else(|_| "1".to_string()); + cmd.arg("--") + .arg(format!("--test-threads={}", test_threads)) + .arg("--nocapture"); cmd.current_dir(manifest_dir.clone()); Teepee::new(cmd).output() } From 4c4894effd66d5eac78ccb34b793eb49149dddb6 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 22 Jan 2026 15:02:46 +0100 Subject: [PATCH 37/58] debug --- .github/workflows/ci.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dcdd5415b..e57eac9f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,16 +120,21 @@ jobs: find . -type f -not -path "./.git/*" -exec touch -d "$COMMIT_TIME" {} + echo "Timestamps synced to $COMMIT_TIME" - - name: Copy Pre-built Artifacts to Local Target + - name: Copy Pre-built Artifacts to Local Target (Hardlinks) run: | GLOBAL_TARGET="${{ needs.prepare-env.outputs.target_dir }}" - echo "Copying artifacts from $GLOBAL_TARGET to ./target ..." + echo "Linking artifacts from $GLOBAL_TARGET to ./target ..." mkdir -p target - # Use recursive copy. -u only copies if source is newer/different (though here it's fresh) - cp -r "$GLOBAL_TARGET"/* target/ - # Ensure timestamps are preserved/updated so cargo doesn't rebuild - find target -name "*.d" -exec touch {} + - find target -name "*.rlib" -exec touch {} + + + # 1. Use hardlinks (-l) to avoid duplicating data (instant + 0 disk usage) + # 2. Only link 'debug' directory (contains test binaries) + # Note: This assumes runners are on the same filesystem as GLOBAL_TARGET + cp -rl "$GLOBAL_TARGET/debug" target/ + + # 3. Remove 'incremental' compilation data (huge & useless for running tests) + rm -rf target/debug/incremental + + echo "Artifacts linked successfully." - name: Restore prebuilt SBF programs from Global Target run: | From 511f67fd2575982c64dca2ba03ba4b7ee675b538 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 22 Jan 2026 15:14:57 +0100 Subject: [PATCH 38/58] debug --- .github/workflows/ci.yml | 25 ++++++++++++++++--------- test-integration/Makefile | 4 ++-- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e57eac9f0..3cb09bc0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,6 +50,9 @@ jobs: # 1. Build SBF (Solana programs) for integration tests make -C test-integration programs + # 1.5 Build Chainlink auxiliary programs + make chainlink-prep-programs -C test-integration/test-chainlink + # 2. Build binaries & test runner cargo build --bins --tests @@ -69,12 +72,13 @@ jobs: mkdir -p "$SBF_CACHE_DIR/test-integration" "$SBF_CACHE_DIR/root" # SBF programs built under test-integration (DEPLOY_DIR) - if ls test-integration/target/deploy/*.so >/dev/null 2>&1; then - cp test-integration/target/deploy/*.so "$SBF_CACHE_DIR/test-integration/" + # Use recursive copy to capture subdirectories (e.g., miniv2/) + if [ -d "test-integration/target/deploy" ]; then + cp -r test-integration/target/deploy/* "$SBF_CACHE_DIR/test-integration/" echo "Copied test-integration SBFs to cache:" - ls -1 "$SBF_CACHE_DIR/test-integration/" + ls -R "$SBF_CACHE_DIR/test-integration/" else - echo "WARNING: no SBFs found in test-integration/target/deploy" + echo "WARNING: test-integration/target/deploy not found" fi # Committor program built under root target/deploy (ROOT_DEPLOY_DIR = ../target/deploy) @@ -144,12 +148,13 @@ jobs: # 1) Restore SBFs for test-integration (DEPLOY_DIR) LOCAL_DEPLOY_TEST="test-integration/target/deploy" mkdir -p "$LOCAL_DEPLOY_TEST" - if ls "$SBF_CACHE_DIR/test-integration"/*.so >/dev/null 2>&1; then - cp "$SBF_CACHE_DIR/test-integration"/*.so "$LOCAL_DEPLOY_TEST/" + if [ -d "$SBF_CACHE_DIR/test-integration" ]; then + cp -r "$SBF_CACHE_DIR/test-integration"/* "$LOCAL_DEPLOY_TEST/" # Touch to ensure the .so files are newer than sources (so Make will not rebuild them) - touch "$LOCAL_DEPLOY_TEST"/*.so + # Find all files (including those in subdirs) and touch them + find "$LOCAL_DEPLOY_TEST" -type f -exec touch {} + echo "Restored test-integration SBFs:" - ls -1 "$LOCAL_DEPLOY_TEST/" + ls -R "$LOCAL_DEPLOY_TEST/" else echo "WARNING: no cached SBFs found for test-integration" fi @@ -171,7 +176,9 @@ jobs: # 'unshare -r -n' creates an isolated network namespace. # Inside this bubble, port 8899 is free for all 10 jobs at the same time. # 'ip link set lo up' brings up the loopback interface inside the namespace. - unshare -r -n sh -c "ip link set lo up && make ci-test-integration" + # We pass PROGRAMS_SO="" to empty the dependency list for 'make test' + # We pass SKIP_CHAINLINK_PREP=1 to skip the chainlink prep step + unshare -r -n sh -c "ip link set lo up && make ci-test-integration PROGRAMS_SO= SKIP_CHAINLINK_PREP=1" env: RUN_TESTS: ${{ matrix.batch_tests }} diff --git a/test-integration/Makefile b/test-integration/Makefile index 9f646df63..1c82858f2 100644 --- a/test-integration/Makefile +++ b/test-integration/Makefile @@ -38,11 +38,11 @@ programs: $(PROGRAMS_SO) test: $(PROGRAMS_SO) @# Only prepare chainlink programs when running chainlink tests - @if [ -z "$(RUN_TESTS)" ] || [ "$(RUN_TESTS)" = "chainlink" ]; then \ + @if [ -z "$(SKIP_CHAINLINK_PREP)" ] && ([ -z "$(RUN_TESTS)" ] || [ "$(RUN_TESTS)" = "chainlink" ]); then \ echo "Preparing chainlink programs (RUN_TESTS=$(RUN_TESTS))"; \ $(MAKE) chainlink-prep-programs -C ./test-chainlink; \ else \ - echo "Skipping chainlink-prep-programs for RUN_TESTS=$(RUN_TESTS)"; \ + echo "Skipping chainlink-prep-programs (SKIP_CHAINLINK_PREP=$(SKIP_CHAINLINK_PREP), RUN_TESTS=$(RUN_TESTS))"; \ fi @# Prefer running the prebuilt test-runner binary to avoid concurrent Cargo locking @if [ -x "$(TEST_RUNNER_BIN)" ]; then \ From 731563de1733a3b117a6582cee92f8dcaad5f153 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 22 Jan 2026 15:29:55 +0100 Subject: [PATCH 39/58] debug --- .github/workflows/ci.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cb09bc0b..71de920f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,10 +97,15 @@ jobs: strategy: fail-fast: false matrix: - batch_tests: ["schedulecommit", "chainlink", "cloning", "restore_ledger", "table_mania", "committor", "pubsub", "task-scheduler"] + # Batch tests to reduce concurrent load (3 runners instead of 8) + # Each string contains space-separated tests to run sequentially + batch_tests: + - "schedulecommit chainlink cloning" + - "restore_ledger table_mania committor" + - "pubsub task-scheduler" env: - # Use local target dir to avoid locking issues between parallel runners - # CARGO_TARGET_DIR: ${{ needs.prepare-env.outputs.target_dir }} + # Use RAM disk for temporary files (Ledger, RocksDB) to save Disk I/O + TMPDIR: "/dev/shm" # Force Cargo not to hit the network (we are inside a network namespace) CARGO_NET_OFFLINE: "true" # Disable any wrappers that might interfere during test execution @@ -174,13 +179,22 @@ jobs: - name: Run ${{ matrix.batch_tests }} (Network Namespace) run: | # 'unshare -r -n' creates an isolated network namespace. - # Inside this bubble, port 8899 is free for all 10 jobs at the same time. - # 'ip link set lo up' brings up the loopback interface inside the namespace. + # Inside this bubble, port 8899 is free for all parallel jobs. + # We loop through the batch list and run tests sequentially in this runner. # We pass PROGRAMS_SO="" to empty the dependency list for 'make test' # We pass SKIP_CHAINLINK_PREP=1 to skip the chainlink prep step - unshare -r -n sh -c "ip link set lo up && make ci-test-integration PROGRAMS_SO= SKIP_CHAINLINK_PREP=1" + unshare -r -n sh -c " + ip link set lo up + for test in ${{ matrix.batch_tests }}; do + echo \"--------------------------------------------------\" + echo \"Running test suite: \$test\" + echo \"--------------------------------------------------\" + RUN_TESTS=\$test make ci-test-integration PROGRAMS_SO= SKIP_CHAINLINK_PREP=1 + done + " env: - RUN_TESTS: ${{ matrix.batch_tests }} + # Not used directly in the loop, but kept for context if needed + BATCH_LIST: ${{ matrix.batch_tests }} # 4. Aggregate status for CI (single green/red check) ci-status: From 6f5080be75c9356816dc31311ef4143ad3ae0952 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 22 Jan 2026 15:38:06 +0100 Subject: [PATCH 40/58] debug --- .github/workflows/ci.yml | 7 +++++++ test-integration/test-tools/src/toml_to_args.rs | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71de920f0..37b184f7d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -176,6 +176,13 @@ jobs: echo "WARNING: no cached SBFs found for root" fi + - name: Debug - List Critical Directories + run: | + echo "Listing test-integration/target/deploy:" + ls -R test-integration/target/deploy || echo "Directory not found" + echo "Listing test-integration/schedulecommit/elfs:" + ls -R test-integration/schedulecommit/elfs || echo "Directory not found" + - name: Run ${{ matrix.batch_tests }} (Network Namespace) run: | # 'unshare -r -n' creates an isolated network namespace. diff --git a/test-integration/test-tools/src/toml_to_args.rs b/test-integration/test-tools/src/toml_to_args.rs index 2d9025db8..35fd06981 100644 --- a/test-integration/test-tools/src/toml_to_args.rs +++ b/test-integration/test-tools/src/toml_to_args.rs @@ -80,8 +80,13 @@ pub fn config_to_args( args.push(program.id); + let full_path_to_resolve = config_dir.join(&program.path); + eprintln!("Resolving program path: {:?}", full_path_to_resolve); let resolved_full_config_path = - config_dir.join(&program.path).canonicalize().unwrap(); + full_path_to_resolve.canonicalize().expect(&format!( + "Failed to canonicalize program path: {:?}", + full_path_to_resolve + )); args.push(resolved_full_config_path.to_str().unwrap().to_string()); if program_loader == ProgramLoader::UpgradeableProgram { From 30848ae5e96f11d82f47ee774899af5fecd9e301 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 22 Jan 2026 15:48:03 +0100 Subject: [PATCH 41/58] debug --- .github/workflows/ci.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37b184f7d..9eb0991f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,10 +48,16 @@ jobs: - name: Build Everything & Pre-fetch dependencies run: | # 1. Build SBF (Solana programs) for integration tests - make -C test-integration programs + # Unset CARGO_TARGET_DIR for SBF builds to ensure they write to local target/deploy + ( + unset CARGO_TARGET_DIR + echo "Building SBF programs with local target dir..." + make -C test-integration programs + make chainlink-prep-programs -C test-integration/test-chainlink + ) - # 1.5 Build Chainlink auxiliary programs - make chainlink-prep-programs -C test-integration/test-chainlink + echo "Verifying SBF build output:" + ls -R test-integration/target/deploy || echo "Deploy dir missing!" # 2. Build binaries & test runner cargo build --bins --tests From c8f2ae523e029344f44877399679323472118e08 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 22 Jan 2026 16:00:02 +0100 Subject: [PATCH 42/58] debug --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9eb0991f8..e0f1d559a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,12 @@ jobs: echo "Verifying SBF build output:" ls -R test-integration/target/deploy || echo "Deploy dir missing!" + # Force rebuild of test-runner to include our debug prints + echo "Forcing rebuild of test-runner..." + touch test-integration/test-runner/bin/run_tests.rs + # Also touch the library it depends on just in case + touch test-integration/test-tools/src/lib.rs + # 2. Build binaries & test runner cargo build --bins --tests From a8c4f7cb0e5914fa764639c8483f2eef1b3f0625 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 22 Jan 2026 16:07:56 +0100 Subject: [PATCH 43/58] debug --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0f1d559a..7fe151cf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -159,7 +159,8 @@ jobs: - name: Restore prebuilt SBF programs from Global Target run: | - SBF_CACHE_DIR="$CARGO_TARGET_DIR/sbf-artifacts" + GLOBAL_TARGET_DIR="${{ needs.prepare-env.outputs.target_dir }}" + SBF_CACHE_DIR="$GLOBAL_TARGET_DIR/sbf-artifacts" echo "Restoring SBF artifacts from $SBF_CACHE_DIR ..." # 1) Restore SBFs for test-integration (DEPLOY_DIR) From 82491722237a7c2bf1f145b53cb223245f65f20d Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 22 Jan 2026 16:20:02 +0100 Subject: [PATCH 44/58] improve --- .github/workflows/ci.yml | 4 ++ test-integration/test-runner/bin/run_tests.rs | 3 +- test-integration/test-tools/src/validator.rs | 37 ++++++++++++------- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fe151cf3..21e30b941 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,10 @@ jobs: # 2. Build binaries & test runner cargo build --bins --tests + # 2.5 Pre-build everything in test-integration workspace + echo "Pre-building test-integration workspace..." + cargo build --manifest-path test-integration/Cargo.toml --bins --tests + # 3. Fast checks (format, lint, unit tests) make ci-fmt make ci-lint diff --git a/test-integration/test-runner/bin/run_tests.rs b/test-integration/test-runner/bin/run_tests.rs index 6dd505e23..7a816d0ec 100644 --- a/test-integration/test-runner/bin/run_tests.rs +++ b/test-integration/test-runner/bin/run_tests.rs @@ -783,7 +783,8 @@ fn run_test( "RUST_LOG", std::env::var("RUST_LOG").unwrap_or_else(|_| "info".to_string()), ) - .arg("test"); + .arg("test") + .arg("--offline"); if let Some(package) = config.package { cmd.arg("-p").arg(package); } diff --git a/test-integration/test-tools/src/validator.rs b/test-integration/test-tools/src/validator.rs index 6b9080a22..1608c9adb 100644 --- a/test-integration/test-tools/src/validator.rs +++ b/test-integration/test-tools/src/validator.rs @@ -32,26 +32,35 @@ pub fn start_magic_block_validator_with_config( } = test_runner_paths; let port = rpc_port_from_config(config_path); - - // First build so that the validator can start fast - let mut command = process::Command::new("cargo"); let keypair_base58 = loaded_chain_accounts.validator_authority_base58(); - command.arg("build"); - let build_res = command.current_dir(root_dir.clone()).output(); - if build_res.is_ok_and(|output| !output.status.success()) { - eprintln!("Failed to build validator"); - return None; - } + // Check if we should use a prebuilt binary (faster in CI) + let workspace_dir = resolve_workspace_dir(); + let target_dir = std::env::var("CARGO_TARGET_DIR") + .map(PathBuf::from) + .unwrap_or_else(|_| workspace_dir.join("../target")); + + let validator_bin = target_dir.join("debug/magicblock-validator"); + + let mut command = if validator_bin.exists() { + eprintln!("Using prebuilt validator binary: {:?}", validator_bin); + let mut cmd = process::Command::new(validator_bin); + cmd.arg(config_path); + cmd + } else { + eprintln!("Prebuilt validator not found at {:?}, falling back to cargo run", validator_bin); + // Fallback for local development + let mut cmd = process::Command::new("cargo"); + cmd.arg("run") + .arg("--") + .arg(config_path); + cmd + }; - // Start validator via `cargo run -- ` - let mut command = process::Command::new("cargo"); - command.arg("run"); let rust_log_style = std::env::var("RUST_LOG_STYLE").unwrap_or(log_suffix.to_string()); + command - .arg("--") - .arg(config_path) .env("RUST_LOG_STYLE", rust_log_style) .env("MBV_VALIDATOR__KEYPAIR", keypair_base58.clone()) .current_dir(root_dir); From ffd430d87c62aa948539f4b9735e13499c8299e4 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 22 Jan 2026 16:36:09 +0100 Subject: [PATCH 45/58] improve --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21e30b941..7fe151cf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,10 +68,6 @@ jobs: # 2. Build binaries & test runner cargo build --bins --tests - # 2.5 Pre-build everything in test-integration workspace - echo "Pre-building test-integration workspace..." - cargo build --manifest-path test-integration/Cargo.toml --bins --tests - # 3. Fast checks (format, lint, unit tests) make ci-fmt make ci-lint From 02fa79122b8fb1279fb51ed4536d1d5e98341342 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 22 Jan 2026 17:44:18 +0100 Subject: [PATCH 46/58] improve --- .github/workflows/ci.yml | 47 +++++++------------ .../test-tools/src/toml_to_args.rs | 42 ++++++++++++++--- 2 files changed, 51 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fe151cf3..0f3095aad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,8 @@ jobs: - name: Build Everything & Pre-fetch dependencies run: | # 1. Build SBF (Solana programs) for integration tests - # Unset CARGO_TARGET_DIR for SBF builds to ensure they write to local target/deploy + # Unset CARGO_TARGET_DIR for SBF builds to ensure they write to local test-integration/target/deploy + # This prevents conflicts with the global shared target directory ( unset CARGO_TARGET_DIR echo "Building SBF programs with local target dir..." @@ -56,15 +57,6 @@ jobs: make chainlink-prep-programs -C test-integration/test-chainlink ) - echo "Verifying SBF build output:" - ls -R test-integration/target/deploy || echo "Deploy dir missing!" - - # Force rebuild of test-runner to include our debug prints - echo "Forcing rebuild of test-runner..." - touch test-integration/test-runner/bin/run_tests.rs - # Also touch the library it depends on just in case - touch test-integration/test-tools/src/lib.rs - # 2. Build binaries & test runner cargo build --bins --tests @@ -87,8 +79,7 @@ jobs: # Use recursive copy to capture subdirectories (e.g., miniv2/) if [ -d "test-integration/target/deploy" ]; then cp -r test-integration/target/deploy/* "$SBF_CACHE_DIR/test-integration/" - echo "Copied test-integration SBFs to cache:" - ls -R "$SBF_CACHE_DIR/test-integration/" + echo "Copied test-integration SBFs to cache" else echo "WARNING: test-integration/target/deploy not found" fi @@ -96,8 +87,7 @@ jobs: # Committor program built under root target/deploy (ROOT_DEPLOY_DIR = ../target/deploy) if ls target/deploy/*.so >/dev/null 2>&1; then cp target/deploy/*.so "$SBF_CACHE_DIR/root/" - echo "Copied root SBFs to cache:" - ls -1 "$SBF_CACHE_DIR/root/" + echo "Copied root SBFs to cache" else echo "WARNING: no SBFs found in target/deploy" fi @@ -109,12 +99,14 @@ jobs: strategy: fail-fast: false matrix: - # Batch tests to reduce concurrent load (3 runners instead of 8) - # Each string contains space-separated tests to run sequentially - batch_tests: - - "schedulecommit chainlink cloning" - - "restore_ledger table_mania committor" - - "pubsub task-scheduler" + # Optimized grouping for ~35-40 mins per runner on a 40-core machine. + # Total sequential time: ~173 mins. Parallel target: ~37 mins. + batch_tests: + - "committor config" # 22 + 15 = 37 min + - "restore_ledger schedulecommit" # 18 + 17 = 35 min + - "table_mania cloning" # 18 + 17 = 35 min + - "magicblock_api schedule_intents" # 16 + 16 = 32 min + - "task-scheduler chainlink pubsub" # 15 + 11 + 8 = 34 min env: # Use RAM disk for temporary files (Ledger, RocksDB) to save Disk I/O TMPDIR: "/dev/shm" @@ -124,8 +116,9 @@ jobs: RUSTC_WRAPPER: "" # Clear potentially problematic flags RUSTFLAGS: "" - # Limit concurrency per runner to avoid oversubscribing the shared host - CARGO_BUILD_JOBS: 4 + # Limit concurrency per runner (40 cores / 5 runners = ~8 cores available per runner) + # Leaving some headroom for OS and other jobs. + CARGO_BUILD_JOBS: 6 NEXTEST_RETRIES: 0 steps: - uses: actions/checkout@v5 @@ -183,19 +176,11 @@ jobs: if ls "$SBF_CACHE_DIR/root"/*.so >/dev/null 2>&1; then cp "$SBF_CACHE_DIR/root"/*.so "$LOCAL_DEPLOY_ROOT/" touch "$LOCAL_DEPLOY_ROOT"/*.so - echo "Restored root SBFs:" - ls -1 "$LOCAL_DEPLOY_ROOT/" + echo "Restored root SBFs" else echo "WARNING: no cached SBFs found for root" fi - - name: Debug - List Critical Directories - run: | - echo "Listing test-integration/target/deploy:" - ls -R test-integration/target/deploy || echo "Directory not found" - echo "Listing test-integration/schedulecommit/elfs:" - ls -R test-integration/schedulecommit/elfs || echo "Directory not found" - - name: Run ${{ matrix.batch_tests }} (Network Namespace) run: | # 'unshare -r -n' creates an isolated network namespace. diff --git a/test-integration/test-tools/src/toml_to_args.rs b/test-integration/test-tools/src/toml_to_args.rs index 35fd06981..6cc9a4b33 100644 --- a/test-integration/test-tools/src/toml_to_args.rs +++ b/test-integration/test-tools/src/toml_to_args.rs @@ -81,13 +81,41 @@ pub fn config_to_args( args.push(program.id); let full_path_to_resolve = config_dir.join(&program.path); - eprintln!("Resolving program path: {:?}", full_path_to_resolve); - let resolved_full_config_path = - full_path_to_resolve.canonicalize().expect(&format!( - "Failed to canonicalize program path: {:?}", - full_path_to_resolve - )); - args.push(resolved_full_config_path.to_str().unwrap().to_string()); + match fs::canonicalize(&full_path_to_resolve) { + Ok(path) => { + args.push(path.to_str().unwrap().to_string()); + } + Err(e) => { + let abs_config_dir = fs::canonicalize(config_dir).unwrap_or(config_dir.to_path_buf()); + eprintln!( + "Error: Failed to resolve program path.\n\ + Config File: {:?}\n\ + Relative Path: {:?}\n\ + Resolution Attempt: {:?}\n\ + OS Error: {:?}", + abs_config_dir, + program.path, + full_path_to_resolve, + e + ); + + // List directory contents to aid debugging in CI environments + if let Some(parent) = full_path_to_resolve.parent() { + eprintln!("Directory contents of {:?}:", parent); + if let Ok(entries) = fs::read_dir(parent) { + for entry in entries { + if let Ok(entry) = entry { + eprintln!(" - {:?}", entry.file_name()); + } + } + } else { + eprintln!(" (Unable to read directory)"); + } + } + + panic!("Program file not found: {:?}", full_path_to_resolve); + } + } if program_loader == ProgramLoader::UpgradeableProgram { if let Some(auth) = program.auth { From 56edf7eb7fc9fd8b83a0f4e12ec2845a80918401 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Tue, 17 Feb 2026 11:13:17 +0100 Subject: [PATCH 47/58] code clean up --- .github/workflows/ci.yml | 185 ++++++++++++++------------------------- 1 file changed, 67 insertions(+), 118 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f3095aad..89c54ac8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ name: CI concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} cancel-in-progress: true on: @@ -11,7 +11,6 @@ on: types: [opened, reopened, synchronize, ready_for_review] jobs: - # 1. Compute shared global target directory (per branch) prepare-env: runs-on: self-hosted outputs: @@ -19,105 +18,78 @@ jobs: steps: - id: calc run: | - # Replace slashes in branch name to make it filesystem-safe SAFE_BRANCH=$(echo "${{ github.ref_name }}" | tr '/' '-') - # Define the global shared target directory for this repo + branch TARGET_DIR="/var/lib/gh-runners/global-targets/${{ github.event.repository.name }}-${SAFE_BRANCH}" mkdir -p "$TARGET_DIR" echo "dir=$TARGET_DIR" >> $GITHUB_OUTPUT - # 2. MONOLITHIC BUILD PHASE (with Internet) - build-everything: + build: needs: prepare-env runs-on: self-hosted env: - # Override runner defaults CARGO_TARGET_DIR: ${{ needs.prepare-env.outputs.target_dir }} - # Disable sccache to favor local incremental builds on disk - RUSTC_WRAPPER: "" - RUSTFLAGS: "" - # Enable incremental builds for faster small changes CARGO_INCREMENTAL: 1 - # Use many cores because this job runs alone on the runner CARGO_BUILD_JOBS: 30 steps: - uses: actions/checkout@v5 with: submodules: recursive - - name: Build Everything & Pre-fetch dependencies + - name: Build SBF programs run: | - # 1. Build SBF (Solana programs) for integration tests - # Unset CARGO_TARGET_DIR for SBF builds to ensure they write to local test-integration/target/deploy - # This prevents conflicts with the global shared target directory ( unset CARGO_TARGET_DIR - echo "Building SBF programs with local target dir..." make -C test-integration programs make chainlink-prep-programs -C test-integration/test-chainlink ) - - # 2. Build binaries & test runner - cargo build --bins --tests - - # 3. Fast checks (format, lint, unit tests) - make ci-fmt - make ci-lint - make ci-test-unit - - # 4. PRE-FETCH for integration tests - # Download and compile test dependencies, but do NOT run tests. - cargo test --test '*' --no-run - - # 5. SAVE SBF ARTIFACTS INTO THE GLOBAL TARGET - # This allows matrix jobs to reuse the same .so files without rebuilding. + + - name: Build binaries and tests + run: cargo build --bins --tests + + - name: Format check + run: make ci-fmt + + - name: Lint + run: make ci-lint + + - name: Unit tests + run: make ci-test-unit + + - name: Pre-fetch integration test dependencies + run: cargo test --test '*' --no-run + + - name: Cache SBF artifacts + run: | SBF_CACHE_DIR="$CARGO_TARGET_DIR/sbf-artifacts" - echo "Saving SBF artifacts into $SBF_CACHE_DIR ..." mkdir -p "$SBF_CACHE_DIR/test-integration" "$SBF_CACHE_DIR/root" - # SBF programs built under test-integration (DEPLOY_DIR) - # Use recursive copy to capture subdirectories (e.g., miniv2/) if [ -d "test-integration/target/deploy" ]; then cp -r test-integration/target/deploy/* "$SBF_CACHE_DIR/test-integration/" - echo "Copied test-integration SBFs to cache" else - echo "WARNING: test-integration/target/deploy not found" + echo "::warning::test-integration/target/deploy not found" fi - # Committor program built under root target/deploy (ROOT_DEPLOY_DIR = ../target/deploy) if ls target/deploy/*.so >/dev/null 2>&1; then cp target/deploy/*.so "$SBF_CACHE_DIR/root/" - echo "Copied root SBFs to cache" else - echo "WARNING: no SBFs found in target/deploy" + echo "::warning::No SBF artifacts found in target/deploy" fi - # 3. PARALLEL INTEGRATION TEST PHASE (isolated network - no Internet) - integration-matrix: - needs: [prepare-env, build-everything] + integration-tests: + needs: [prepare-env, build] runs-on: self-hosted strategy: fail-fast: false matrix: - # Optimized grouping for ~35-40 mins per runner on a 40-core machine. - # Total sequential time: ~173 mins. Parallel target: ~37 mins. - batch_tests: - - "committor config" # 22 + 15 = 37 min - - "restore_ledger schedulecommit" # 18 + 17 = 35 min - - "table_mania cloning" # 18 + 17 = 35 min - - "magicblock_api schedule_intents" # 16 + 16 = 32 min - - "task-scheduler chainlink pubsub" # 15 + 11 + 8 = 34 min + batch: + - "committor config" + - "restore_ledger schedulecommit" + - "table_mania cloning" + - "magicblock_api schedule_intents" + - "task-scheduler chainlink pubsub" env: - # Use RAM disk for temporary files (Ledger, RocksDB) to save Disk I/O - TMPDIR: "/dev/shm" - # Force Cargo not to hit the network (we are inside a network namespace) + TMPDIR: /dev/shm CARGO_NET_OFFLINE: "true" - # Disable any wrappers that might interfere during test execution - RUSTC_WRAPPER: "" - # Clear potentially problematic flags - RUSTFLAGS: "" - # Limit concurrency per runner (40 cores / 5 runners = ~8 cores available per runner) - # Leaving some headroom for OS and other jobs. CARGO_BUILD_JOBS: 6 NEXTEST_RETRIES: 0 steps: @@ -125,93 +97,70 @@ jobs: with: submodules: recursive - - name: Restore timestamps to satisfy Cargo cache - run: | - echo "Syncing file timestamps to commit time..." - # Get the commit timestamp of HEAD - COMMIT_TIME=$(git show -s --format=%ci HEAD) - # Apply that timestamp to all files (excluding .git for speed) - find . -type f -not -path "./.git/*" -exec touch -d "$COMMIT_TIME" {} + - echo "Timestamps synced to $COMMIT_TIME" - - - name: Copy Pre-built Artifacts to Local Target (Hardlinks) + - name: Restore source file timestamps + run: git restore-mtime + + - name: Link pre-built artifacts run: | GLOBAL_TARGET="${{ needs.prepare-env.outputs.target_dir }}" - echo "Linking artifacts from $GLOBAL_TARGET to ./target ..." mkdir -p target - - # 1. Use hardlinks (-l) to avoid duplicating data (instant + 0 disk usage) - # 2. Only link 'debug' directory (contains test binaries) - # Note: This assumes runners are on the same filesystem as GLOBAL_TARGET - cp -rl "$GLOBAL_TARGET/debug" target/ - - # 3. Remove 'incremental' compilation data (huge & useless for running tests) + + if ! cp -rl "$GLOBAL_TARGET/debug" target/ 2>/dev/null; then + echo "::warning::Hardlink failed (cross-device?), falling back to copy" + cp -r "$GLOBAL_TARGET/debug" target/ + fi + rm -rf target/debug/incremental - - echo "Artifacts linked successfully." - - name: Restore prebuilt SBF programs from Global Target + - name: Restore SBF artifacts run: | - GLOBAL_TARGET_DIR="${{ needs.prepare-env.outputs.target_dir }}" - SBF_CACHE_DIR="$GLOBAL_TARGET_DIR/sbf-artifacts" - echo "Restoring SBF artifacts from $SBF_CACHE_DIR ..." + SBF_CACHE_DIR="${{ needs.prepare-env.outputs.target_dir }}/sbf-artifacts" - # 1) Restore SBFs for test-integration (DEPLOY_DIR) LOCAL_DEPLOY_TEST="test-integration/target/deploy" mkdir -p "$LOCAL_DEPLOY_TEST" if [ -d "$SBF_CACHE_DIR/test-integration" ]; then cp -r "$SBF_CACHE_DIR/test-integration"/* "$LOCAL_DEPLOY_TEST/" - # Touch to ensure the .so files are newer than sources (so Make will not rebuild them) - # Find all files (including those in subdirs) and touch them find "$LOCAL_DEPLOY_TEST" -type f -exec touch {} + - echo "Restored test-integration SBFs:" - ls -R "$LOCAL_DEPLOY_TEST/" else - echo "WARNING: no cached SBFs found for test-integration" + echo "::warning::No cached SBF artifacts for test-integration" fi - # 2) Restore SBFs for root target (committor program, ROOT_DEPLOY_DIR) LOCAL_DEPLOY_ROOT="target/deploy" mkdir -p "$LOCAL_DEPLOY_ROOT" if ls "$SBF_CACHE_DIR/root"/*.so >/dev/null 2>&1; then cp "$SBF_CACHE_DIR/root"/*.so "$LOCAL_DEPLOY_ROOT/" touch "$LOCAL_DEPLOY_ROOT"/*.so - echo "Restored root SBFs" else - echo "WARNING: no cached SBFs found for root" + echo "::warning::No cached SBF artifacts for root" fi - - name: Run ${{ matrix.batch_tests }} (Network Namespace) + - name: "Integration: ${{ matrix.batch }}" run: | - # 'unshare -r -n' creates an isolated network namespace. - # Inside this bubble, port 8899 is free for all parallel jobs. - # We loop through the batch list and run tests sequentially in this runner. - # We pass PROGRAMS_SO="" to empty the dependency list for 'make test' - # We pass SKIP_CHAINLINK_PREP=1 to skip the chainlink prep step - unshare -r -n sh -c " + unshare -r -n sh -c ' + set -uo pipefail ip link set lo up - for test in ${{ matrix.batch_tests }}; do - echo \"--------------------------------------------------\" - echo \"Running test suite: \$test\" - echo \"--------------------------------------------------\" - RUN_TESTS=\$test make ci-test-integration PROGRAMS_SO= SKIP_CHAINLINK_PREP=1 + FAILED="" + for test in ${{ matrix.batch }}; do + echo "========== Running: $test ==========" + if ! RUN_TESTS=$test make ci-test-integration PROGRAMS_SO= SKIP_CHAINLINK_PREP=1; then + FAILED="$FAILED $test" + fi done - " - env: - # Not used directly in the loop, but kept for context if needed - BATCH_LIST: ${{ matrix.batch_tests }} + if [ -n "$FAILED" ]; then + echo "::error::Failed test suites:$FAILED" + exit 1 + fi + ' - # 4. Aggregate status for CI (single green/red check) ci-status: if: always() - needs: [build-everything, integration-matrix] - runs-on: ubuntu-latest + needs: [build, integration-tests] + runs-on: self-hosted steps: - - name: Check Status + - name: Verify pipeline status run: | - if [[ "${{ needs.build-everything.result }}" != "success" || - "${{ needs.integration-matrix.result }}" != "success" ]]; then - echo "CI Failed" + if [[ "${{ needs.build.result }}" != "success" || + "${{ needs.integration-tests.result }}" != "success" ]]; then + echo "::error::CI failed" exit 1 - fi - echo "CI Passed" + fi \ No newline at end of file From 25d02218a42e7884c0b7e51271820645e04f70bd Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Tue, 17 Feb 2026 11:25:11 +0100 Subject: [PATCH 48/58] fix bug with mold linker --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89c54ac8b..4cd6d6726 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,12 +30,15 @@ jobs: CARGO_TARGET_DIR: ${{ needs.prepare-env.outputs.target_dir }} CARGO_INCREMENTAL: 1 CARGO_BUILD_JOBS: 30 + RUSTFLAGS: -C link-arg=-fuse-ld=mold steps: - uses: actions/checkout@v5 with: submodules: recursive - name: Build SBF programs + env: + RUSTFLAGS: "" run: | ( unset CARGO_TARGET_DIR @@ -163,4 +166,4 @@ jobs: "${{ needs.integration-tests.result }}" != "success" ]]; then echo "::error::CI failed" exit 1 - fi \ No newline at end of file + fi From cb0dc52fe36f4de25c53539293a2199709d7a315 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Tue, 17 Feb 2026 11:35:14 +0100 Subject: [PATCH 49/58] fix bug --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4cd6d6726..b154f207f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,7 +139,7 @@ jobs: - name: "Integration: ${{ matrix.batch }}" run: | - unshare -r -n sh -c ' + unshare -r -n bash -c ' set -uo pipefail ip link set lo up FAILED="" From 90d384780361721833a21ba823292d120cdd8666 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 18 Feb 2026 09:58:34 +0100 Subject: [PATCH 50/58] fix remotes --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b154f207f..476159ca8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,6 +142,8 @@ jobs: unshare -r -n bash -c ' set -uo pipefail ip link set lo up + export MBV_REMOTES__0="http://127.0.0.1:7799" + export MBV_REMOTES__1="ws://127.0.0.1:7800" FAILED="" for test in ${{ matrix.batch }}; do echo "========== Running: $test ==========" From 71038f6b39fe50f584f91847e3524867b3e2429d Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 18 Feb 2026 10:28:27 +0100 Subject: [PATCH 51/58] fix lificycle in test --- .github/workflows/ci.yml | 2 -- magicblock-api/src/magic_validator.rs | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 476159ca8..b154f207f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,8 +142,6 @@ jobs: unshare -r -n bash -c ' set -uo pipefail ip link set lo up - export MBV_REMOTES__0="http://127.0.0.1:7799" - export MBV_REMOTES__1="ws://127.0.0.1:7800" FAILED="" for test in ${{ matrix.batch }}; do echo "========== Running: $test ==========" diff --git a/magicblock-api/src/magic_validator.rs b/magicblock-api/src/magic_validator.rs index aca45c5eb..3bdd9f237 100644 --- a/magicblock-api/src/magic_validator.rs +++ b/magicblock-api/src/magic_validator.rs @@ -429,7 +429,7 @@ impl MagicValidator { let accounts_bank = accountsdb.clone(); let mut chainlink_config = ChainlinkConfig::default_with_lifecycle_mode( - LifecycleMode::Ephemeral, + config.lifecycle.clone(), ) .with_remove_confined_accounts( config.chainlink.remove_confined_accounts, From 04ed7eacbad153d53d891ffa86ebaf8d75b9dfe9 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 18 Feb 2026 12:52:27 +0100 Subject: [PATCH 52/58] add cargo test --manifest-path test-integration/Cargo.toml --workspace --no-run --locked --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b154f207f..e02222e03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,8 +58,8 @@ jobs: - name: Unit tests run: make ci-test-unit - - name: Pre-fetch integration test dependencies - run: cargo test --test '*' --no-run + - name: Pre-build integration test workspace + run: cargo test --manifest-path test-integration/Cargo.toml --workspace --no-run --locked - name: Cache SBF artifacts run: | From a095d8359a1cd7c38d7d0a5e44843f5c7e83bc86 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 18 Feb 2026 14:07:39 +0100 Subject: [PATCH 53/58] reverted cargo build workspace --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e02222e03..b154f207f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,8 +58,8 @@ jobs: - name: Unit tests run: make ci-test-unit - - name: Pre-build integration test workspace - run: cargo test --manifest-path test-integration/Cargo.toml --workspace --no-run --locked + - name: Pre-fetch integration test dependencies + run: cargo test --test '*' --no-run - name: Cache SBF artifacts run: | From bf9032ee8eb4b38cfbe24a4afd37bc5f99f23294 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 18 Feb 2026 16:01:32 +0100 Subject: [PATCH 54/58] update ci trigger --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b154f207f..d2fa18e9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ concurrency: on: push: - branches: [master, dev, chore/improve-ci] + branches: [master, dev] pull_request: types: [opened, reopened, synchronize, ready_for_review] From 0e3ef7e69f7bc146ac919421dcb5f824dba133b6 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 19 Feb 2026 11:43:41 +0100 Subject: [PATCH 55/58] address code rabbit comments --- .github/workflows/ci.yml | 21 ++++++++++++------- test-integration/test-runner/bin/run_tests.rs | 6 ++++-- .../test-tools/src/toml_to_args.rs | 2 +- test-integration/test-tools/src/validator.rs | 2 ++ 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2fa18e9a..419eee8d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ concurrency: on: push: - branches: [master, dev] + branches: [master, dev, chore/improve-ci] pull_request: types: [opened, reopened, synchronize, ready_for_review] @@ -17,9 +17,12 @@ jobs: target_dir: ${{ steps.calc.outputs.dir }} steps: - id: calc + env: + REF_NAME: ${{ github.ref_name }} + REPO_NAME: ${{ github.event.repository.name }} run: | - SAFE_BRANCH=$(echo "${{ github.ref_name }}" | tr '/' '-') - TARGET_DIR="/var/lib/gh-runners/global-targets/${{ github.event.repository.name }}-${SAFE_BRANCH}" + SAFE_BRANCH=$(echo "$REF_NAME" | tr '/' '-') + TARGET_DIR="/var/lib/gh-runners/global-targets/${REPO_NAME}-${SAFE_BRANCH}" mkdir -p "$TARGET_DIR" echo "dir=$TARGET_DIR" >> $GITHUB_OUTPUT @@ -47,7 +50,7 @@ jobs: ) - name: Build binaries and tests - run: cargo build --bins --tests + run: cargo build --bins --tests --locked - name: Format check run: make ci-fmt @@ -67,7 +70,7 @@ jobs: mkdir -p "$SBF_CACHE_DIR/test-integration" "$SBF_CACHE_DIR/root" if [ -d "test-integration/target/deploy" ]; then - cp -r test-integration/target/deploy/* "$SBF_CACHE_DIR/test-integration/" + find test-integration/target/deploy -mindepth 1 -maxdepth 1 -exec cp -r {} "$SBF_CACHE_DIR/test-integration/" \; else echo "::warning::test-integration/target/deploy not found" fi @@ -122,7 +125,7 @@ jobs: LOCAL_DEPLOY_TEST="test-integration/target/deploy" mkdir -p "$LOCAL_DEPLOY_TEST" if [ -d "$SBF_CACHE_DIR/test-integration" ]; then - cp -r "$SBF_CACHE_DIR/test-integration"/* "$LOCAL_DEPLOY_TEST/" + find "$SBF_CACHE_DIR/test-integration" -mindepth 1 -maxdepth 1 -exec cp -r {} "$LOCAL_DEPLOY_TEST/" \; find "$LOCAL_DEPLOY_TEST" -type f -exec touch {} + else echo "::warning::No cached SBF artifacts for test-integration" @@ -138,12 +141,14 @@ jobs: fi - name: "Integration: ${{ matrix.batch }}" + env: + TEST_BATCH: ${{ matrix.batch }} run: | unshare -r -n bash -c ' - set -uo pipefail + set -euo pipefail ip link set lo up FAILED="" - for test in ${{ matrix.batch }}; do + for test in $TEST_BATCH; do echo "========== Running: $test ==========" if ! RUN_TESTS=$test make ci-test-integration PROGRAMS_SO= SKIP_CHAINLINK_PREP=1; then FAILED="$FAILED $test" diff --git a/test-integration/test-runner/bin/run_tests.rs b/test-integration/test-runner/bin/run_tests.rs index 7a816d0ec..8d117337c 100644 --- a/test-integration/test-runner/bin/run_tests.rs +++ b/test-integration/test-runner/bin/run_tests.rs @@ -783,8 +783,10 @@ fn run_test( "RUST_LOG", std::env::var("RUST_LOG").unwrap_or_else(|_| "info".to_string()), ) - .arg("test") - .arg("--offline"); + .arg("test"); + if std::env::var("CARGO_NET_OFFLINE").as_deref() == Ok("true") { + cmd.arg("--offline"); + } if let Some(package) = config.package { cmd.arg("-p").arg(package); } diff --git a/test-integration/test-tools/src/toml_to_args.rs b/test-integration/test-tools/src/toml_to_args.rs index 6cc9a4b33..8bb81cb9d 100644 --- a/test-integration/test-tools/src/toml_to_args.rs +++ b/test-integration/test-tools/src/toml_to_args.rs @@ -89,7 +89,7 @@ pub fn config_to_args( let abs_config_dir = fs::canonicalize(config_dir).unwrap_or(config_dir.to_path_buf()); eprintln!( "Error: Failed to resolve program path.\n\ - Config File: {:?}\n\ + Config Dir: {:?}\n\ Relative Path: {:?}\n\ Resolution Attempt: {:?}\n\ OS Error: {:?}", diff --git a/test-integration/test-tools/src/validator.rs b/test-integration/test-tools/src/validator.rs index 1608c9adb..c70eff3e3 100644 --- a/test-integration/test-tools/src/validator.rs +++ b/test-integration/test-tools/src/validator.rs @@ -52,6 +52,8 @@ pub fn start_magic_block_validator_with_config( // Fallback for local development let mut cmd = process::Command::new("cargo"); cmd.arg("run") + .arg("-p") + .arg("magicblock-validator") .arg("--") .arg(config_path); cmd From c283b9f6d86813b1bb6d5c12c5bf8685cd19fc15 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 19 Feb 2026 14:25:44 +0100 Subject: [PATCH 56/58] updated trigger --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 419eee8d9..eb40dfe70 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ concurrency: on: push: - branches: [master, dev, chore/improve-ci] + branches: [master, dev] pull_request: types: [opened, reopened, synchronize, ready_for_review] From d8e33e187f419b927eac7dd9043d0bc26bb30020 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Thu, 19 Feb 2026 16:14:23 +0100 Subject: [PATCH 57/58] removed ready_for_reviews trigger --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb40dfe70..8b2e94fb8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: push: branches: [master, dev] pull_request: - types: [opened, reopened, synchronize, ready_for_review] + types: [opened, reopened, synchronize] jobs: prepare-env: From b326a8f2cf08b8d51e5d89c46e7ef92c58ff4716 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Fri, 20 Feb 2026 12:15:50 +0100 Subject: [PATCH 58/58] remove ignore flag from ledger flaky test --- magicblock-ledger/tests/test_ledger_truncator.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/magicblock-ledger/tests/test_ledger_truncator.rs b/magicblock-ledger/tests/test_ledger_truncator.rs index 766be87ee..6801ae086 100644 --- a/magicblock-ledger/tests/test_ledger_truncator.rs +++ b/magicblock-ledger/tests/test_ledger_truncator.rs @@ -77,7 +77,6 @@ async fn test_truncator_not_purged_size() { } // Tests that ledger got truncated but not after finality slot -#[ignore = "Flaky test"] #[tokio::test] async fn test_truncator_non_empty_ledger() { init_logger!();