ci: Add Foundry tooling integration test (#511)

## Description

Adds a CI workflow that builds and tests a small Foundry project with
`foundry-polkadot`'s `forge`, exercising the standard JSON interface
between `resolc` and `foundry-polkadot` end-to-end.

## Resolved Issues

Closes #513
This commit is contained in:
LJ authored and GitHub committed 2026-06-24 10:38:07 +02:00
1 parent fb0e9e6a30
commit 3d70def08c
10 files changed
+239 -12

No files matched your search

+75
View File
@@ -0,0 +1,75 @@
# Tests compilation and E2E integration with foundry-polkadot, including basic
# runtime behavior, but not differential runtime correctness.
name: Foundry Integration
on:
workflow_call:
env:
CARGO_TERM_COLOR: always
# Workflow-internal foundry envs are prefixed with `CI_` to not conflict with the
# `FOUNDRY_*` namespace, which foundry itself will interpret for its configuration.
CI_FOUNDRY_PROJECT_ROOT: tooling-projects/foundry/erc20
CI_FOUNDRY_POLKADOT_VERSION: v1.5.1
# Coincides with the forge-std revision pinned in foundry-polkadot/testdata/forge-std-rev.
FORGE_STD_VERSION: v1.16.1
OZ_CONTRACTS_VERSION: v5.3.0
jobs:
build:
uses: ./.github/workflows/reusable-build-linux.yml
with:
retention_days: 1
use-foundry:
needs: build
runs-on: ubuntu-24.04
steps:
- name: Checkout revive
uses: actions/checkout@v6
- name: Download resolc Binary
uses: actions/download-artifact@v7
with:
name: resolc-x86_64-unknown-linux-musl
path: resolc-bin
- name: Export resolc Path
run: |
chmod +x resolc-bin/resolc-x86_64-unknown-linux-musl
echo "RESOLC_PATH=$(pwd)/resolc-bin/resolc-x86_64-unknown-linux-musl" >> $GITHUB_ENV
- name: Install foundryup-polkadot and the Foundry Toolchain
run: |
# Pin install path with `FOUNDRY_DIR` to prevent the pre-existing `XDG_CONFIG_HOME` from being used.
export FOUNDRY_DIR="$HOME/.foundry"
curl -fsSL https://raw.githubusercontent.com/paritytech/foundry-polkadot/refs/heads/master/foundryup/install | bash
"$FOUNDRY_DIR/bin/foundryup-polkadot" --install "$CI_FOUNDRY_POLKADOT_VERSION"
- name: Add Foundry to PATH
run: echo "$HOME/.foundry/bin" >> "$GITHUB_PATH"
- name: Check Tool Versions
run: |
foundryup-polkadot --version
forge --version
- name: Fetch Project Dependencies
working-directory: ${{ env.CI_FOUNDRY_PROJECT_ROOT }}
run: |
mkdir -p lib
git clone --depth 1 --branch "$FORGE_STD_VERSION" https://github.com/foundry-rs/forge-std.git lib/forge-std
git clone --depth 1 --branch "$OZ_CONTRACTS_VERSION" https://github.com/OpenZeppelin/openzeppelin-contracts.git lib/openzeppelin-contracts
- name: Compile Project
working-directory: ${{ env.CI_FOUNDRY_PROJECT_ROOT }}
run: forge build --use-resolc "$RESOLC_PATH" --optimize -Oz
- name: Verify Output
working-directory: ${{ env.CI_FOUNDRY_PROJECT_ROOT }}
run: bash verify-compiler-output.sh "$RESOLC_PATH"
- name: Test Project
working-directory: ${{ env.CI_FOUNDRY_PROJECT_ROOT }}
run: forge test --polkadot=pvm --use-resolc "$RESOLC_PATH" --optimize -Oz -vvvv
@@ -28,6 +28,7 @@ jobs:
# Use `reusable-build` and not `${{ github.workflow }}` here so that callers share the same concurrency group.
group: reusable-build-x86_64-unknown-linux-musl-${{ github.sha }}
cancel-in-progress: false
queue: max
steps:
- name: Checkout revive
uses: actions/checkout@v6
@@ -50,6 +50,7 @@ jobs:
# Use `reusable-build` and not `${{ github.workflow }}` here so that callers share the same concurrency group.
group: reusable-build-${{ matrix.target }}-${{ github.sha }}
cancel-in-progress: false
queue: max
steps:
- name: Checkout revive
uses: actions/checkout@v6
@@ -80,6 +81,7 @@ jobs:
# Use `reusable-build` and not `${{ github.workflow }}` here so that callers share the same concurrency group.
group: reusable-build-universal-apple-darwin-${{ github.sha }}
cancel-in-progress: false
queue: max
steps:
- name: Check Build Cache
id: cache
@@ -34,6 +34,7 @@ jobs:
# Use `reusable-build` and not `${{ github.workflow }}` here so that callers share the same concurrency group.
group: reusable-build-wasm32-unknown-emscripten-is-release-${{ inputs.is_release }}-${{ github.sha }}
cancel-in-progress: false
queue: max
steps:
- name: Checkout revive
uses: actions/checkout@v6
@@ -28,6 +28,7 @@ jobs:
# Use `reusable-build` and not `${{ github.workflow }}` here so that callers share the same concurrency group.
group: reusable-build-x86_64-pc-windows-msvc-${{ github.sha }}
cancel-in-progress: false
queue: max
steps:
- name: Enable Long Paths
run: git config --system core.longpaths true
+23 -12
View File
@@ -64,6 +64,7 @@ jobs:
outputs:
should-run-differential-tests: ${{ steps.filter.outputs.should-run-differential-tests }}
should-run-hardhat-tests: ${{ steps.filter.outputs.should-run-hardhat-tests }}
should-run-foundry-tests: ${{ steps.filter.outputs.should-run-foundry-tests }}
steps:
- name: Checkout
uses: actions/checkout@v6
@@ -95,23 +96,28 @@ jobs:
print_changed_files
common_ignored=(
'\.md$'
'^book/'
'^docs/'
'^js/'
'^package\.json$'
'^package-lock\.json$'
)
echo "should-run-differential-tests=$(has_changes_other_than \
'\.md$' \
'^book/' \
'^docs/' \
'^js/' \
'^package\.json$' \
'^package-lock\.json$' \
"${common_ignored[@]}" \
'^tooling-projects/' \
)" | tee -a "$GITHUB_OUTPUT"
echo "should-run-hardhat-tests=$(has_changes_other_than \
'\.md$' \
'^book/' \
'^docs/' \
'^js/' \
'^package\.json$' \
'^package-lock\.json$' \
"${common_ignored[@]}" \
'^tooling-projects/foundry' \
)" | tee -a "$GITHUB_OUTPUT"
echo "should-run-foundry-tests=$(has_changes_other_than \
"${common_ignored[@]}" \
'^tooling-projects/hardhat' \
)" | tee -a "$GITHUB_OUTPUT"
run-differential-tests:
@@ -123,3 +129,8 @@ jobs:
needs: [test, check-changes]
if: ${{ needs.check-changes.outputs.should-run-hardhat-tests == 'true' }}
uses: ./.github/workflows/hardhat.yml
run-foundry-tests:
needs: [test, check-changes]
if: ${{ needs.check-changes.outputs.should-run-foundry-tests == 'true' }}
uses: ./.github/workflows/foundry.yml