From d5d965039985f69561c4f02e63c9961606f6864d Mon Sep 17 00:00:00 2001 From: Andreas Bigger Date: Thu, 28 May 2026 14:03:46 -0400 Subject: [PATCH] chore(ci): add base-std fork tests --- .github/workflows/base-std-fork-tests.yml | 136 ++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 .github/workflows/base-std-fork-tests.yml diff --git a/.github/workflows/base-std-fork-tests.yml b/.github/workflows/base-std-fork-tests.yml new file mode 100644 index 00000000..c9d3c507 --- /dev/null +++ b/.github/workflows/base-std-fork-tests.yml @@ -0,0 +1,136 @@ +name: Base Std Fork Tests + +on: + pull_request: + merge_group: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +env: + BASE_REF: main + BASE_ANVIL_REF: base-anvil-fork + CARGO_TERM_COLOR: always + RUSTC_WRAPPER: "sccache" + SCCACHE_GHA_ENABLED: "true" + +permissions: + contents: read + +jobs: + fork-tests: + name: Base Std Fork Tests + runs-on: ubuntu-latest + timeout-minutes: 120 + steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 + with: + egress-policy: audit + + - name: Checkout base-std + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 1 + submodules: recursive + + - name: Free disk space + shell: bash + run: | + sudo rm -rf /usr/local/lib/android + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/share/boost + sudo rm -rf /opt/hostedtoolcache/CodeQL + df -h + + - name: Install native dependencies + uses: awalsh128/cache-apt-pkgs-action@5902b33ae29014e6ca012c5d8025d4346556bd40 # v1.4.3 + with: + packages: libsqlite3-dev clang libclang-dev llvm llvm-dev build-essential pkg-config protobuf-compiler + version: 1.4 + + - name: Install Rust + shell: bash + run: | + rustup default stable + rustup show active-toolchain + + - name: Set LIBCLANG_PATH + shell: bash + run: | + LLVM_BIN=$(command -v llvm-config || ls /usr/bin/llvm-config-* 2>/dev/null | sort -V | tail -1) + LLVM_VERSION=$($LLVM_BIN --version | cut -d. -f1) + echo "LIBCLANG_PATH=/usr/lib/llvm-${LLVM_VERSION}/lib" >> "$GITHUB_ENV" + + - name: Install mold + uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1 + + - name: Setup sccache + uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 + + - name: Rust cache + uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 + with: + cache-on-failure: true + shared-key: "base-std-fork-tests" + cache-targets: "false" + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e # v1.5.0 + with: + version: stable + + - name: Clone fork-test repositories + shell: bash + run: | + set -euo pipefail + + workdir="$RUNNER_TEMP/base-std-fork-tests" + rm -rf "$workdir" + mkdir -p "$workdir" + + git clone --depth 1 --single-branch --branch "$BASE_REF" \ + https://github.com/base/base.git "$workdir/base" + git clone --depth 1 --single-branch --branch "$BASE_ANVIL_REF" \ + https://github.com/base/base-anvil.git "$workdir/base-anvil" + + echo "BASE_DIR=$workdir/base" >> "$GITHUB_ENV" + echo "BASE_ANVIL_DIR=$workdir/base-anvil" >> "$GITHUB_ENV" + + - name: Build patched base-anvil binaries + shell: bash + env: + CARGO_PROFILE_RELEASE_LTO: "false" + run: | + set -euo pipefail + + cd "$BASE_ANVIL_DIR" + rustup show active-toolchain + cargo \ + --config "patch.\"https://github.com/base/base.git\".base-common-precompiles.path=\"$BASE_DIR/crates/common/precompiles\"" \ + --config "patch.\"https://github.com/base/base.git\".base-common-chains.path=\"$BASE_DIR/crates/common/chains\"" \ + build --release --no-default-features --features anvil/cli -p anvil -p forge + + "$BASE_ANVIL_DIR/target/release/anvil" --version + "$BASE_ANVIL_DIR/target/release/forge" --version + + - name: Run base-std fork tests + shell: bash + run: | + set -euo pipefail + + ANVIL_BIN="$BASE_ANVIL_DIR/target/release/anvil" \ + FORGE_BIN="$BASE_ANVIL_DIR/target/release/forge" \ + ANVIL_LOG="$RUNNER_TEMP/base-std-anvil.log" \ + ./script/run-fork-tests.sh + + - name: Upload anvil log + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: base-std-anvil-log + path: ${{ runner.temp }}/base-std-anvil.log + if-no-files-found: ignore