Skip to content

Commit c4264f5

Browse files
committed
ci: win tests parallelization via ctest
1 parent 9a585d7 commit c4264f5

File tree

3 files changed

+41
-74
lines changed

3 files changed

+41
-74
lines changed

.github/workflows/test.yml

Lines changed: 18 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -392,79 +392,39 @@ jobs:
392392
name: Windows tests
393393
needs: [build_windows, win_bundle, check_branch]
394394
uses: ./.github/workflows/win_test_template.yml
395-
strategy:
396-
fail-fast: false
397-
matrix:
398-
name: [1_400, 401_650, 651_and_on]
399-
include:
400-
- name: 1_400
401-
start: 1
402-
end: 400
403-
- name: 401_650
404-
start: 401
405-
end: 650
406-
- name: 651_and_on
407-
start: 651
408-
end: 999999
409395
with:
410-
CTEST_START: ${{ matrix.start }}
411-
CTEST_END: ${{ matrix.end }}
412396
COLUMNAR_LOCATOR: ${{ needs.check_branch.outputs.columnar_locator }}
413-
artifact_name: windows_test_${{ matrix.name }}
397+
artifact_name: windows_test_results
398+
results_name: "Windows test results"
414399

415-
windows_tests_report:
416-
name: Windows tests summary and report
400+
prepare_windows_test_results:
401+
name: Prepare Windows test results
417402
needs: test_windows
418403
runs-on: ubuntu-22.04
404+
continue-on-error: true
405+
defaults:
406+
run:
407+
shell: bash
419408
container:
420409
image: manticoresearch/ubertests_public:331
421410
steps:
422411
- name: Checkout repository
423412
uses: actions/checkout@v3
424-
- name: Download test report artifacts 1_400
425-
uses: manticoresoftware/download_artifact_with_retries@v3
426-
continue-on-error: true
427-
with:
428-
name: windows_test_1_400
429-
path: .
430-
- name: Download test report artifacts 401_650
413+
- name: Download build artifacts
431414
uses: manticoresoftware/download_artifact_with_retries@v3
432-
continue-on-error: true
433415
with:
434-
name: windows_test_401_650
416+
name: windows_test_results
435417
path: .
436-
- name: Download test report artifacts 651_and_on
437-
uses: manticoresoftware/download_artifact_with_retries@v3
418+
- name: Prepare test report xmls
419+
if: always()
438420
continue-on-error: true
439-
with:
440-
name: windows_test_651_and_on
441-
path: .
442-
- name: Convert the XML to JUnit format
443-
run: |
444-
shopt -s nullglob
445-
for dir in build/xml_*; do
446-
if [ -d "$dir" ] && [ -f "$dir/Test.xml" ]; then
447-
xsltproc -o "$dir/junit_tests.xml" misc/junit/ctest2junit.xsl "$dir/Test.xml"
448-
fi
449-
done
450-
shell: bash
421+
run: xsltproc -o junit_tests.xml misc/junit/ctest2junit.xsl "$(find build/Testing -name Test.xml | head -n 1)"
451422
- name: Publish test results
452-
uses: manticoresoftware/publish-unit-test-result-action@v2
453-
with:
454-
check_name: Windows test results
455-
compare_to_earlier_commit: false
456-
files: build/xml_*/junit_tests.xml
457-
comment_mode: failures
458-
- name: Per-test results
459-
# IMPORTANT: The value of 3 below should correspond to the test shard count, needs.<job_name>.strategy.job-total doesn't work
460-
run: |
461-
for file in build/status*; do echo -n "$file: "; cat "$file"; done
462-
grep -o "success" build/status* | wc -l | awk '{if ($1==3) exit 0; else {print "Found only "$1" successful runs out of 3"; exit 1}}'
463-
shell: bash
464-
- name: Upload combined artifacts
465423
if: always()
466424
continue-on-error: true
467-
uses: manticoresoftware/upload_artifact_with_retries@v4
425+
uses: manticoresoftware/publish-unit-test-result-action@v2
468426
with:
469-
name: windows_test_resuls
470-
path: build
427+
check_name: "Windows test results"
428+
files: junit*.xml
429+
compare_to_earlier_commit: false
430+
comment_mode: failures

.github/workflows/test_template.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ jobs:
126126
continue-on-error: true
127127
uses: manticoresoftware/publish-unit-test-result-action@v2
128128
with:
129-
check_name: ${{ inputs.results_name }}
129+
check_name: "${{ inputs.results_name }}"
130130
files: build/junit*.xml
131131
compare_to_earlier_commit: false
132-
comment_mode: failures
133-
132+
comment_mode: failures

