Skip to content

dApp: Points card update #1547

dApp: Points card update

dApp: Points card update #1547

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@v4
- 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:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v4
- 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.10.4
run: pip3 install slither-analyzer==$SLITHER_VERSION
- name: Run Slither
run: slither .
solidity-test:
needs: [solidity-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v4
- 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-integration-test:
needs: [solidity-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v4
- 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: Run Hardhat Node
env:
MAINNET_RPC_URL: ${{ secrets.MAINNET_CHAIN_API_URL }}
run: |
pnpm node:forking &
while [[ -z $(lsof -i :8545 -t) ]]; do echo "Waiting for port 8545 to be open..."; sleep 10; done
- name: Run Integration Tests
run: pnpm run test:integration --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@v4
- 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@v4
- 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:
SEPOLIA_PRIVATE_KEY: ${{ secrets.TESTNET_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
SEPOLIA_RPC_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