WIP - merging dev into main #16
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: L1 contracts foundry CI | |
env: | |
ANVIL_PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" | |
ANVIL_RPC_URL: "http://127.0.0.1:8545" | |
on: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Use Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.18.0 | |
cache: yarn | |
- name: Install dependencies | |
run: yarn | |
- name: Build artifacts | |
working-directory: ./l1-contracts-foundry | |
run: forge build | |
- name: Build system-contract artifacts | |
run: yarn sc build | |
- name: Create cache | |
uses: actions/cache/save@v3 | |
with: | |
key: artifacts-l1-contracts-foudry-${{ github.sha }} | |
path: | | |
l1-contracts-foundry/cache | |
l1-contracts-foundry/out | |
system-contracts/artifacts-zk | |
system-contracts/bootloader/build | |
system-contracts/cache-zk | |
system-contracts/contracts-preprocessed | |
system-contracts/typechain | |
scripts: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Restore artifacts cache | |
uses: actions/cache/restore@v3 | |
with: | |
fail-on-cache-miss: true | |
key: artifacts-l1-contracts-foudry-${{ github.sha }} | |
path: | | |
l1-contracts-foundry/cache | |
l1-contracts-foundry/out | |
system-contracts/artifacts-zk | |
system-contracts/bootloader/build | |
system-contracts/cache-zk | |
system-contracts/contracts-preprocessed | |
system-contracts/typechain | |
- name: Use Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
- name: Run anvil | |
run: | | |
anvil --silent & | |
ANVIL_READY=0 | |
for i in {1..10}; do | |
if curl -s -o /dev/null $ANVIL_RPC_URL -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_chainId","id":1}'; then | |
echo "Anvil is ready" | |
ANVIL_READY=1 | |
break | |
else | |
echo "Waiting for Anvil to become ready..." | |
sleep 1 | |
fi | |
done | |
if [ $ANVIL_READY -ne 1 ]; then | |
echo "Anvil failed to become ready after 10 attempts." | |
exit 1 | |
fi | |
- name: Run DeployL1 script | |
working-directory: ./l1-contracts-foundry | |
run: forge script ./script/DeployL1.s.sol --ffi --rpc-url $ANVIL_RPC_URL --broadcast --private-key $ANVIL_PRIVATE_KEY | |
- name: Run RegisterHyperchain script | |
working-directory: ./l1-contracts-foundry | |
run: forge script ./script/RegisterHyperchain.s.sol --ffi --rpc-url $ANVIL_RPC_URL --broadcast --private-key $ANVIL_PRIVATE_KEY | |
- name: Run DeployErc20 script | |
working-directory: ./l1-contracts-foundry | |
run: forge script ./script/DeployErc20.s.sol --ffi --rpc-url $ANVIL_RPC_URL --broadcast --private-key $ANVIL_PRIVATE_KEY | |
- name: Run InitializeL2WethToken script | |
working-directory: ./l1-contracts-foundry | |
run: forge script ./script/InitializeL2WethToken.s.sol --ffi --rpc-url $ANVIL_RPC_URL --broadcast --private-key $ANVIL_PRIVATE_KEY |