.github/workflows/win_test_template.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,18 @@ on:
1414
artifact_name:
1515
required: true
1616
type: string
17+
results_name:
18+
required: true
19+
type: string
1720
COLUMNAR_LOCATOR:
1821
required: false
1922
type: string
2023
default: ""
21-
24+
UNITY_BUILD:
25+
required: false
26+
type: number
27+
default: 1
28+
2229
jobs:
2330
test_windows:
2431
name: ${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}
@@ -35,6 +42,7 @@ jobs:
3542
# CTEST_REGEX: test_234
3643
NO_BUILD: 1
3744
COLUMNAR_LOCATOR: ${{ inputs.COLUMNAR_LOCATOR }}
45+
UNITY_BUILD: ${{ inputs.UNITY_BUILD }}
3846
steps:
3947
- name: Checkout repository # We have to checkout to access .github/workflows/ in further steps
4048
uses: actions/checkout@v3
@@ -64,7 +72,7 @@ jobs:
6472
C:\PROGRA~1\MySQL\"MySQL Server 8.0"\bin\mysqld.exe --initialize-insecure
6573
C:\PROGRA~1\MySQL\"MySQL Server 8.0"\bin\mysqld.exe --install mysql
6674
net start mysql
67-
mysql -e "create user 'test'@'localhost' IDENTIFIED WITH mysql_native_password BY ''; create database test; grant all on test.* to 'test'@'localhost'; flush privileges;" -uroot
75+
mysql -e "create user 'test'@'localhost' IDENTIFIED WITH mysql_native_password BY ''; create database test; grant all on test.* to 'test'@'localhost'; create database test1; grant all on test1.* to 'test'@'localhost'; create database test2; grant all on test2.* to 'test'@'localhost'; create database test3; grant all on test3.* to 'test'@'localhost'; create database test4; grant all on test4.* to 'test'@'localhost'; create database test5; grant all on test5.* to 'test'@'localhost'; create database test6; grant all on test6.* to 'test'@'localhost'; create database test7; grant all on test7.* to 'test'@'localhost'; create database test8; grant all on test8.* to 'test'@'localhost'; create database test9; grant all on test9.* to 'test'@'localhost'; flush privileges;" -uroot
6876
# TODO: Uncomment the below if there's no more OpenSSL in the runner like it happened in Sep 2023 (https://github.com/actions/runner-images/issues/8344)
6977
# - name: Install OpenSSL
7078
# run: powershell.exe ./.github/workflows/Install-OpenSSL.ps1
@@ -77,23 +85,23 @@ jobs:
7785
id: test
7886
# --timeout may be not working https://gitlab.kitware.com/cmake/cmake/-/issues/23979
7987
# Add -VV to ctest to display extra debug info
80-
run: ctest -VV -S misc/ctest/gltest.cmake --no-compress-output --timeout 600
81-
continue-on-error: true
82-
- name: Remember status
83-
if: always()
84-
run: echo "${{ steps.test.outcome }}" > build/status_${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}
88+
run: |
89+
$env:CTEST_RESOURCE = (Resolve-Path ".\misc\ctest\ubertests\ubertests_docker_image\resource.json").Path
90+
ctest -VV -S misc/ctest/gltest.cmake --no-compress-output --timeout 600
8591
continue-on-error: true
86-
- name: Prepare test results
92+
93+
- name: Check test results
8794
if: always()
8895
run: |
89-
mkdir build/xml_${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}
90-
cp -r build/Testing/2*/*.xml build/xml_${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}/
91-
mv build/test build/test_${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}
92-
continue-on-error: true
96+
if ("${{ steps.test.outcome }}" -eq "failure") {
97+
Write-Host "❌ Tests failed ❌"
98+
exit 1
99+
}
100+
93101
- name: Upload test artifacts
94102
if: always()
95103
continue-on-error: true
96104
uses: manticoresoftware/upload_artifact_with_retries@v4
97105
with:
98106
name: ${{ inputs.artifact_name }}
99-
path: "build/xml* build/test_*/test_*/report* build/test_*/error*.txt build/test_*/*log build/status* build/test_*/*mdmp"
107+
path: "*.xml build/Testing build/xml build/junit*.xml build/test/error*.txt build/test/*log build/test/test_*/report* build/test/rt_*/report* build/test/col_*/report*"

0 commit comments

Comments
 (0)