Skip to content

Integration tests against Mezo Portal #148

Integration tests against Mezo Portal

Integration tests against Mezo Portal #148

Workflow file for this run

name: Solidity
on:
push:
branches:
- main
paths:
- "solidity/**"
pull_request:
workflow_dispatch:
inputs:
environment:
description: "Testnet to deploy contracts to"
required: true
type: choice
options:
- "sepolia"
default: "sepolia"
defaults:
run:
working-directory: ./solidity
jobs:
solidity-build:
uses: ./.github/workflows/reusable-solidity-build.yaml
solidity-format:
needs: [solidity-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v3
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: "solidity/.nvmrc"
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --prefer-offline --frozen-lockfile
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: solidity-build
path: solidity/
- name: Format
run: pnpm run format
solidity-slither:
needs: [solidity-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v3
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: "solidity/.nvmrc"
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --prefer-offline --frozen-lockfile
- uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install Slither
env:
SLITHER_VERSION: 0.9.6
run: pip3 install slither-analyzer==$SLITHER_VERSION
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: solidity-build
path: solidity/
- name: Run Slither
run: slither --hardhat-ignore-compile .
solidity-test:
needs: [solidity-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v3
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: "solidity/.nvmrc"
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --prefer-offline --frozen-lockfile
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: solidity-build
path: solidity/
- name: Test
run: pnpm run test --no-compile
solidity-deploy-dry-run:
needs: [solidity-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v3
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: "solidity/.nvmrc"
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --prefer-offline --frozen-lockfile
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: solidity-build
path: solidity/
- name: Deploy
run: pnpm run deploy --no-compile
solidity-deploy-testnet:
needs: [solidity-deploy-dry-run]
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: "solidity/.nvmrc"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --prefer-offline --frozen-lockfile
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: solidity-build
path: solidity/
- name: Remove existing deployment artifacts for the selected network
run: rm -rf deployments/${{ github.event.inputs.environment }}
- name: Deploy contracts
env:
ACCOUNTS_PRIVATE_KEYS: ${{ secrets.TESTNET_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
CHAIN_API_URL: ${{ secrets.SEPOLIA_CHAIN_API_URL }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
run: |
pnpm run deploy --network ${{ github.event.inputs.environment }}
- name: Upload deployed contracts as workflow artifact
# The step will be executed even if the previous step fails (can be
# useful for partially failed deployments).
if: always()
uses: actions/upload-artifact@v4
with:
name: deployed-contracts-${{ github.event.inputs.environment }}
path: |
solidity/deployments/${{ github.event.inputs.environment }}
if-no-files-found: error