ci: add job to check the bindings are up to date #25
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Bindings | |
on: | |
push: | |
branches: | |
- dev | |
pull_request: | |
merge_group: | |
permissions: | |
contents: read | |
jobs: | |
generate_bindings: | |
name: Generate bindings | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install go1.21 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
- name: Add Ethereum PPA | |
run: sudo add-apt-repository -y ppa:ethereum/ethereum | |
- name: Install Abigen | |
run: sudo apt-get update && sudo apt-get install ethereum | |
- name: Show abigen version | |
run: abigen --version | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: v0.3.0 | |
- name: Run make bindings | |
run: make bindings | |
check_bindings: | |
name: Check bindings are up-to-date | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# This step is needed to know if the contracts were changed. | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
contracts: | |
- 'contracts/lib/**' | |
- 'contracts/script/**' | |
- 'contracts/src/**' | |
# This step runs only if some contract changed. | |
# It checks the diff in the bindings directory. | |
# If the diff is null, that means the bindings have not changed, | |
# i.e. the bindings are outdated and therefore this step will fail. | |
# Note: if the git diff fails to fetch the changes, then the step will also fail. | |
- name: Check the anvil dump has changed | |
if: steps.filter.outputs.contracts == 'true' | |
working-directory: contracts/ | |
run: | | |
if [ -z "$(git diff origin/${{ github.event.pull_request.base.ref }} -- bindings)" ]; then | |
echo "The bindings are outdated"; | |
exit 1 | |
fi |