|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [main, develop] |
| 5 | + pull_request: |
| 6 | + branches: [main, develop] |
| 7 | + workflow_dispatch: |
| 8 | +jobs: |
| 9 | + lint: |
| 10 | + name: Lint |
| 11 | + runs-on: ubuntu-22.04 |
| 12 | + steps: |
| 13 | + - name: Check out code |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Setup Node.js environment |
| 17 | + uses: actions/setup-node@v4 |
| 18 | + with: |
| 19 | + node-version: 20 |
| 20 | + cache: "yarn" |
| 21 | + |
| 22 | + - name: Install dependencies |
| 23 | + run: yarn |
| 24 | + |
| 25 | + - name: Check linting of solidity and typescript |
| 26 | + run: yarn lint |
| 27 | + |
| 28 | + test: |
| 29 | + name: Test |
| 30 | + runs-on: ubuntu-22.04 |
| 31 | + env: |
| 32 | + NODE_OPTIONS: --max-old-space-size=4096 |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - uses: actions/setup-node@v4 |
| 37 | + with: |
| 38 | + node-version: 20 |
| 39 | + cache: "yarn" |
| 40 | + |
| 41 | + - name: Install deps |
| 42 | + run: yarn |
| 43 | + |
| 44 | + - name: Run hardhat compile and tests coverage |
| 45 | + run: | |
| 46 | + source .env.example |
| 47 | + yarn hardhat:compile && yarn hardhat:coverage |
| 48 | +
|
| 49 | + - name: Code Coverage Report |
| 50 | + uses: irongut/CodeCoverageSummary@v1.3.0 |
| 51 | + with: |
| 52 | + filename: coverage/cobertura-coverage.xml |
| 53 | + badge: true |
| 54 | + fail_below_min: false |
| 55 | + format: markdown |
| 56 | + hide_branch_rate: false |
| 57 | + hide_complexity: true |
| 58 | + indicators: true |
| 59 | + output: both |
| 60 | + thresholds: "50 80" |
| 61 | + |
| 62 | + - name: Add Coverage PR Comment |
| 63 | + uses: marocchino/sticky-pull-request-comment@v2 |
| 64 | + if: github.event_name == 'pull_request' |
| 65 | + with: |
| 66 | + recreate: true |
| 67 | + path: code-coverage-results.md |
| 68 | + |
| 69 | + deploy: |
| 70 | + name: Deploy |
| 71 | + runs-on: ubuntu-22.04 |
| 72 | + steps: |
| 73 | + - name: Check out code |
| 74 | + uses: actions/checkout@v4 |
| 75 | + |
| 76 | + - name: Setup Node.js environment |
| 77 | + uses: actions/setup-node@v4 |
| 78 | + with: |
| 79 | + node-version: 20 |
| 80 | + cache: "yarn" |
| 81 | + |
| 82 | + - name: Install dependencies |
| 83 | + run: yarn |
| 84 | + |
| 85 | + - name: Build |
| 86 | + run: yarn build |
| 87 | + |
| 88 | + - name: Verify deployments work |
| 89 | + run: yarn hardhat deploy |
| 90 | + |
| 91 | + export-deployments: |
| 92 | + runs-on: ubuntu-latest |
| 93 | + permissions: |
| 94 | + contents: write |
| 95 | + |
| 96 | + steps: |
| 97 | + - name: Check out code |
| 98 | + uses: actions/checkout@v4 |
| 99 | + with: |
| 100 | + ref: ${{ github.head_ref }} |
| 101 | + token: ${{ secrets.VENUS_TOOLS_TOKEN }} |
| 102 | + |
| 103 | + - name: Setup Node.js environment |
| 104 | + uses: actions/setup-node@v4 |
| 105 | + with: |
| 106 | + node-version: 20 |
| 107 | + cache: "yarn" |
| 108 | + |
| 109 | + - name: Install dependencies |
| 110 | + run: yarn |
| 111 | + |
| 112 | + - name: Export deployments |
| 113 | + run: | |
| 114 | + for NETWORK in bsctestnet bscmainnet ethereum sepolia opbnbtestnet opbnbmainnet arbitrumsepolia arbitrumone opsepolia opmainnet basesepolia basemainnet unichainsepolia unichainmainnet; do |
| 115 | + EXPORT=true yarn hardhat export --network ${NETWORK} --export ./deployments/${NETWORK}.json |
| 116 | + jq -M '{name, chainId, addresses: .contracts | map_values(.address)}' ./deployments/${NETWORK}.json > ./deployments/${NETWORK}_addresses.json |
| 117 | + done |
| 118 | + for NETWORK in zksyncsepolia zksyncmainnet; do |
| 119 | + EXPORT=true yarn hardhat export --network ${NETWORK} --export ./deployments/${NETWORK}.json --config hardhat.config.zksync.ts |
| 120 | + jq -M '{name, chainId, addresses: .contracts | map_values(.address)}' ./deployments/${NETWORK}.json > ./deployments/${NETWORK}_addresses.json |
| 121 | + done |
| 122 | + yarn prettier |
| 123 | +
|
| 124 | + - uses: stefanzweifel/git-auto-commit-action@v5 |
| 125 | + with: |
| 126 | + commit_message: "feat: updating deployment files" |
| 127 | + file_pattern: "deployments/*.json" |
0 commit comments