Skip to content

LUM-1195: Increase UT coverage for contracts #29

LUM-1195: Increase UT coverage for contracts

LUM-1195: Increase UT coverage for contracts #29

Workflow file for this run

name: Lumino Protocol CI/CD
on:
pull_request:
branches:
- "**"
- '!main'
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
required: true
default: 'testnet'
type: choice
options:
- testnet
env:
FOUNDRY_PROFILE: ci
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
TESTNET_RPC_URL: ${{ secrets.TESTNET_RPC_URL }}
jobs:
unit-tests:
name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Install Dependencies
run: |
forge install OpenZeppelin/openzeppelin-contracts --no-commit
forge install OpenZeppelin/openzeppelin-contracts-upgradeable --no-commit
- name: Check contract sizes
run: forge build --sizes
id: build
- name: Check gas snapshots
run: |
forge snapshot --check || (
echo "Gas snapshot check failed. Generating new snapshot for reference..."
forge snapshot
echo "Please commit the updated .gas-snapshot file"
)
id: snapshot
- name: Run tests
run: forge test -vvv
id: test
- name: Run coverage
run: forge coverage --report lcov --report summary
--report debug
--optimize
--optimizer-runs 200
--no-auto-detect
--skip script/DeployUpgradableLuminoProtocol.s.sol
id: coverage
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./lcov.info
# fail_ci_if_error: true
# verbose: true
slither:
name: Slither Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Slither
run: |
python -m pip install --upgrade pip
pip3 install slither-analyzer
- name: Run Slither
run: |
forge build
slither . --sarif slither-results.sarif || true
# - name: Upload SARIF file
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: slither-results.sarif
# token: ${{ secrets.GITHUB_TOKEN }}
lint:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install Prettier and Solidity Plugin
run: |
npm install --save-dev prettier prettier-plugin-solidity
- name: Check formatting
run: npx prettier --check "src/**/*.sol" "test/**/*.sol"
deploy-testnet:
name: Deploy to Testnet
needs: [unit-tests, slither, lint]
if: |
(github.ref == 'refs/heads/develop' && github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testnet')
runs-on: ubuntu-latest
environment: testnet
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Deploy to Testnet
env:
RPC_URL: ${{ env.TESTNET_RPC_URL }}
run: |
forge script script/DeployUpgradeableLuminoProtocol.s.sol:DeployUpgradeableLuminoProtocol \
--rpc-url $RPC_URL \
--broadcast \
--verify \
-vvvv
- name: Save deployment artifacts
uses: actions/upload-artifact@v3
with:
name: testnet-deployment
path: broadcast/
if-no-files-found: error