Repository navigation
Combined unit/integration test code coverage in CI #289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -466,17 +466,19 @@ jobs: | |
|
|
||
| # ============================================================================ | ||
| # Code Coverage (Linux only) | ||
| # Runs a debug build through gcov/lcov and generates an inline action summary | ||
| # alongside an HTML report of unit test coverage. | ||
| # Runs a debug build through gcov and generates an inline action summary | ||
| # alongside an HTML report. Unit and integration tests both execute against | ||
| # that build so their .gcda data is included in the same report. | ||
| # ============================================================================ | ||
| coverage: | ||
| name: Code Coverage | ||
| if: inputs.run_coverage | ||
| runs-on: ubuntu-latest | ||
| # A debug build instrumented with --coverage is far heavier (RAM + disk) | ||
| # than the release builds. Cap the wall-clock so a stuck/OOM build fails | ||
| # fast and visibly instead of hanging toward the 6h default. | ||
| timeout-minutes: 45 | ||
| # fast and visibly instead of hanging toward the 6h default. The extra | ||
| # time beyond the build covers the integration server and test run. | ||
| timeout-minutes: 60 | ||
|
|
||
| steps: | ||
| - name: Checkout (with submodules) | ||
|
|
@@ -583,13 +585,64 @@ jobs: | |
| - name: Build | ||
| run: cmake --build build-debug --parallel 2 | ||
|
|
||
| # ---------- Run unit tests ---------- | ||
| # ---------- Run unit and integration tests ---------- | ||
| # Both binaries write .gcda for the instrumented liblivekit, so running | ||
| # them in sequence produces one combined coverage report. | ||
| - name: Run unit tests | ||
| timeout-minutes: 5 | ||
| run: | | ||
| build-debug/bin/livekit_unit_tests \ | ||
| --gtest_output=xml:build-debug/unit-test-results.xml | ||
|
|
||
| - name: Start livekit-server | ||
| if: inputs.integration_repeat > 0 | ||
| id: livekit_server | ||
| uses: livekit/dev-server-action@5d4d5337a875e2d1afd37bed03c601d159dab002 # v1.1.1 | ||
| with: | ||
| github-token: ${{ github.token }} | ||
| version: v1.13.3 | ||
| config: | | ||
| enable_participant_data_blob: true | ||
|
|
||
| - name: Install livekit-cli | ||
| if: inputs.integration_repeat > 0 | ||
| run: | | ||
| set -euxo pipefail | ||
| curl -sSL https://get.livekit.io/cli | bash | ||
| lk --version | ||
|
|
||
| - name: Start token server | ||
| if: inputs.integration_repeat > 0 | ||
| id: token_server | ||
| uses: livekit/token-server-action@a1e42c649a1998d5b224f5102f252c07762024f0 # v0.0.1 | ||
| with: | ||
| livekit-url: ws://localhost:7880 | ||
| api-key: devkey | ||
| api-secret: secret | ||
|
|
||
| - name: Run integration tests | ||
| if: inputs.integration_repeat > 0 | ||
| timeout-minutes: ${{ inputs.integration_timeout_minutes }} | ||
| env: | ||
| RUST_LOG: "metrics=debug" | ||
| LIVEKIT_CREATE_TOKEN_URL: ${{ steps.token_server.outputs.token-url }} | ||
| run: | | ||
| set -euo pipefail | ||
| source scripts/set-test-tokens.sh | ||
| # TODO(BOT-477) Temporarily disable platform audio integration tests in CI until instability is resolved | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be ?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment is old, just showing up because of the changes, it meant disable platform audio tests via the GTest arg below until it works, which there is a fix in rust-sdks for (waiting on user-contributor to resolve devin flags) |
||
| bash scripts/run-with-backtrace.sh \ | ||
| build-debug/bin/livekit_integration_tests \ | ||
| --gtest_filter='-PlatformAudioIntegrationTest.*' \ | ||
| --gtest_output=xml:build-debug/integration-test-results.xml | ||
|
alan-george-lk marked this conversation as resolved.
|
||
|
|
||
| - name: Dump livekit-server log on failure | ||
| if: failure() && steps.livekit_server.outputs.log-path != '' | ||
| run: tail -n 500 "${{ steps.livekit_server.outputs.log-path }}" || true | ||
|
|
||
| - name: Dump token server log on failure | ||
| if: failure() && steps.token_server.outputs.log-path != '' | ||
| run: tail -n 200 "${{ steps.token_server.outputs.log-path }}" || true | ||
|
|
||
| # Make resource-exhaustion failures visible instead of silent. Runs only | ||
| # if an earlier step failed (e.g. OOM during Build). | ||
| - name: Diagnostics on failure | ||
|
|
@@ -602,6 +655,7 @@ jobs: | |
|
|
||
| # ---------- Generate coverage reports ---------- | ||
| - name: Generate coverage reports | ||
| if: (success() || failure()) && hashFiles('build-debug/**/*.gcda') != '' | ||
| run: | | ||
| mkdir -p coverage-html | ||
| gcovr build-debug \ | ||
|
|
@@ -619,6 +673,7 @@ jobs: | |
| --txt coverage-summary.txt | ||
|
|
||
| - name: Add coverage summary to job | ||
| if: (success() || failure()) && hashFiles('coverage-summary.txt') != '' | ||
| run: | | ||
| { | ||
| echo '## Code Coverage Summary' | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.