Skip to content

Commit

Permalink
ci: build before deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
fbac committed Jan 9, 2025
1 parent 3356985 commit 74d19c3
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 25 deletions.
8 changes: 4 additions & 4 deletions contracts/config/anvil_localnet/GroupMessages.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"addresses": {
"groupMessagesDeployer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"groupMessagesImpl": "0xc5a5C42992dECbae36851359345FE25997F5C42d",
"groupMessagesProxy": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933",
"groupMessagesImpl": "0x921634fd898582c7e51A2e2A5F7b93328394a408",
"groupMessagesProxy": "0x40310c9F0E822697Dd9e6F44d88528aB93b529C0",
"groupMessagesProxyAdmin": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
},
"deploymentBlock": 28,
"latestUpgradeBlock": 28
"deploymentBlock": 632,
"latestUpgradeBlock": 632
}
8 changes: 4 additions & 4 deletions contracts/config/anvil_localnet/IdentityUpdates.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"addresses": {
"identityUpdatesDeployer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"identityUpdatesImpl": "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
"identityUpdatesProxy": "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
"identityUpdatesImpl": "0xdb71d1A0CACD62e37dB898a8E5f005a02F9B885b",
"identityUpdatesProxy": "0x4507BF58E135eDD74df1A7288B3E5582185D52dA",
"identityUpdatesProxyAdmin": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
},
"deploymentBlock": 30,
"latestUpgradeBlock": 30
"deploymentBlock": 634,
"latestUpgradeBlock": 634
}
24 changes: 22 additions & 2 deletions contracts/dev/deploy-local
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,32 @@ cd "${repo_root}"
source dev/lib/env
source dev/lib/common

# Update depencencies
forge soldeer update &> /dev/null
# Ensure there are no old artifacts
forge clean

echo -e "⧖ Updating dependencies"
forge soldeer update -q
if [ $? -ne 0 ]; then
echo "ERROR: Failed to update dependencies"
exit 1
fi
echo -e "✔ Dependencies updated successfully\n"

echo -e "⧖ Building contracts"
forge build -q
if [ $? -ne 0 ]; then
echo "ERROR: Failed to build contracts"
exit 1
fi
echo -e "✔ Contracts built successfully\n"

echo -e "⧖ Running contract tests"
forge test -q
if [ $? -ne 0 ]; then
echo "ERROR: Tests failed"
exit 1
fi
echo -e "✔ Tests passed successfully\n"

forge_deploy_script group_messages
forge_deploy_script identity_updates
Expand Down
3 changes: 2 additions & 1 deletion contracts/dev/generate
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ function main() {

# Generate bindings for each contract
for contract in "${contracts[@]}"; do
echo "Processing contract: ${contract}"
echo "⧖ Generating ABIs for contract: ${contract}"
generate_bindings "${contract}"
done
echo -e "✔ ABIs generated successfully!\n"
}

main "$@"
19 changes: 8 additions & 11 deletions contracts/dev/lib/common
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,32 @@ set -euo pipefail
function forge_deploy_script() {
case $1 in
group_messages)
forge script --rpc-url "${DOCKER_RPC_URL}" --broadcast script/DeployGroupMessages.s.sol &> /dev/null
echo "⧖ Deploying GroupMessages contract"
forge script --quiet --rpc-url "${DOCKER_RPC_URL}" --broadcast script/DeployGroupMessages.s.sol
if [ $? -ne 0 ]; then
echo "Failed to deploy group messages contract"
exit 1
fi

echo -e "✅ GroupMessages contract deployed.\n"
cat config/anvil_localnet/GroupMessages.json
echo -e "\n"
echo -e "✔ GroupMessages contract deployed. Deployment details in contracts/config/anvil_localnet/GroupMessages.json\n"
;;

identity_updates)
forge script --rpc-url "${DOCKER_RPC_URL}" --broadcast script/DeployIdentityUpdates.s.sol &> /dev/null
echo "⧖ Deploying IdentityUpdates contract"
forge script --quiet --rpc-url "${DOCKER_RPC_URL}" --broadcast script/DeployIdentityUpdates.s.sol
if [ $? -ne 0 ]; then
echo "Failed to deploy identity updates contract"
exit 1
fi

echo -e "✅ IdentityUpdates contract deployed.\n"
cat config/anvil_localnet/IdentityUpdates.json
echo -e "\n"
echo -e "✔ IdentityUpdates contract deployed. Deployment details in contracts/config/anvil_localnet/IdentityUpdates.json\n"
;;

nodes)
# TODO: Migrate to forge script
echo "⧖ Deploying Nodes contract"
forge create --broadcast --legacy --json --rpc-url $DOCKER_RPC_URL --private-key $PRIVATE_KEY "$2:$3" > ../build/$3.json
echo -e "✅ Nodes contract deployed.\n"
cat ../build/$3.json
echo -e "\n"
echo -e "✔ Nodes contract deployed. Deployment details in contracts/config/anvil_localnet/$3.json\n"
;;

*)
Expand Down
6 changes: 3 additions & 3 deletions dev/up
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ dev/docker/up
contracts/dev/generate
contracts/dev/deploy-local

echo "Registering local node-1"
echo -e "Registering local node-1"
dev/register-local-node

echo "Registering local node-2"
dev/register-local-node-2
echo -e "Registering local node-2"
dev/register-local-node-2

0 comments on commit 74d19c3

Please sign in to comment.