Skip to content
Open
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
108 changes: 108 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Hardhat CI/CD Multichain

on: [push, pull_request]
env:
TENDERLY_PROJECT_NAME: ${{ vars.TENDERLY_PROJECT_NAME }}
TENDERLY_ACCOUNT_NAME: ${{ vars.TENDERLY_ACCOUNT_NAME }}

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Setup Virtual TestNet
uses: tenderly/vnet-github-action@v1.0.14
with:
mode: CI
access_key: ${{ secrets.TENDERLY_ACCESS_KEY }}
project_name: ${{ vars.TENDERLY_PROJECT_NAME }}
account_name: ${{ vars.TENDERLY_ACCOUNT_NAME }}
testnet_name: "Testing"
network_id: 1
chain_id_prefix: 7357
public_explorer: true
verification_visibility: 'src'
push_on_complete: true

- name: Fetch Token and Cryptocurrency Details
run: |
curl -H "Authorization: Bearer ${{ secrets.TENDERLY_ACCESS_KEY }}" \
-H "Content-Type: application/json" \
https://api.tenderly.co/api/v1/account/${{ vars.TENDERLY_ACCOUNT_NAME }}/project/${{ vars.TENDERLY_PROJECT_NAME }}/tokens \
-o tokens.json
cat tokens.json
shell: bash

- name: Install dependencies
run: npm install
working-directory: examples/hardhat-ignition

- name: Run Tests
run: npm run test:1
working-directory: examples/hardhat-ignition

- name: Handle Errors
run: node handle-errors.js
if: failure()
shell: bash

deploy:
needs: test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Setup Virtual TestNet
uses: tenderly/vnet-github-action@v1.0.14
with:
mode: CD
access_key: ${{ secrets.TENDERLY_ACCESS_KEY }}
project_name: ${{ vars.TENDERLY_PROJECT_NAME }}
account_name: ${{ vars.TENDERLY_ACCOUNT_NAME }}
testnet_name: "Staging"
network_id: |
1
8453
chain_id_prefix: ""
public_explorer: true
verification_visibility: 'src'
push_on_complete: true

- name: Setup Income Generation
run: npm run setup-staking
working-directory: examples/income-generation

- name: Install dependencies
run: npm install
working-directory: examples/hardhat-ignition

- name: Deploy Contracts Mainnet
run: npm run deploy:1 -- --deployment-id deploy-1-${BUILD_SLUG}
working-directory: examples/hardhat-ignition

- name: Deploy Contracts Base
run: npm run deploy:8453 -- --deployment-id deploy-8453-${BUILD_SLUG}
working-directory: examples/hardhat-ignition

- name: Deploy Dashboard
run: npm run deploy-dashboard
working-directory: examples/dashboard

- name: Transfer Contracts
run: node transfer-contracts.js
shell: bash