Skip to content
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
95 changes: 95 additions & 0 deletions .github/workflows/validate-deployment-scripts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Validate Deployment Scripts

permissions:
contents: read

on:
workflow_dispatch:
pull_request:
paths:
- 'script/**'
- '.github/workflows/validate-deployment-scripts.yml'


jobs:

test:
runs-on: protocol-x64-16core
strategy:
fail-fast: true
matrix:
env: [preprod, testnet, mainnet]

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 }}" = "mainnet" ]; then
RPC_URL="${{ secrets.RPC_MAINNET }}"
else
RPC_URL="${{ secrets.RPC_HOLESKY }}"
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