Skip to content

Commit 9050bbe

Browse files
gcovr report directly in homebrew tests
1 parent bccfda2 commit 9050bbe

File tree

2 files changed

+28
-25
lines changed

2 files changed

+28
-25
lines changed

.github/workflows/CI.yml

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -535,12 +535,6 @@ jobs:
535535
rm '/usr/local/bin/python3.13-config'
536536
brew install python
537537
538-
- name: Setup python
539-
id: python
540-
uses: actions/setup-python@v5
541-
with:
542-
python-version: '3.11'
543-
544538
- name: Configure formula
545539
run: |
546540
# variables for formula
@@ -621,7 +615,7 @@ jobs:
621615
- name: Validate Homebrew Formula
622616
id: test
623617
if: matrix.release != true
624-
uses: LizardByte/homebrew-release-action@v2025.503.165455
618+
uses: LizardByte/homebrew-release-action@v2025.506.15440
625619
with:
626620
formula_file: ${{ github.workspace }}/homebrew/sunshine.rb
627621
git_email: ${{ secrets.GH_BOT_EMAIL }}
@@ -630,26 +624,19 @@ jobs:
630624
token: ${{ secrets.GH_BOT_TOKEN }}
631625
validate: true
632626

633-
- name: Generate gcov report
634-
id: test_report
635-
# any except canceled or skipped
636-
if: >-
637-
always() &&
638-
matrix.release != true &&
639-
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
640-
working-directory: ${{ steps.test.outputs.buildpath }}
627+
- name: Debug homebrew buildpath
628+
if: always() && matrix.release != true
641629
run: |
630+
# print the build path
631+
echo "Build path: ${{ steps.test.outputs.buildpath }}"
632+
echo "contents:"
642633
ls -Ra
643634
644-
${{ steps.python.outputs.python-path }} -m pip install gcovr
645-
${{ steps.python.outputs.python-path }} -m gcovr \
646-
--exclude-noncode-lines \
647-
--exclude-throw-branches \
648-
--exclude-unreachable-branches \
649-
--filter src/ \
650-
--verbose \
651-
--xml-pretty \
652-
-o ${{ github.workspace }}/build/coverage.xml
635+
# print the test path
636+
echo "----"
637+
echo "Test path: ${{ steps.test.outputs.testpath }}"
638+
echo "contents:"
639+
ls -Ra
653640
654641
- name: Upload test results to Codecov
655642
# any except canceled or skipped
@@ -679,7 +666,7 @@ jobs:
679666
with:
680667
disable_search: true
681668
fail_ci_if_error: true
682-
files: ./build/coverage.xml
669+
files: ${{ steps.test.outputs.testpath }}/build/coverage.xml
683670
flags: ${{ matrix.os_name }}-${{ matrix.os_version }} (Homebrew)
684671
token: ${{ secrets.CODECOV_TOKEN }}
685672
verbose: true

packaging/sunshine.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class @PROJECT_NAME@ < Formula
3232
depends_on "ninja" => :build
3333
depends_on "node" => :build
3434
depends_on "pkg-config" => :build
35+
depends_on "gcovr" => :test
3536
depends_on "curl"
3637
depends_on "miniupnpc"
3738
depends_on "openssl"
@@ -353,5 +354,20 @@ def caveats
353354
# run the test suite
354355
system bin/"test_sunshine", "--gtest_color=yes", "--gtest_output=xml:test_results.xml"
355356
assert_path_exists testpath/"test_results.xml"
357+
358+
# create gcovr report
359+
if ENV["HOMEBREW_BUILDPATH"]
360+
cd File.join(ENV["HOMEBREW_BUILDPATH"], "build") do
361+
system "gcovr", ".",
362+
"-r", "../src",
363+
"--exclude-noncode-lines",
364+
"--exclude-throw-branches",
365+
"--exclude-unreachable-branches",
366+
"--verbose",
367+
"--xml-pretty",
368+
"-o=coverage.xml"
369+
end
370+
assert_path_exists File.join(ENV["HOMEBREW_BUILDPATH"], "build", "coverage.xml")
371+
end
356372
end
357373
end

0 commit comments

Comments
 (0)