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