-
Notifications
You must be signed in to change notification settings - Fork 15
302 lines (259 loc) · 10.9 KB
/
integration-tests.yaml
File metadata and controls
302 lines (259 loc) · 10.9 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
name: Integration Tests
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
permissions:
contents: read
# Cancel the workflow if any new changes pushed to a feature branch or the trunk
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -ex {0}
jobs:
label-check:
if: >-
(github.event.action == 'labeled' && github.event.label.name == 'ci:integration'
|| github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'ci:integration'))
&& !github.event.pull_request.head.repo.fork
runs-on: ubuntu-24.04
steps:
- run: 'true'
cooldown-check:
name: Cargo cooldown check
runs-on: ubuntu-24.04
needs: label-check
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- uses: ./.github/actions/cooldown-check
integration:
needs: [label-check, cooldown-check]
permissions:
contents: read
pull-requests: write
packages: read
runs-on: solx-linux-amd64
container:
image: ghcr.io/nomicfoundation/solx-ci-runner@sha256:c0866d146261cd0a51dc7d9077444b8ac3dde12c53d2151137834e6be149dbc7
options: -m 110g
steps:
- name: Checkout PR
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
- name: Checkout main
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
continue-on-error: true
with:
ref: main
submodules: true
path: temp-solx-main
- name: Checkout submodules (PR)
run: |
git config --global --add safe.directory '*'
git submodule update --init --force --recursive --depth 1 --checkout
- name: Checkout submodules (main)
working-directory: temp-solx-main
continue-on-error: true
run: |
git submodule update --init --force --recursive --depth 1 --checkout
- name: Build LLVM
uses: ./.github/actions/build-llvm
with:
build-type: Release
enable-assertions: 'false'
- name: Share LLVM with main checkout
continue-on-error: true
run: |
MAIN_SHA=$(git -C temp-solx-main/solx-llvm rev-parse HEAD)
PR_SHA=$(git -C solx-llvm rev-parse HEAD)
if [ "$MAIN_SHA" = "$PR_SHA" ]; then
echo "LLVM SHAs match ($PR_SHA), sharing via symlink"
mkdir -p temp-solx-main/target-llvm
ln -snf "$GITHUB_WORKSPACE/target-llvm/target-final" \
temp-solx-main/target-llvm/target-final
else
echo "::notice::LLVM SHAs differ (main=$MAIN_SHA PR=$PR_SHA), building main separately"
pushd temp-solx-main
cargo fetch --locked
cargo build --frozen --release --bin solx-dev
./target/release/solx-dev llvm build --build-type Release
popd
fi
- name: Build solc (PR)
uses: ./.github/actions/build-solc
with:
cmake-build-type: Release
working-dir: 'solx-solidity'
- name: Build solc (main)
uses: ./.github/actions/build-solc
continue-on-error: true
with:
cmake-build-type: 'Release'
working-dir: 'temp-solx-main/solx-solidity'
- name: Fetch dependencies (PR)
run: cargo fetch --locked
- name: Build solx (PR)
env:
BOOST_PREFIX: ${{ github.workspace }}/solx-solidity/boost/lib
SOLC_PREFIX: ${{ github.workspace }}/solx-solidity/build
run: cargo build --frozen --release --bin solx
- name: Build solx-dev and solx-tester (PR)
env:
BOOST_PREFIX: ${{ github.workspace }}/solx-solidity/boost/lib
SOLC_PREFIX: ${{ github.workspace }}/solx-solidity/build
run: cargo build --frozen --release --bin solx-dev --bin solx-tester
- name: Fetch dependencies (main)
working-directory: temp-solx-main
continue-on-error: true
run: cargo fetch --locked
- name: Build solx (main)
working-directory: temp-solx-main
continue-on-error: true
env:
BOOST_PREFIX: ${{ github.workspace }}/temp-solx-main/solx-solidity/boost/lib
SOLC_PREFIX: ${{ github.workspace }}/temp-solx-main/solx-solidity/build
run: cargo build --frozen --release --bin solx
- name: Build solx-dev and solx-tester (main)
working-directory: temp-solx-main
continue-on-error: true
env:
BOOST_PREFIX: ${{ github.workspace }}/temp-solx-main/solx-solidity/boost/lib
SOLC_PREFIX: ${{ github.workspace }}/temp-solx-main/solx-solidity/build
run: cargo build --frozen --release --bin solx-dev --bin solx-tester
- name: Run solx-tester tests (PR)
id: solx_tester_tests
continue-on-error: true
env:
BOOST_PREFIX: ${{ github.workspace }}/solx-solidity/boost/lib
SOLC_PREFIX: ${{ github.workspace }}/solx-solidity/build
run: ./target/release/solx-dev test solx-tester --solidity-compiler ./target/release/solx
- name: Run solx-tester benchmarks (main)
id: solx_tester_bench_main
continue-on-error: true
working-directory: temp-solx-main
env:
BOOST_PREFIX: ${{ github.workspace }}/temp-solx-main/solx-solidity/boost/lib
SOLC_PREFIX: ${{ github.workspace }}/temp-solx-main/solx-solidity/build
run: |
./target/release/solx-dev test solx-tester \
--solidity-compiler ./target/release/solx \
--via-ir --optimizer 'M^B3' \
--benchmark=../reference-benchmark.json
- name: Run solx-tester benchmarks (PR)
id: solx_tester_bench_pr
continue-on-error: true
env:
BOOST_PREFIX: ${{ github.workspace }}/solx-solidity/boost/lib
SOLC_PREFIX: ${{ github.workspace }}/solx-solidity/build
run: |
./target/release/solx-dev test solx-tester \
--solidity-compiler ./target/release/solx \
--via-ir --optimizer 'M^B3' \
--benchmark=candidate-benchmark.json
- name: Build benchmark converter
run: cargo build --frozen --release --bin solx-benchmark-converter
- name: Run benchmark converter
if: hashFiles('reference-benchmark.json') != '' && hashFiles('candidate-benchmark.json') != ''
run: |
cat reference-benchmark.json \
| jq '{data: ., project: "solx-tester", toolchain: "00.solx-main"}' > reference.json
cat candidate-benchmark.json \
| jq '{data: ., project: "solx-tester", toolchain: "01.solx"}' > candidate.json
./target/release/solx-benchmark-converter \
--output-path solx-tester-report.xlsx reference.json candidate.json
- name: Upload solx-tester report
if: always() && hashFiles('solx-tester-report.xlsx') != ''
id: solx-tester-report
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: solx-tester-report
path: solx-tester-report.xlsx
- name: Post solx-tester report comment
if: always() && steps.solx-tester-report.outcome == 'success'
uses: mshick/add-pr-comment@ffd016c7e151d97d69d21a843022fd4cd5b96fe5 # v3.9.0
with:
message-id: 'solx-tester-report'
message: |
📊 **solx Tester Report**
➡️ [**Download**](${{ steps.solx-tester-report.outputs.artifact-url }})
- name: Install Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.13'
- name: Install Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 24
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@8789b3e21e6c11b2697f5eb56eddae542f746c10 # v1
- name: Install Yarn
run: npm install -g yarn bun pnpm
# Some projects might use hardcoded ssh URLs: force git to use https instead.
- name: Git https settings
run: |
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
- name: Run Hardhat tests
id: hardhat_tests
continue-on-error: true
run: ./target/release/solx-dev test hardhat
- name: Upload Hardhat report
if: always() && hashFiles('temp-hardhat-reports/hardhat-report.xlsx') != ''
id: hardhat-report
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: hardhat-report
path: ./temp-hardhat-reports/hardhat-report.xlsx
- name: Post Hardhat report comment
if: always() && steps.hardhat-report.outcome == 'success'
uses: mshick/add-pr-comment@ffd016c7e151d97d69d21a843022fd4cd5b96fe5 # v3.9.0
with:
message-id: 'hardhat-report'
message: |
📊 **Hardhat Projects Report**
➡️ [**Download**](${{ steps.hardhat-report.outputs.artifact-url }})
- name: Run Foundry tests
id: foundry_tests
continue-on-error: true
run: ./target/release/solx-dev test foundry
- name: Upload Foundry report
if: always() && hashFiles('temp-foundry-reports/foundry-report.xlsx') != ''
id: foundry-report
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: foundry-report
path: ./temp-foundry-reports/foundry-report.xlsx
- name: Post Foundry report comment
if: always() && steps.foundry-report.outcome == 'success'
uses: mshick/add-pr-comment@ffd016c7e151d97d69d21a843022fd4cd5b96fe5 # v3.9.0
with:
message-id: 'foundry-report'
message: |
📊 **Foundry Projects Report**
➡️ [**Download**](${{ steps.foundry-report.outputs.artifact-url }})
- name: Fail workflow if tests or benchmarks failed
if: always()
run: |
failures=()
if [ "${{ steps.solx_tester_tests.outcome }}" != "success" ]; then
failures+=("solx-tester tests")
fi
if [ "${{ steps.solx_tester_bench_pr.outcome }}" != "success" ]; then
failures+=("solx-tester benchmarks (PR)")
fi
if [ "${{ steps.hardhat_tests.outcome }}" != "success" ]; then
failures+=("hardhat tests")
fi
if [ "${{ steps.foundry_tests.outcome }}" != "success" ]; then
failures+=("foundry tests")
fi
if [ ${#failures[@]} -ne 0 ]; then
echo "Failures: ${failures[*]}"
exit 1
fi