-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (109 loc) · 3.65 KB
/
Copy pathtest.yml
File metadata and controls
129 lines (109 loc) · 3.65 KB
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
name: CI
permissions: {}
on:
push:
pull_request:
workflow_dispatch:
jobs:
check:
name: Foundry project
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Show Forge version
run: forge --version
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install "slither-analyzer>=0.10.0,<0.11.0"
- name: Run Forge fmt
run: forge fmt --check
- name: Run Forge build
run: forge build --sizes --build-info
- name: Run Forge tests
run: forge test -vvv
- name: Run explicit FFI tests
run: |
RUN_FFI_TESTS=true forge test --match-path test/FFI.t.sol --ffi -vvv
RUN_FFI_TESTS=true forge test --match-path test/DifferentialTest.t.sol --ffi -vvv
RUN_FFI_TESTS=true forge test --match-path test/Vyper.t.sol --ffi -vvv
- name: Generate gas report
run: |
set -o pipefail
forge test --gas-report \
--no-match-path test/23-rareskills-gas-optimization/RareSkillsGasOptimization.t.sol \
| tee gas-report.txt
- name: Upload gas report
uses: actions/upload-artifact@v4
with:
name: gas-report
path: gas-report.txt
if-no-files-found: error
- name: Slither (静态分析)
run: slither . --config-file slither.config.json --fail-high
- name: Echidna (模糊测试)
uses: crytic/echidna-action@v2
with:
files: .
contract: CounterEchidna
config: echidna.yaml
crytic-args: --ignore-compile
test-limit: 5000
solc-version: "0.8.20"
manticore:
name: Manticore (符号执行)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Run Manticore verifier
run: |
export FOUNDRY_PROFILE=manticore
forge build --build-info --sizes
python -m venv .manticore-venv
. .manticore-venv/bin/activate
python -m pip install --upgrade pip
pip install "protobuf>=3.19.0,<4" # Manticore _pb2.py incompatible with protobuf 4.21+
pip install solc-select
solc-select install 0.8.20
solc-select use 0.8.20
pip install "manticore==0.3.7"
set +e
manticore-verifier src/manticore/CounterManticore.sol \
--contract_name CounterManticore \
--compile-force-framework foundry \
--maxt 2 \
--timeout 600 2>&1 | tee manticore.log
status=${PIPESTATUS[0]}
set -e
if [ "$status" -ne 0 ]; then
python - <<'PY'
from pathlib import Path
import sys
log = Path("manticore.log").read_text()
sys.exit(0 if "manticore.exceptions.NoAliveStates" in log else 1)
PY
echo "Manticore 0.3.7 reported NoAliveStates after successful compilation; treating as verifier finalization limitation."
fi