From 9f1467be4a4f9d87aca93858504b5cfd6c371950 Mon Sep 17 00:00:00 2001 From: Leopold Joy Date: Wed, 29 Jul 2026 20:48:15 +0100 Subject: [PATCH] ci: validate common scripts --- .github/workflows/validate-common-script.yml | 66 +++++++++++++ .github/workflows/validate-templates.yml | 97 -------------------- 2 files changed, 66 insertions(+), 97 deletions(-) create mode 100644 .github/workflows/validate-common-script.yml delete mode 100644 .github/workflows/validate-templates.yml diff --git a/.github/workflows/validate-common-script.yml b/.github/workflows/validate-common-script.yml new file mode 100644 index 000000000..12eaec2aa --- /dev/null +++ b/.github/workflows/validate-common-script.yml @@ -0,0 +1,66 @@ +name: Validate Common Scripts + +on: + pull_request: + push: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + # base-contracts v8.2.1 — the version the active/evm shared Foundry project + # (active/evm/foundry.toml) and script/common/ are written against. Bump this + # together with the task .env pins when moving to a newer base-contracts. + BASE_CONTRACTS_COMMIT: f3a33c8577c8ca1e037b45e822bfcb75f099270b + +jobs: + validate-common: + name: active/evm script/common + runs-on: ubuntu-latest + + steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + + # ── Toolchain (mise) ───────────────────────────────────────────── + # Installs all tools pinned in mise.toml (foundry, node, bun, go) so + # CI runs match local signer environments byte-for-byte. + - name: Install mise-managed toolchain + uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1 + with: + experimental: true + + # ── Dependencies ───────────────────────────────────────────────── + # Install Foundry deps into the shared active/evm project. PROJECT_DIR + # points forge install at active/evm; BASE_CONTRACTS_COMMIT is supplied + # via env since the shared project has no task .env of its own. + - name: Install dependencies + run: make deps PROJECT_DIR="$PWD/active/evm" + + # ── Validation ─────────────────────────────────────────────────── + - name: Check Solidity formatting + working-directory: active/evm + run: | + echo "==> forge fmt --check script/" + if ! forge fmt --check script/; then + echo "" + echo "::error::Formatting check failed. Run 'forge fmt script/' in active/evm to fix." + exit 1 + fi + + - name: Build (forge build) + working-directory: active/evm + run: | + echo "==> forge build" + if ! forge build; then + echo "" + echo "::error::Compilation failed. Check imports, types, and dependency versions." + exit 1 + fi diff --git a/.github/workflows/validate-templates.yml b/.github/workflows/validate-templates.yml deleted file mode 100644 index c7ba9931b..000000000 --- a/.github/workflows/validate-templates.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Validate Templates - -on: - pull_request: - push: - branches: [main] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - validate-template: - name: ${{ matrix.template }} - runs-on: ubuntu-latest - strategy: - matrix: - include: - - template: template-funding - setup_target: "setup-funding" - setup_args: "network=sepolia" - task_dir_suffix: funding - - template: template-gas-increase - setup_target: "setup-gas-increase" - setup_args: "network=sepolia" - task_dir_suffix: increase-gas-limit - - template: template-gas-and-elasticity-increase - setup_target: "setup-gas-and-elasticity-increase" - setup_args: "network=sepolia" - task_dir_suffix: increase-gas-and-elasticity-limit - - template: template-safe-management - setup_target: "setup-safe-management" - setup_args: "network=sepolia" - task_dir_suffix: safe-management - - template: template-pause-bridge-base - setup_target: "setup-bridge-pause" - setup_args: "network=sepolia" - task_dir_suffix: pause-bridge-base - - template: template-pause-superchain-config - setup_target: "setup-superchain-config-pause" - setup_args: "network=sepolia" - task_dir_suffix: pause-superchain-config - - template: template-set-bridge-partner-threshold - setup_target: "setup-bridge-partner-threshold" - setup_args: "network=sepolia" - task_dir_suffix: pause-bridge-base - fail-fast: false - - steps: - - name: Harden the runner (Audit all outbound calls) - uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0 - with: - egress-policy: audit - - - name: Checkout repository - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - - # ── Toolchain (mise) ───────────────────────────────────────────── - # Installs all tools pinned in mise.toml (foundry, node, bun, go) so - # CI runs match local signer environments byte-for-byte. - - name: Install mise-managed toolchain - uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1 - with: - experimental: true - - # ── Setup & Dependencies ──────────────────────────────────────── - - name: Create sample task from template - id: setup - run: | - make ${{ matrix.setup_target }} ${{ matrix.setup_args }} - TASK_DIR="sepolia/$(date +'%Y-%m-%d')-${{ matrix.task_dir_suffix }}" - echo "task_dir=$TASK_DIR" >> "$GITHUB_OUTPUT" - - - name: Install dependencies - working-directory: ${{ steps.setup.outputs.task_dir }} - run: make deps - - # ── Validation ─────────────────────────────────────────────────── - - name: Check Solidity formatting - working-directory: ${{ steps.setup.outputs.task_dir }} - run: | - echo "==> forge fmt --check script/ (${{ matrix.template }})" - if ! forge fmt --check script/; then - echo "" - echo "::error::Formatting check failed for ${{ matrix.template }}. Run 'forge fmt script/' in the template directory to fix." - exit 1 - fi - - - name: Build (forge build) - working-directory: ${{ steps.setup.outputs.task_dir }} - run: | - echo "==> forge build (${{ matrix.template }})" - if ! forge build; then - echo "" - echo "::error::Compilation failed for ${{ matrix.template }}. Check imports, types, and dependency versions." - exit 1 - fi