-
Notifications
You must be signed in to change notification settings - Fork 109
375 lines (357 loc) · 12.7 KB
/
test.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
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
name: Test
on:
push:
branches: 'master'
paths-ignore: 'docs/**'
pull_request:
branches: 'master'
paths-ignore: 'docs/**'
# Cancel previous runs in a PR when pushing new commits
concurrency:
group: worflow-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# Do not cancel when testing the master branch
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
env:
RUST_BACKTRACE: 1
PRUSTI_ASSERT_TIMEOUT: 60000
jobs:
# Check formatting
fmt-check:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Check formatting
run: |
rustup component add rustfmt
python ./x.py fmt-check-all
# Run clippy checks
clippy-check:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '15'
distribution: 'zulu'
- name: Set up the environment
run: python x.py setup
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "shared"
- name: Check and report Clippy errors
run: |
python ./x.py clippy-all
# Detect missing dependencies in workspace packages
# See: https://stackoverflow.com/a/74293494/2491528
check-deps:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '15'
distribution: 'zulu'
- name: Set up the environment
run: python x.py setup
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "shared"
- name: Compile each workspace package individually
run: |
cargo install cargo-hack
python ./x.py hack build --workspace
# Check that we depend on the compiler only through SMIR.
smir-check:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Check and report illegal extern crate.
run: |
python ./x.py check-smir
# Run a subset of the tests that used to fail often.
# The goal here is to fail fast and give quick feedback to the developers.
# This job intentionally doesn't use the verification cache.
quick-tests:
runs-on: ubuntu-latest
env:
PRUSTI_CACHE_PATH: ${{ github.workspace }}/prusti_cache.bin
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '15'
distribution: 'zulu'
- name: Set up the environment
run: python x.py setup
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "shared"
- name: Build with cargo
run: python x.py build --all
- name: Run quick tests
run: python x.py test --all quick
# Run a subset of the tests with the purification optimization enabled
# to ensure that we do not introduce regressions.
purification-tests:
needs: [fmt-check, clippy-check, check-deps, smir-check, quick-tests]
runs-on: ubuntu-latest
env:
PRUSTI_ENABLE_PURIFICATION_OPTIMIZATION: true
PRUSTI_CACHE_PATH: ${{ github.workspace }}/prusti_cache.bin
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '15'
distribution: 'zulu'
- name: Set up the environment
run: python x.py setup
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "shared"
- name: Prepare verification cache keys
shell: bash
run: |
VER_CACHE_KEY_SHARED=prusti-cache-$(cat viper-toolchain)-$(date +%Y-%m)
echo "VER_CACHE_KEY_SHARED=$VER_CACHE_KEY_SHARED" >> $GITHUB_ENV
echo "VER_CACHE_KEY_UNIQUE=$VER_CACHE_KEY_SHARED-${RANDOM}${RANDOM}" >> $GITHUB_ENV
- name: Load verification cache
uses: actions/cache@v3
with:
path: ${{ env.PRUSTI_CACHE_PATH }}
# Use a unique key, so that the job will always store the cache at the end of the run
key: ${{ env.VER_CACHE_KEY_UNIQUE }}
# Restore from the most recent cache that matches a shared prefix of the key
restore-keys: ${{ env.VER_CACHE_KEY_SHARED }}
- name: Build with cargo
run: python x.py build --all
- name: Run quick tests
run: |
python x.py verify-test prusti-tests/tests/verify/pass/rosetta/Knuth_shuffle.rs
# python x.py test --all pass/rosetta/Binary_search_shared.rs
# python x.py test --all pass/demos/account.rs
# python x.py test --all pass/rosetta/Knights_tour.rs
# python x.py test --all pass/quick/fold-unfold.rs
# python x.py test --all pass/quick/moves.rs
# python x.py test --all pass/quick/mut-borrows.rs
# python x.py test --all pass/quick/shared-borrows.rs
# python x.py test --all pass/quick/trait-contracts-refinement.rs
# python x.py test --all pass/quick/fibonacci.rs
# python x.py test --all pass/pure-fn/len-lookup.rs
# python x.py test --all pass/pure-fn/quantifiers.rs
# python x.py test --all pass/pure-fn/recursive-pure-fn.rs
# python x.py test --all pass/pure-fn/ref-mut-arg.rs
# python x.py test --all pass/rosetta/Ackermann_function.rs
# python x.py test --all pass/rosetta/Heapsort.rs
- name: Run with purification.
env:
PRUSTI_VIPER_BACKEND: silicon
PRUSTI_VERIFY_SPECIFICATIONS_BACKEND: silicon
PRUSTI_VERIFY_CORE_PROOF: true
PRUSTI_VERIFY_SPECIFICATIONS: true
PRUSTI_VERIFY_SPECIFICATIONS_WITH_CORE_PROOF: false
PRUSTI_INLINE_CALLER_FOR: false
run: |
python x.py test core_proof
- name: Run with purification with Carbon.
env:
PRUSTI_VIPER_BACKEND: silicon
PRUSTI_VERIFY_SPECIFICATIONS_BACKEND: carbon
PRUSTI_VERIFY_CORE_PROOF: true
PRUSTI_VERIFY_SPECIFICATIONS: true
PRUSTI_VERIFY_SPECIFICATIONS_WITH_CORE_PROOF: false
PRUSTI_INLINE_CALLER_FOR: false
run: |
python x.py test core_proof
- name: Run without purification.
env:
PRUSTI_VIPER_BACKEND: silicon
PRUSTI_VERIFY_SPECIFICATIONS_BACKEND: silicon
PRUSTI_VERIFY_CORE_PROOF: true
PRUSTI_VERIFY_SPECIFICATIONS: true
PRUSTI_VERIFY_SPECIFICATIONS_WITH_CORE_PROOF: true
PRUSTI_INLINE_CALLER_FOR: false
run: |
python x.py test core_proof
- name: Inline caller for functions
env:
PRUSTI_VIPER_BACKEND: silicon
PRUSTI_VERIFY_SPECIFICATIONS_BACKEND: silicon
PRUSTI_VERIFY_CORE_PROOF: true
PRUSTI_VERIFY_SPECIFICATIONS: true
PRUSTI_VERIFY_SPECIFICATIONS_WITH_CORE_PROOF: false
PRUSTI_INLINE_CALLER_FOR: true
run: |
python x.py test core_proof
# Run all the tests.
all-tests:
needs: [fmt-check, clippy-check, check-deps, smir-check, quick-tests]
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
PRUSTI_CACHE_PATH: ${{ github.workspace }}/prusti_cache.bin
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '15'
distribution: 'zulu'
- name: Set up the environment
run: python x.py setup
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "shared"
- name: Prepare verification cache keys
shell: bash
run: |
VER_CACHE_KEY_SHARED=prusti-cache-$(cat viper-toolchain)-$(date +%Y-%m)
echo "VER_CACHE_KEY_SHARED=$VER_CACHE_KEY_SHARED" >> $GITHUB_ENV
echo "VER_CACHE_KEY_UNIQUE=$VER_CACHE_KEY_SHARED-${RANDOM}${RANDOM}" >> $GITHUB_ENV
- name: Load verification cache
uses: actions/cache@v3
with:
path: ${{ env.PRUSTI_CACHE_PATH }}
# Use a unique key, so that the job will always store the cache at the end of the run
key: ${{ env.VER_CACHE_KEY_UNIQUE }}
# Restore from the most recent cache that matches a shared prefix of the key
restore-keys: ${{ env.VER_CACHE_KEY_SHARED }}
- name: Build with cargo
run: python x.py build --all --jobs 1
- name: Run cargo tests
run: python x.py test --all --jobs 1
- name: Run a subset of tests with Carbon
run: |
python x.py test pass/no-annotation --all --verbose
env:
PRUSTI_VIPER_BACKEND: carbon
- name: Check prusti-contracts
run: |
cd prusti-contracts/prusti-contracts-test/
cargo +stable build
- name: "Windows debugging: show open file handles for any running process"
if: matrix.os == 'windows-latest' && failure()
shell: cmd
run: |
C:\msys64\usr\bin\wget.exe https://download.sysinternals.com/files/Handle.zip
7z x Handle.zip
handle.exe -u -nobanner -accepteula
release-build:
needs: [fmt-check, clippy-check, check-deps, smir-check, quick-tests]
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '15'
distribution: 'zulu'
- name: Set up the environment
run: python x.py setup
- name: Build with cargo --release
run: python x.py build --release
# Run Prusti on itself.
# Disabled because of a bug when compiling jni-gen
test-on-prusti:
needs: [fmt-check, clippy-check, check-deps, smir-check, quick-tests]
runs-on: ubuntu-latest
if: false
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '15'
distribution: 'zulu'
- name: Set up the environment
run: python x.py setup
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "shared"
- name: Build with cargo
run: python x.py build --release --all
- name: Run cargo-prusti on Prusti
run: python x.py exec target/release/cargo-prusti
env:
PRUSTI_SKIP_UNSUPPORTED_FEATURES: true
PRUSTI_FULL_COMPILATION: true
PRUSTI_CHECK_PANICS: false
PRUSTI_CHECK_OVERFLOWS: false
PRUSTI_INTERNAL_ERRORS_AS_WARNINGS: true
# Test cargo-prusti on a collection of crates.
test-crates:
needs: [fmt-check, clippy-check, check-deps, smir-check, quick-tests]
runs-on: ubuntu-22.04
strategy:
matrix:
shard_index: [0, 1, 2, 3]
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Setup Python 3
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '15'
distribution: 'zulu'
- name: Set up the environment
run: python x.py setup
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "shared"
- name: Build with cargo --release
run: |
python x.py build --release -p prusti
python x.py build --release -p prusti-launch
python x.py build --release -p test-crates
- name: Test Prusti on a collection of crates
run: ./target/release/test-crates --fail-fast --num-shards=4 --shard-index=${{ matrix.shard_index }}
# Dummy job to specify the jobs that must pass before merging on master
can-merge:
runs-on: ubuntu-latest
needs: [all-tests, purification-tests, release-build, test-crates]
# Always run, even if the workflow was cancelled
if: ${{ always() }}
steps:
- name: Fail if the workflow failed or was cancelled
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}