Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add workflow for checking storage #92

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/storage-checker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Check Storage Layout
on:
pull_request:
branches:
- master
jobs:
check_storage:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: "Generate and prepare the contract artifacts"
run: |
cd contracts && mkdir pr
for file in $(find src -name '*.sol'); do
contract_name=$(basename "$file" .sol)
forge inspect "$contract_name" storage --pretty > pr/"$contract_name".md
done

- name: Checkout Base Branch
env:
BASE: ${{ github.event.pull_request.base.sha }}
run: |
git fetch origin $BASE
git checkout $BASE

- name: "Generate and prepare the contract artifacts"
run: |
cd contracts && mkdir base
for file in $(find src -name '*.sol'); do
contract_name=$(basename "$file" .sol)
forge inspect "$contract_name" storage --pretty > base/"$contract_name".md
done
- name: Compare outputs
run: |
if ! diff --unified contracts/pr contracts/base; then
# Note: We are only creating a warning because storage changes might be intentional but should be looked into
# reach out to steven if you see a warning on this workflow and need help validating if it is expected or not
echo "::warning::Differences found between PR and base storage layouts"
fi
Loading