-
Notifications
You must be signed in to change notification settings - Fork 18
120 lines (115 loc) · 4.01 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
name: Contracts CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
types: [ opened, reopened, synchronize, ready_for_review ]
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
env:
PROTOCOL_DEPLOYER_PRIVATE_KEY: 123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234
CC_TOKEN_DEPLOYER_PRIVATE_KEY: 123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234
CMC_API_KEY: ${{ secrets.COINMARKETCAP_API_KEY }}
RINKEBY_URL: https://provider_url/project_key
ROPSTEN_URL: https://provider_url/project_key
MAINNET_URL: https://provider_url/project_key
name: build
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '12.20.x'
cache: 'npm'
- run: npm install
- run: npm run contracts:compile
- run: npm run contracts:lint
- run: npm run contracts:format
- run: npm run tests:lint
- run: npm run tests:format
test:
needs: build
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
env:
PROTOCOL_DEPLOYER_PRIVATE_KEY: 123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234
CC_TOKEN_DEPLOYER_PRIVATE_KEY: 123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234
CMC_API_KEY: ${{ secrets.COINMARKETCAP_API_KEY }}
RINKEBY_URL: https://provider_url/project_key
ROPSTEN_URL: https://provider_url/project_key
MAINNET_URL: https://provider_url/project_key
name: test
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '12.20.x'
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Compile Contracts
run: npm run contracts:compile
- name: Contract Sizing
run: npm run contracts:size
- name: Unit tests + Gas Reporter
run: npm run tests:unit
- name: Upload Gas reporter output
uses: actions/upload-artifact@v2
with:
name: gas-reporter-report
path: GasReport.txt
snyk:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@master
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
continue-on-error: true # To make sure that SARIF upload gets called
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high --sarif-file-output=snyk.sarif
- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: snyk.sarif
deploy:
needs: test
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' || github.event.pull_request.user.login == 'dependabot[bot]' }}
env:
PROTOCOL_DEPLOYER_PRIVATE_KEY: 123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234
CC_TOKEN_DEPLOYER_PRIVATE_KEY: 123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234
RINKEBY_URL: https://provider_url/project_key
ROPSTEN_URL: https://provider_url/project_key
MAINNET_URL: https://provider_url/project_key
name: deploy
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '12.20.x'
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Prepare Environment Variables
shell: bash
run: |
cp .env.example .env
- name: Deploy contracts locally
run: npm run contracts:run