-
Notifications
You must be signed in to change notification settings - Fork 16
299 lines (269 loc) · 10.9 KB
/
test.yaml
File metadata and controls
299 lines (269 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
name: Tests
# Execute workflow for each PR and with each merge to the trunk
on:
pull_request:
types: [opened, synchronize, reopened]
merge_group:
push:
branches:
- main
permissions:
contents: read
packages: 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
jobs:
# Detect whether code (non-doc) files changed
changes:
runs-on: ubuntu-24.04
permissions:
contents: read
pull-requests: read
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter
with:
predicate-quantifier: 'every'
filters: |
code:
- '**'
- '!docs/**'
- '!**/*.md'
- '!**/*.mdx'
- '!**/LICENSE*'
# Check for cargo issues
cargo-checks:
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-24.04
container:
image: ghcr.io/nomicfoundation/solx-ci-runner@sha256:c2b03000a1074d2cc3e6cf25a1c4fdc6eb0a61d23e63bef59205050249fa1d6e
# Host tooling bind-mounted so the free-disk-space action can reclaim
# ~24 GB before the cold LLVM build fills the runner's 14 GB budget.
# Anchor shared with build-and-test below; keep in sync with the
# matching list in cache-warmup.yaml.
volumes: &free-disk-volumes
- /usr/share/dotnet:/mnt/free-disk-space/dotnet
- /usr/local/lib/android:/mnt/free-disk-space/android
- /opt/ghc:/mnt/free-disk-space/ghc
- /usr/local/.ghcup:/mnt/free-disk-space/ghcup
- /opt/hostedtoolcache/CodeQL:/mnt/free-disk-space/codeql
steps:
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
- name: Free disk space
uses: ./.github/actions/free-disk-space
# This step is required to checkout submodules
# that are disabled in .gitmodules config
- name: Checkout submodules
run: |
git config --global --add safe.directory '*'
git submodule update --force --depth=1 --recursive --checkout
- name: Setup SFW
uses: ./.github/actions/setup-sfw
- name: Build LLVM
uses: ./.github/actions/build-llvm
with:
build-type: RelWithDebInfo
enable-assertions: 'true'
enable-mlir: 'true'
- name: Cargo checks
uses: ./.github/actions/cargo-check
cooldown-check:
name: Cargo cooldown check
runs-on: ubuntu-24.04
needs: changes
if: needs.changes.outputs.code == 'true'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: ./.github/actions/cooldown-check
# Build and run regression tests
build-and-test:
needs: changes
if: needs.changes.outputs.code == 'true'
env:
CARGO_INCREMENTAL: "0"
permissions:
contents: read
checks: write
packages: read
strategy:
fail-fast: false # finalize testing of all targets even if one failed
matrix:
include:
- name: "MacOS x86"
runner: macos-15-intel
- name: "MacOS arm64"
runner: macos-15
- name: "Linux x86 gnu"
runner: ubuntu-24.04
image: ghcr.io/nomicfoundation/solx-ci-runner@sha256:c2b03000a1074d2cc3e6cf25a1c4fdc6eb0a61d23e63bef59205050249fa1d6e
target: "x86_64-unknown-linux-gnu"
- name: "Linux ARM64 gnu"
runner: ubuntu-24.04-arm
image: ghcr.io/nomicfoundation/solx-ci-runner@sha256:c2b03000a1074d2cc3e6cf25a1c4fdc6eb0a61d23e63bef59205050249fa1d6e
target: "aarch64-unknown-linux-gnu"
- name: "Windows"
runner: windows-2025
target: "x86_64-pc-windows-gnu"
runs-on: ${{ matrix.runner }}
container:
image: ${{ matrix.image || '' }} # Special workaround to allow matrix builds with optional container
# Host tooling bind-mounts for the free-disk-space action. These apply
# only when a container is started (matrix legs with `image:` set); the
# macOS/Windows legs run bare and the paths are irrelevant there.
volumes: *free-disk-volumes
name: ${{ matrix.name }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
persist-credentials: false
# Only meaningful on containerized Linux legs (the hosted x86 leg is the
# disk-constrained one); a no-op on macOS/Windows since the mount points
# don't exist there.
- name: Free disk space
if: runner.os == 'Linux' && matrix.image != ''
uses: ./.github/actions/free-disk-space
# This step is required to checkout submodules
# that are disabled in .gitmodules config
- name: Checkout submodules
run: |
git config --global --add safe.directory '*'
git submodule update --force --depth=1 --recursive --checkout
- name: Setup SFW
uses: ./.github/actions/setup-sfw
- name: Prepare Windows env
if: runner.os == 'Windows'
uses: ./.github/actions/prepare-msys
- name: Free disk space (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
set -euo pipefail
echo "=== Before macOS cleanup ===" && df -h .
# 1. Simulator runtimes — stored on read-only APFS snapshot volumes,
# so plain `rm` fails. `simctl runtime delete all` unmounts them.
# May warn on already-deleted runtimes; that is harmless.
echo "--- Removing simulator runtimes ---"
xcrun simctl delete all 2>&1 || true
xcrun simctl runtime delete all 2>&1 || true
# 2. Xcode — remove every versioned copy EXCEPT the one that
# xcode-select points to (we need its toolchain for C/C++ builds).
# Active Xcode path looks like /Applications/Xcode_16.2.app/Contents/Developer.
echo "--- Removing inactive Xcode versions ---"
ACTIVE_XCODE="$(xcode-select -p 2>/dev/null | sed 's|/Contents/Developer/*$||' || true)"
ACTIVE_XCODE="${ACTIVE_XCODE%/}"
removed=0
if [ -z "${ACTIVE_XCODE}" ] || [[ "${ACTIVE_XCODE}" != /Applications/Xcode*.app ]]; then
echo " warning: active Xcode path '${ACTIVE_XCODE}' is not an Xcode app; skipping Xcode removal"
else
echo "Active Xcode (keeping): ${ACTIVE_XCODE}"
to_remove=()
for app in /Applications/Xcode_*.app; do
[ -d "$app" ] || continue
if [ "$app" = "$ACTIVE_XCODE" ]; then
echo " skip (active): $app"
else
echo " removing: $app"
to_remove+=("$app")
fi
done
# Each Xcode bundle is ~15 GB of small files; `rm -rf` is I/O-bound
# per inode, so run them concurrently (one worker per bundle).
# Soft-fail: a stray rm error shouldn't sink the whole job — rm's
# stderr will pinpoint the bad path above.
#
# `removed` reflects the attempt count, not per-bundle success:
# xargs returns non-zero if *any* child failed, so gating the
# count on xargs success would print "Removed 0" even after
# ~30 GB was freed. The count is off by the number of failed
# bundles — usually one in practice — which is still a much
# better signal than zero.
if [ "${#to_remove[@]}" -gt 0 ]; then
removed=${#to_remove[@]}
if ! printf '%s\0' "${to_remove[@]}" \
| xargs -0 -n1 -P "${#to_remove[@]}" sudo rm -rf; then
echo " warning: one or more Xcode removals failed (see rm stderr above)"
fi
fi
fi
echo "Removed ${removed} inactive Xcode version(s)"
# 3. Remaining large packages that this project never uses.
# Each path is removed individually so a missing path doesn't
# mask a real permission error on another.
echo "--- Removing unused SDKs and caches ---"
for dir in \
/Library/Developer/CoreSimulator \
/usr/local/lib/android \
"${RUNNER_TOOL_CACHE:-/Users/runner/hostedtoolcache}"; do
if [ -d "$dir" ]; then
echo " removing: $dir"
sudo rm -rf "$dir" || echo " warning: failed to remove $dir"
else
echo " not found (skipped): $dir"
fi
done
echo "=== After macOS cleanup ===" && df -h .
- name: Cache cargo artifacts
if: ${{ !matrix.image }}
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
prefix-key: build-and-test-v2
cache-on-failure: true
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Build LLVM
uses: ./.github/actions/build-llvm
with:
build-type: RelWithDebInfo
enable-assertions: 'true'
enable-mlir: 'true'
- name: Building solc
uses: ./.github/actions/build-solc
with:
cmake-build-type: RelWithDebInfo
working-dir: 'solx-solidity'
- name: Free disk space (remove LLVM source and build artifacts)
shell: bash
run: |
echo "Before cleanup:" && df -h .
rm -rf solx-llvm target-llvm/build-final
# Remove solx-solidity source, keeping build/ and boost/ for tests
find solx-solidity -mindepth 1 -maxdepth 1 ! -name build ! -name boost -exec rm -rf {} +
rm -rf .git/modules
echo "After cleanup:" && df -h .
- name: Run tests
uses: ./.github/actions/rust-unit-tests
env:
BOOST_PREFIX: ${{ github.workspace }}/solx-solidity/boost/lib
SOLC_PREFIX: ${{ github.workspace }}/solx-solidity/build
with:
target: ${{ matrix.target || '' }}
# Special job that allows some of the jobs to be skipped or failed
# requiring others to be successful
pr-checks:
name: PR Checks (Tests)
runs-on: ubuntu-24.04
if: always()
needs:
- changes
- cargo-checks
- build-and-test
- cooldown-check
steps:
- name: Decide on PR checks
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1
with:
jobs: ${{ toJSON(needs) }}
allowed-skips: >-
${{ needs.changes.outputs.code != 'true' && 'cargo-checks, build-and-test, cooldown-check' || '' }}