-
Notifications
You must be signed in to change notification settings - Fork 43
371 lines (356 loc) · 14.6 KB
/
ci.yml
File metadata and controls
371 lines (356 loc) · 14.6 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
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
name: Build
on:
pull_request:
merge_group:
push:
branches: [main]
env:
SOLUTION: Tools/BoogieToStrata/BoogieToStrata.sln
jobs:
get-branch-name:
runs-on: ubuntu-latest
steps:
- name: Get branch name
shell: bash
# The workflow is triggered by pull_request so we use `GITHUB_BASE_REF`
run: echo "branch_name=${GITHUB_BASE_REF}" >> $GITHUB_OUTPUT
id: get_branch_name
outputs:
branch_name: ${{ steps.get_branch_name.outputs.branch_name }}
build_and_test_lean:
name: Build and test Lean
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install cvc5
shell: bash
run: |
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
ARCH_NAME="x86_64"
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
ARCH_NAME="arm64"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
wget https://github.com/cvc5/cvc5/releases/download/cvc5-1.2.1/cvc5-Linux-${ARCH_NAME}-static.zip
unzip cvc5-Linux-${ARCH_NAME}-static.zip
chmod +x cvc5-Linux-${ARCH_NAME}-static/bin/cvc5
echo "$GITHUB_WORKSPACE/cvc5-Linux-${ARCH_NAME}-static/bin/" >> $GITHUB_PATH
- name: Install z3
shell: bash
run: |
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
ARCH_NAME="x86_64"
wget https://github.com/Z3Prover/z3/releases/download/z3-4.15.2/z3-4.15.2-x64-glibc-2.39.zip
ARCHIVE_NAME="z3-4.15.2-x64-glibc-2.39"
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
ARCH_NAME="arm64"
wget https://github.com/Z3Prover/z3/releases/download/z3-4.15.2/z3-4.15.2-arm64-glibc-2.34.zip
ARCHIVE_NAME="z3-4.15.2-arm64-win"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
unzip "${ARCHIVE_NAME}.zip"
chmod +x "${ARCHIVE_NAME}/bin/z3"
echo "$GITHUB_WORKSPACE/${ARCHIVE_NAME}/bin/" >> $GITHUB_PATH
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '8.0.x'
- name: Restore lake cache
# Only use the caches on PRs because there is a risk of stale results:
# https://github.com/strata-org/Strata/issues/952
if: github.event_name == 'pull_request'
uses: actions/cache/restore@v5
with:
path: .lake
key: lake-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}-${{ hashFiles('**/*.st') }}-${{ github.sha }}
restore-keys: |
lake-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}-${{ hashFiles('**/*.st') }}
lake-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}
lake-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lean-toolchain') }}
- name: Download ion-java jar for Java codegen test
run: wget -q -O StrataTestExtra/DDM/Integration/Java/testdata/ion-java-1.11.11.jar https://github.com/amazon-ion/ion-java/releases/download/v1.11.11/ion-java-1.11.11.jar
- name: Build and test Strata
uses: leanprover/lean-action@v1
with:
use-github-cache: false
test: false
- name: Run tests (excluding Python)
run: lake test -- --exclude Languages.Python
- name: Save lake cache
uses: actions/cache/save@v5
with:
path: .lake
key: lake-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}-${{ hashFiles('**/*.st') }}-${{ github.sha }}
- name: Verify Java testdata is up to date
run: |
StrataTestExtra/DDM/Integration/Java/regenerate-testdata.sh
git diff --exit-code StrataTestExtra/DDM/Integration/Java/testdata/
- name: Verify generated editor syntax files are up to date
run: |
lake env lean --run editors/GenSyntax.lean all
git diff --exit-code editors/vscode/syntaxes/ editors/emacs/
- name: Build and run strata verify
run: lake exe strata verify Examples/SimpleProc.core.st
- name: Build BoogieToStrata
run: dotnet build -warnaserror ${SOLUTION}
- name: Test BoogieToStrata
run: dotnet test ${SOLUTION}
- name: Test Strata Command line
run: .github/scripts/testStrataCommand.sh
- name: Validate examples against expected output
working-directory: Examples
shell: bash
run: ./run_examples.sh
- uses: actions/setup-python@v6
with:
python-version: '3.14'
- name: Build using pip
run: pip install .
working-directory: Tools/Python
- name: Run pyInterpret golden-file tests
working-directory: StrataTest/Languages/Python
shell: bash
run: ./run_py_interpret.sh
- name: Run pyAnalyze SARIF tests
working-directory: StrataTest/Languages/Python
shell: bash
run: python run_py_analyze_sarif.py --laurel
- name: Run pyAnalyze golden-file tests
working-directory: StrataTest/Languages/Python
shell: bash
run: ./run_py_analyze.sh
- name: Run regex differential tests
working-directory: StrataTest/Languages/Python/Regex
run: python diff_test.py
check_pending_python:
needs: build_and_test_lean
name: Check pending Python tests
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.14'
- name: Build using pip
run: pip install .
working-directory: Tools/Python
- name: Restore Lean build cache
# The cache is safe to use here because we just saved it for this exact SHA
# in the build_and_test_lean job
# https://github.com/strata-org/Strata/issues/952
uses: actions/cache/restore@v5
with:
path: .lake
key: lake-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}-${{ hashFiles('**/*.st') }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Install Lean
uses: leanprover/lean-action@v1
with:
auto-config: false
build: false
- name: Install cvc5
shell: bash
run: |
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then ARCH_NAME="x86_64"
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then ARCH_NAME="arm64"
else echo "Unsupported architecture: $ARCH"; exit 1; fi
wget -q https://github.com/cvc5/cvc5/releases/download/cvc5-1.2.1/cvc5-Linux-${ARCH_NAME}-static.zip
unzip -q cvc5-Linux-${ARCH_NAME}-static.zip
sudo cp cvc5-Linux-${ARCH_NAME}-static/bin/cvc5 /usr/local/bin/
- name: Check pending tests for newly passing
working-directory: StrataTest/Languages/Python
shell: bash
run: ./run_py_analyze.sh --check-pending
lint_checks:
name: Run lint checks
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
toolchain:
- stable
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check copyright headers
run: python3 .github/scripts/check_copyright_headers.py .
shell: bash
- name: Check for trailing whitespace
run: .github/scripts/lintWhitespace.sh
- name: Check for import Lean
run: .github/scripts/checkLeanImport.sh
- name: Check Lean version consistncy
run: .github/scripts/check_lean_consistency.sh
- name: Check for new panic! usage
run: .github/scripts/checkNoPanic.sh "origin/${{ github.base_ref || 'main' }}"
build_doc:
name: Build documentation
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
steps:
- uses: actions/checkout@v6
- name: Build API documentation package
uses: leanprover/lean-action@v1
with:
lake-package-directory: 'docs/api'
- name: Restore lake cache
uses: actions/cache/restore@v5
with:
path: |
.lake
docs/verso/.lake
key: docs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lean-toolchain', 'docs/verso/lean-toolchain') }}-${{ hashFiles('lake-manifest.json', 'docs/verso/lake-manifest.json') }}-${{ hashFiles('**/*.st') }}-${{ github.sha }}
restore-keys: |
docs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lean-toolchain', 'docs/verso/lean-toolchain') }}-${{ hashFiles('lake-manifest.json', 'docs/verso/lake-manifest.json') }}-${{ hashFiles('**/*.st') }}
- name: Build documentation package
uses: leanprover/lean-action@v1
with:
build-args: '--wfail'
lake-package-directory: 'docs/verso'
use-github-cache: false
- name: Build documentation
run: ./generate.sh
working-directory: docs/verso
- name: Save lake cache
uses: actions/cache/save@v5
with:
path: |
.lake
docs/verso/.lake
key: docs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lean-toolchain', 'docs/verso/lean-toolchain') }}-${{ hashFiles('lake-manifest.json', 'docs/verso/lake-manifest.json') }}-${{ hashFiles('**/*.st') }}-${{ github.sha }}
- name: Check for broken links
uses: lycheeverse/lychee-action@v2
with:
args: --offline --no-progress --exclude-path '.*/find/.*' docs/verso/_out/
fail: true
build_python:
needs: build_and_test_lean
name: Build and test Python
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
python_version: [3.11, 3.12, 3.13, 3.14]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Build using pip
run: pip install .
working-directory: Tools/Python
- name: Restore Lean build cache
# The cache is safe to use here because we just saved it for this exact SHA
# in the build_and_test_lean job from ci.yml
# https://github.com/strata-org/Strata/issues/952
uses: actions/cache/restore@v5
with:
path: .lake
key: lake-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}-${{ hashFiles('**/*.st') }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Install Lean (for lake env)
uses: leanprover/lean-action@v1
with:
auto-config: false
build: false
use-github-cache: false
- name: Install cvc5
shell: bash
run: |
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
ARCH_NAME="x86_64"
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
ARCH_NAME="arm64"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
wget https://github.com/cvc5/cvc5/releases/download/cvc5-1.2.1/cvc5-Linux-${ARCH_NAME}-static.zip
unzip cvc5-Linux-${ARCH_NAME}-static.zip
chmod +x cvc5-Linux-${ARCH_NAME}-static/bin/cvc5
sudo cp cvc5-Linux-${ARCH_NAME}-static/bin/cvc5 /usr/local/bin/
- name: Install z3
shell: bash
run: |
pip install z3-solver
Z3_PATH=$(python -c "import z3; import os; print(os.path.join(os.path.dirname(z3.__file__), 'lib', 'z3'))")
sudo cp "$Z3_PATH" /usr/local/bin/z3 || true
# Fallback: install from GitHub release
if ! command -v z3 &> /dev/null; then
wget https://github.com/Z3Prover/z3/releases/download/z3-4.13.4/z3-4.13.4-x64-glibc-2.35.zip
unzip z3-4.13.4-x64-glibc-2.35.zip
sudo cp z3-4.13.4-x64-glibc-2.35/bin/z3 /usr/local/bin/
fi
- name: Run PySpec and dispatch tests
run: PYTHON=python lake test -- Languages.Python
- name: Run test script
run: FAIL_FAST=1 ./scripts/run_cpython_tests.sh ${{ matrix.python_version }}
working-directory: Tools/Python
cbmc:
needs: build_and_test_lean
permissions:
contents: read
uses: ./.github/workflows/cbmc.yml
strata-benchmarks:
name: Run internal benchmarks of Strata
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: arn:aws:iam::${{secrets.AWS_BENCHMARK_ACCOUNT}}:role/github-actions-codebuild-role
aws-region: us-east-2
- name: Trigger CodeBuild and wait
shell: bash
run: |
aws --version
BUILD_ID=$(aws codebuild start-build \
--project-name strata-benchmarks \
--source-type-override GITHUB \
--source-location-override https://github.com/strata-org/Strata.git \
--source-version ${{ github.event.pull_request.head.sha || github.sha }} \
--query 'build.id' --output text \
--region us-east-2)
echo "Build started: $BUILD_ID"
echo "CodeBuild console: https://us-east-2.console.aws.amazon.com/codesuite/codebuild/projects/strata-benchmarks/build/${BUILD_ID}/?region=us-east-2"
LOG_KEY="logs/${BUILD_ID}.log"
echo "[View build log in S3](https://s3.console.aws.amazon.com/s3/object/strata-internal-benchmarks-logs?prefix=${LOG_KEY})" >> $GITHUB_STEP_SUMMARY
while true; do
STATUS=$(aws codebuild batch-get-builds \
--ids "$BUILD_ID" \
--query 'builds[0].buildStatus' --output text \
--region us-east-2)
echo "Current status: [$STATUS]"
case "$STATUS" in
SUCCEEDED) break;;
FAILED|FAULT|TIMED_OUT|STOPPED) echo "Build failed: $STATUS" ; break ;;
IN_PROGRESS) sleep 30 ;;
*) echo "Unexpected status: $STATUS"; sleep 10 ; break ;;
esac
done
echo "View build log in S3: https://s3.console.aws.amazon.com/s3/object/strata-internal-benchmarks-logs?prefix=${LOG_KEY}"
test "$STATUS" = "SUCCEEDED"