-
Notifications
You must be signed in to change notification settings - Fork 14
215 lines (184 loc) · 6.24 KB
/
run-long-tests.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
name: Build and run long ksmt tests
on:
workflow_dispatch:
inputs:
tests:
description: >
Comma separated list of tests to run from ksmt-test module.
For example: Z3BenchmarksBasedTest.testConverter, Z3BenchmarksBasedTest.testSolver
required: true
type: string
chunkSize:
description: Maximal size of a single test data chunk
required: true
type: number
default: 10000
testDataSize:
description: Size of test dataset
required: true
type: number
default: 170000
env:
TEST_DATA_REVISION: 0.2.1
jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix-tests: ${{ steps.set-tests.outputs.tests }}
matrix-chunks: ${{ steps.set-chunks.outputs.chunks }}
steps:
- id: set-chunks
name: Calculate chunk indices based on size of the dataset
run: |
LIMIT="${{ inputs.testDataSize }}"
SIZE="${{ inputs.chunkSize }}"
CHUNKS_AMOUNT=$((LIMIT / SIZE - 1))
CHUNKS="[0"
for (( i=1; i<=$CHUNKS_AMOUNT; i+=1 )); do
CHUNKS+=",$i";
done
CHUNKS+="]"
echo "chunks=$CHUNKS" >> $GITHUB_OUTPUT
- id: set-tests
name: >
Convert comma separated list to JSON array: 'a, b' -> '["a","b"]'
run: |
STR="${{ inputs.tests }}"
IFS=',' read -r -a array <<< "$STR"
ARRAY_SIZE="${#array[@]}"
TEST_ARRAY="["
if test $ARRAY_SIZE -gt 0; then
TRIM="$(echo -e "${array[0]}" | tr -d '[:space:]')"
TEST_ARRAY+="\"$TRIM\""
for (( i=1; i<$ARRAY_SIZE; i+=1 )); do
TRIM="$(echo -e "${array[i]}" | tr -d '[:space:]')"
TEST_ARRAY+=",\"$TRIM\""
done
fi
TEST_ARRAY+="]"
echo "tests=$TEST_ARRAY" >> $GITHUB_OUTPUT
prepare_test_data:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Prepare test data (cache)
id: test-data-cache
uses: actions/cache@v4
env:
cache-name: cache-test-data
with:
key: test-data-${{ env.TEST_DATA_REVISION }}-${{ matrix.os }}
path: ksmt-test/testData/testData.zip
- name: Set up JDK 1.8
if: steps.test-data-cache.outputs.cache-hit != 'true'
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
cache: gradle
- name: Setup gradle
if: steps.test-data-cache.outputs.cache-hit != 'true'
uses: gradle/actions/setup-gradle@v3
- name: Prepare test data (download)
if: steps.test-data-cache.outputs.cache-hit != 'true'
run: >
./gradlew
:ksmt-test:downloadPreparedSmtLibBenchmarkTestData
--no-daemon
'-PtestDataRevision=${{ env.TEST_DATA_REVISION }}'
run_tests:
needs: [setup, prepare_test_data]
continue-on-error: true
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
test: ${{ fromJSON(needs.setup.outputs.matrix-tests) }}
chunk: ${{ fromJSON(needs.setup.outputs.matrix-chunks) }}
name: Run ${{ matrix.test }}[${{ matrix.chunk }}] on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Prepare test data (cache)
id: test-data-cache
uses: actions/cache@v4
env:
cache-name: cache-test-data
with:
key: test-data-${{ env.TEST_DATA_REVISION }}-${{ matrix.os }}
path: ksmt-test/testData/testData.zip
- name: Check test data downloaded
if: steps.test-data-cache.outputs.cache-hit != 'true'
run: |
echo "Test data is not available"
exit 1
- name: Set up JDK 1.8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
cache: gradle
- name: Setup gradle
uses: gradle/actions/setup-gradle@v3
# Since ksmt-test/testData/testData.zip exists task will not download it again
- name: Prepare test data (unpack)
run: >
./gradlew
:ksmt-test:downloadPreparedSmtLibBenchmarkTestData
--no-daemon
'-PtestDataRevision=${{ env.TEST_DATA_REVISION }}'
# We don't want to run basic KSMT tests on each chunk
- name: Build project
if: ${{ matrix.chunk == '0' }}
run: ./gradlew build --no-daemon
- name: Run ${{ matrix.test }}
run: >
./gradlew
:ksmt-test:test --tests ${{ format('"io.ksmt.test.benchmarks.{0}"', matrix.test) }}
--no-daemon
--continue
-PrunBenchmarksBasedTests=true
-PbenchmarkChunkSize=${{ inputs.chunkSize }}
-PbenchmarkChunk=${{ matrix.chunk }}
- name: Upload ksmt test reports
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ format('ksmt-test-report-{0}-{1}-{2}', matrix.os, matrix.test, matrix.chunk) }}
path: ksmt-test/build/test-results/test/binary
merge_test_report:
name: Merge chunked test reports into a single one
needs: [ run_tests ]
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: reports
- name: Set up JDK 1.8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
- name: Setup gradle
uses: gradle/actions/setup-gradle@v3
- name: Merge test report [ubuntu-latest]
run: >
./gradlew
:ksmt-test:mergeTestReports
--no-daemon
-PtestReportMergePrefix=ksmt-test-report-ubuntu-latest
- name: Merge test report [windows-latest]
run: >
./gradlew
:ksmt-test:mergeTestReports
--no-daemon
-PtestReportMergePrefix=ksmt-test-report-windows-latest
- name: Upload merged test reports
uses: actions/upload-artifact@v4
with:
name: ksmt-test-report
path: ksmt-test-report-*