Skip to content

Tenderly Virtual TestNet CI/CD #3

Tenderly Virtual TestNet CI/CD

Tenderly Virtual TestNet CI/CD #3

Workflow file for this run

name: Deploy to Tenderly Virtual TestNet
on: [pull_request]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
# Create Tenderly Virtual TestNet environment: https://docs.tenderly.co/virtual-testnets
- name: Setup Tenderly Virtual TestNet
uses: Tenderly/[email protected]
with:
access_key: ${{ secrets.TENDERLY_ACCESS_KEY }}
project_name: ${{ vars.TENDERLY_PROJECT_SLUG }}
account_name: ${{ vars.TENDERLY_ACCOUNT_SLUG }}
testnet_name: 'Uniswap VNet CI/CD ${{ github.run_id }}'
mode: 'CD'
# ETH Mainnet config: https://docs.tenderly.co/supported-networks
network_id: 1
chain_id: 1
block_number: 'latest'
# Enable explorer & verification: https://docs.tenderly.co/virtual-testnets/testnet-explorer
public_explorer: true
verification_visibility: 'src'
state_sync: false
# Fund wallet using unlimited faucet: https://docs.tenderly.co/virtual-testnets/unlimited-faucet
- name: Fund Account
env:
TENDERLY_ADMIN_RPC_URL: ${{ env.TENDERLY_ADMIN_RPC_URL }}
ADMIN_WALLET: ${{ vars.ADMIN_WALLET }}
run: |
curl $TENDERLY_ADMIN_RPC_URL \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tenderly_setBalance",
"params": [
"${{ vars.ADMIN_WALLET }}",
"0x3635c9adc5dea00000"
],
"id": "1234"
}'
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Foundry Build
run: |
forge --version
forge build --sizes
# Deploy & verify contracts
- name: Deploy Contracts
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
FOUNDRY_ETH_RPC_URL: ${{ env.TENDERLY_PUBLIC_RPC_URL }}
FOUNDRY_VERIFIER_URL: ${{ env.TENDERLY_FOUNDRY_VERIFICATION_URL }}
run: |
forge script script/deploy/Deploy-all.s.sol \
--private-key $PRIVATE_KEY \
--rpc-url $FOUNDRY_ETH_RPC_URL \
--verifier-url $FOUNDRY_VERIFIER_URL \
--slow \
--broadcast \
--verify