Skip to content

feat: multichain deploy scripts #196

feat: multichain deploy scripts

feat: multichain deploy scripts #196

name: Validate Deployment Scripts
on:
workflow_dispatch:
pull_request:
paths:
- 'script/**'
- '.github/workflows/validate-deployment-scripts.yml'
permissions:
contents: read
pull-requests: read
jobs:
test:
runs-on: protocol-x64-16core
strategy:
fail-fast: true
matrix:
env: [preprod, testnet, mainnet, testnet-sepolia, testnet-hoodi]
steps:
# Check out repository with all submodules for complete codebase access.
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Zeus
run: npm install -g @layr-labs/zeus
# Restore Forge cache
- name: Cache Forge Build
uses: actions/cache@v3
with:
path: |
cache/
out/
key: ${{ runner.os }}-forge-${{ hashFiles('**/foundry.toml', '**/remappings.txt', 'src/**/*.sol', 'lib/**/*.sol') }}
restore-keys: |
${{ runner.os }}-forge-
# Install the Foundry toolchain.
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable
# Run Forge's formatting checker to ensure consistent code style.
- name: "Forge Fmt"
run: |
forge fmt --check
FOUNDRY_PROFILE=test forge fmt --check
id: fmt
# Build the project and display contract sizes.
- name: Forge Build
run: |
forge --version
forge build --sizes
- name: Validate Solidity Scripts
run: |
# Find all .sol files under /script/releases
RELEASE_FILES=$(find script/releases -type f -name "*.sol" ! -name "Env.sol" 2>/dev/null || echo "")
# Combine file lists
FILES="$RELEASE_FILES"
# Trim leading/trailing whitespace
FILES=$(echo "$FILES" | xargs)
# Exit with success if no files are found
if [ -z "$FILES" ]; then
echo "No .sol files found under /script/releases directories"
exit 0
fi
# Set RPC URL based on environment
if [ "${{ matrix.env }}" = "testnet" ] || [ "${{ matrix.env }}" = "preprod" ]; then
RPC_URL="${{ secrets.RPC_HOLESKY }}"
elif [ "${{ matrix.env }}" = "testnet-sepolia" ]; then
RPC_URL="${{ secrets.RPC_SEPOLIA }}"
elif [ "${{ matrix.env }}" = "testnet-hoodi" ]; then
RPC_URL="${{ secrets.RPC_HOODI }}"
elif [ "${{ matrix.env }}" = "mainnet" ]; then
RPC_URL="${{ secrets.RPC_MAINNET }}"
fi
# Run zeus test on each file with the specified environment and RPC URL
for file in $FILES; do
echo "Testing $file in ${{ matrix.env }} environment with RPC $RPC_URL..."
zeus test --env ${{ matrix.env }} --rpcUrl "$RPC_URL" "$file"
done