-
Notifications
You must be signed in to change notification settings - Fork 11
160 lines (143 loc) · 4.42 KB
/
ci.yml
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: "CI"
env:
FOUNDRY_PROFILE: "ci"
on:
workflow_dispatch:
pull_request:
branches:
- "main"
- "feature/**"
- "feat/**"
- "develop"
push:
branches:
- "main"
- "develop"
jobs:
slither:
name: Slither
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"
- name: "Install Foundry"
uses: "onbjerg/foundry-toolchain@v1"
with:
version: "nightly-d369d2486f85576eec4ca41d277391dfdae21ba7"
- name: "Build the contracts"
run: |
forge build --skip test --skip script --build-info
- name: Run Slither
uses: crytic/[email protected]
id: slither
with:
ignore-compile: true
sarif: results.sarif
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.slither.outputs.sarif }}
check_storage_layout:
name: Check storage layout
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
contract:
- contracts/legacy/ReserveSpenderMultiSig.sol:ReserveSpenderMultiSig
- contracts/legacy/StableToken.sol:StableToken
- contracts/legacy/Exchange.sol:Exchange
- contracts/legacy/GrandaMento.sol:GrandaMento
- contracts/swap/Broker.sol:Broker
- contracts/swap/BiPoolManager.sol:BiPoolManager
- contracts/swap/Reserve.sol:Reserve
- contracts/oracles/BreakerBox.sol:BreakerBox
- contracts/oracles/SortedOracles.sol:SortedOracles
- contracts/tokens/StableTokenV2.sol:StableTokenV2
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: "nightly-d369d2486f85576eec4ca41d277391dfdae21ba7"
- name: Check storage layout
uses: Rubilmax/[email protected]
with:
contract: ${{ matrix.contract }}
get_echidna_test_names:
name: Get Echidna test names
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Generate matrix with all test names from the test/echidna directory
id: set-matrix
run: |
echo "::set-output name=matrix::$(ls test/echidna | sed 's/.sol//' | jq -R -s -c 'split("\n")[:-1]')"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
run_echidna_tests:
needs: get_echidna_test_names
name: Run echidna tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
contract: ${{ fromJson(needs.get_echidna_test_names.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: "nightly-d369d2486f85576eec4ca41d277391dfdae21ba7"
- name: "Build for echidna"
run: yarn forge:build:slither
- name: "Run Echidna"
uses: crytic/echidna-action@v2
with:
files: test/echidna/${{ matrix.contract }}.sol
solc-version: 0.5.17
contract: ${{ matrix.contract }}
config: echidna.yaml
test-mode: assertion
ci:
name: Lint & Test
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"
- name: "Install Foundry"
uses: "onbjerg/foundry-toolchain@v1"
with:
version: "nightly-d369d2486f85576eec4ca41d277391dfdae21ba7"
- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "yarn"
node-version: "16"
- name: "Install the Node.js dependencies"
run: "yarn install --immutable"
- name: "Lint the contracts"
run: "yarn lint:check"
- name: "Add lint summary"
run: |
echo "## Lint" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
- name: "Show the Foundry config"
run: "forge config"
- name: "Run the tests"
run: "forge test"
- name: "Build the contracts"
run: |
forge --version
forge build --sizes
- name: "Add test summary"
run: |
echo "## Tests" >> $GITHUB_STEP_SUMMARY