Skip to content

Commit 8ca602c

Browse files
committed
Build, and test, separate coverage and release configs
1 parent f2c2f8a commit 8ca602c

File tree

1 file changed

+42
-18
lines changed

1 file changed

+42
-18
lines changed

.github/workflows/build.yaml

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -547,64 +547,88 @@ jobs:
547547
with:
548548
arch: ${{ matrix.msvcArch }}
549549
toolset: ${{ startsWith(matrix.qt, '5') && '14.29' || '' }} # MSVC 14.38+ has many deprecation issues w/ Qt5.
550-
- name: Build
550+
- name: Build w/ coverage instrumentation
551+
if: matrix.toolchain != 'msvc'
552+
env:
553+
CMAKE_MESSAGE_LOG_LEVEL: VERBOSE
554+
PROJECT_BUILD_ID: ${{ github.run_number }}.win.${{ matrix.arch }}.${{ matrix.toolchain }}.qt-${{ matrix.qt }}
555+
run: |
556+
cmake -D CMAKE_BUILD_TYPE=Release ^
557+
-D ENABLE_COVERAGE=true ^
558+
-D QT_HOST_PATH=%qtHostPath% ^
559+
-D QT_INSTALL_DOCS=%RUNNER_WORKSPACE%\Qt\Docs\Qt-${{ matrix.qt }} ^
560+
-G "${{ matrix.generator }}" -S "%GITHUB_WORKSPACE%" -B "%RUNNER_TEMP%/coverage"
561+
cmake --build "%RUNNER_TEMP%/coverage" --verbose
562+
- name: Build w/o coverage instrumentation
551563
env:
552564
CMAKE_MESSAGE_LOG_LEVEL: VERBOSE
553-
ENABLE_COVERAGE: ${{ matrix.toolchain == 'msvc' && 'false' || 'true' }}
554565
PROJECT_BUILD_ID: ${{ github.run_number }}.win.${{ matrix.arch }}.${{ matrix.toolchain }}.qt-${{ matrix.qt }}
555566
run: |
556567
cmake -D CMAKE_BUILD_TYPE=Release ^
557-
-D ENABLE_COVERAGE=%ENABLE_COVERAGE% ^
568+
-D ENABLE_COVERAGE=false ^
558569
-D QT_HOST_PATH=%qtHostPath% ^
559570
-D QT_INSTALL_DOCS=%RUNNER_WORKSPACE%\Qt\Docs\Qt-${{ matrix.qt }} ^
560-
-G "${{ matrix.generator }}" -S "%GITHUB_WORKSPACE%" -B "%RUNNER_TEMP%"
561-
cmake --build "%RUNNER_TEMP%" --verbose
571+
-G "${{ matrix.generator }}" -S "%GITHUB_WORKSPACE%" -B "%RUNNER_TEMP%/release"
572+
cmake --build "%RUNNER_TEMP%/release" --verbose
562573
- name: Capture build-output variables
563574
id: post-build
564575
shell: bash
565576
run: |
566-
echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" | tee -a "$GITHUB_OUTPUT"
577+
echo "dokitVersion=$(cat "$RUNNER_TEMP/release/version.txt")" | tee -a "$GITHUB_OUTPUT"
567578
{ echo -n 'tap='; [[ '${{ matrix.qt }}' =~ ^5\.1[2-9]|6 ]] && echo true || echo false; } |
568579
tee -a "$GITHUB_OUTPUT"
569-
- name: Install DLL for tests
580+
- name: Install DLL for tests w/ coverage
581+
if: matrix.toolchain != 'msvc'
570582
run: |
571583
copy /v /b src\lib\${{ matrix.dll }} /b test\unit\cli
572584
copy /v /b src\lib\${{ matrix.dll }} /b test\unit\lib
573-
working-directory: ${{ runner.temp }}
574-
- name: Test # We can't execute arm64 binaries on an x86-64 host.
585+
working-directory: ${{ runner.temp }}/coverage
586+
- name: Install DLL for tests w/o coverage
587+
run: |
588+
copy /v /b src\lib\${{ matrix.dll }} /b test\unit\cli
589+
copy /v /b src\lib\${{ matrix.dll }} /b test\unit\lib
590+
working-directory: ${{ runner.temp }}/release
591+
- name: Test w/ coverage # We can't execute arm64 binaries on an x86-64 host.
592+
if: matrix.arch != 'arm64' && matrix.toolchain != 'msvc'
593+
run: ctest --output-on-failure --test-dir "%RUNNER_TEMP%/coverage" --verbose
594+
- name: Test w/o coverage # We can't execute arm64 binaries on an x86-64 host.
575595
if: matrix.arch != 'arm64'
576-
run: ctest --output-on-failure --test-dir "%RUNNER_TEMP%" --verbose
596+
run: ctest --output-on-failure --test-dir "%RUNNER_TEMP%/release" --verbose
577597
- name: Collate test coverage
578598
if: matrix.toolchain != 'msvc'
579-
run: cmake --build "%RUNNER_TEMP%" --target coverage --verbose
599+
run: cmake --build "%RUNNER_TEMP%/coverage" --target coverage --verbose
580600
- name: Upload test results
581601
if: matrix.arch != 'arm64' && fromJSON(steps.post-build.outputs.tap)
582602
uses: actions/upload-artifact@v4
583603
with:
584-
name: test-results-${{ steps.post-build.outputs.dokitVersion }}
585-
path: ${{ runner.temp }}/test/**/*.tap
604+
name: wip-test-results-${{ steps.post-build.outputs.dokitVersion }} # \todo Remove wip when ready.
605+
path: |
606+
${{ runner.temp }}/coverage/coverage.info
607+
${{ runner.temp }}/coverage/removeHtmlDates.sh
608+
${{ runner.temp }}/coverage/test/**/*.tap
609+
${{ runner.temp }}/release/test/**/*.tap
586610
if-no-files-found: error
587611
- name: Make portable
588612
if: matrix.arch != 'arm64'
589-
run: cmake --build "%RUNNER_TEMP%" --target cli-portable
613+
run: cmake --build "%RUNNER_TEMP%/release" --target cli-portable
590614
- name: Check portable version
591615
if: matrix.arch != 'arm64'
592616
shell: bash
593-
run: '"$RUNNER_TEMP/portable/dokit.exe" --version'
617+
run: '"$RUNNER_TEMP/release/portable/dokit.exe" --version'
594618
- name: Upload artifacts
595619
uses: actions/upload-artifact@v4
596620
with:
597621
name: dokit-${{ steps.post-build.outputs.dokitVersion }}
598622
path: |
599-
${{ runner.temp }}/src/lib/${{ matrix.dll }}
600-
${{ runner.temp }}/src/cli/dokit.exe
623+
${{ runner.temp }}/release/src/lib/${{ matrix.dll }}
624+
${{ runner.temp }}/release/src/cli/dokit.exe
601625
if-no-files-found: error
602626
- name: Upload artifacts (portable)
603627
if: matrix.arch != 'arm64'
604628
uses: actions/upload-artifact@v4
605629
with:
606630
name: dokit-${{ steps.post-build.outputs.dokitVersion }}.portable
607-
path: ${{ runner.temp }}/portable
631+
path: ${{ runner.temp }}/release/portable
608632
if-no-files-found: error
609633

610634
collate-test-results:

0 commit comments

Comments
 (0)