forked from greenpill-dev-guild/camp-green
-
Notifications
You must be signed in to change notification settings - Fork 4
192 lines (161 loc) · 5.06 KB
/
contracts-tests.yml
File metadata and controls
192 lines (161 loc) · 5.06 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: Contracts Tests
on:
push:
branches: [main, develop]
paths:
- "packages/contracts/**"
- "scripts/check-contract-test-realism.sh"
- "scripts/run-contract-coverage-audit.sh"
- "scripts/validate-contract-test-realism-tooling.sh"
- ".github/workflows/contracts-tests.yml"
pull_request:
branches: [main, develop]
paths:
- "packages/contracts/**"
- "scripts/check-contract-test-realism.sh"
- "scripts/run-contract-coverage-audit.sh"
- "scripts/validate-contract-test-realism-tooling.sh"
- ".github/workflows/contracts-tests.yml"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run tests
run: |
cd packages/contracts
bun run test
env:
CI: true
fork:
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run fork protocol suite (exclude Celo + Unlock)
run: |
cd packages/contracts
bun run test:fork:protocol
env:
ARBITRUM_RPC_URL: ${{ secrets.ARBITRUM_RPC_URL || 'https://arb1.arbitrum.io/rpc' }}
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL || 'https://ethereum-sepolia.publicnode.com' }}
ETHEREUM_RPC_URL: ${{ secrets.ETHEREUM_RPC_URL || 'https://ethereum-rpc.publicnode.com' }}
COOKIE_JAR_FACTORY_ADDRESS: ${{ secrets.COOKIE_JAR_FACTORY_ADDRESS }}
CI: true
realism-audit:
if: always()
runs-on: ubuntu-latest
needs: [test, fork]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Resolve realism gate phase
id: realism-phase
run: |
TODAY="$(date -u +%F)"
if [[ "$TODAY" < "2026-02-26" ]]; then
MODE="advisory"
THRESHOLD="0.70"
PHASE="phase-0"
elif [[ "$TODAY" < "2026-03-05" ]]; then
MODE="enforce-must-fix"
THRESHOLD="0.70"
PHASE="phase-1"
elif [[ "$TODAY" < "2026-03-19" ]]; then
MODE="enforce-should-fix"
THRESHOLD="0.80"
PHASE="phase-2"
else
MODE="enforce-should-fix"
THRESHOLD="0.90"
PHASE="phase-3"
fi
echo "mode=$MODE" >> "$GITHUB_OUTPUT"
echo "revert_threshold=$THRESHOLD" >> "$GITHUB_OUTPUT"
echo "phase=$PHASE" >> "$GITHUB_OUTPUT"
echo "today=$TODAY" >> "$GITHUB_OUTPUT"
- name: Validate realism tooling scenarios
run: |
cd packages/contracts
bun run test:audit:realism:tooling
- name: Run contracts realism audit
run: |
cd packages/contracts
bun run test:audit:realism
env:
CI: true
CONTRACT_REALISM_MODE: ${{ steps.realism-phase.outputs.mode }}
REALISM_REVERT_THRESHOLD: ${{ steps.realism-phase.outputs.revert_threshold }}
CONTRACT_REALISM_REPORT_MD: ../../output/contracts-test-audit/realism-report-ci.md
CONTRACT_REALISM_REPORT_JSON: ../../output/contracts-test-audit/realism-report-ci.json
- name: Upload realism audit artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: contracts-test-realism-audit
path: output/contracts-test-audit/
retention-days: 14
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run linting
run: |
cd packages/contracts
bun run lint