Compare commits

...

3 Commits

Author SHA1 Message Date
ReenigneArcher
6cf5e8a51c gcovr report directly in homebrew tests 2025-05-07 21:04:06 -04:00
ReenigneArcher
2acc57e8d6 remove --gcov-object-directory 2025-05-07 20:30:52 -04:00
ReenigneArcher
3d731a21e6 ci(homebrew): enable test coverage 2025-05-07 20:30:52 -04:00
2 changed files with 44 additions and 36 deletions

View File

@@ -535,12 +535,6 @@ jobs:
rm '/usr/local/bin/python3.13-config'
brew install python
- name: Setup python
id: python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Configure formula
run: |
# variables for formula
@@ -621,7 +615,7 @@ jobs:
- name: Validate Homebrew Formula
id: test
if: matrix.release != true
uses: LizardByte/homebrew-release-action@v2025.503.165455
uses: LizardByte/homebrew-release-action@v2025.506.15440
with:
formula_file: ${{ github.workspace }}/homebrew/sunshine.rb
git_email: ${{ secrets.GH_BOT_EMAIL }}
@@ -630,29 +624,26 @@ jobs:
token: ${{ secrets.GH_BOT_TOKEN }}
validate: true
- name: Generate gcov report
id: test_report
# any except canceled or skipped
# TODO: fix coverage, no .gcno files are being created
# TODO: .gcno files are supposed to be created next to .o files
if: false
# if: >-
# always() &&
# matrix.release != true &&
# (steps.test.outcome == 'success' || steps.test.outcome == 'failure')
- name: Debug upload gcda artifact
if: always() && matrix.release != true
uses: actions/upload-artifact@v4
with:
name: homebrew-gcda-${{ matrix.os_name }}-${{ matrix.os_version }}
path: ${{ steps.test.outputs.buildpath }}/build/tests/CMakeFiles/test_sunshine.dir/__/src/audio.cpp.gcda
- name: Debug homebrew buildpath
if: always() && matrix.release != true
run: |
cp -rf ${{ steps.test.outputs.buildpath }}/build/ ./build/
cd build
# print the build path
echo "Build path: ${{ steps.test.outputs.buildpath }}"
echo "contents:"
ls -Ra
${{ steps.python.outputs.python-path }} -m pip install gcovr
${{ steps.python.outputs.python-path }} -m gcovr . -r ../src \
--exclude-noncode-lines \
--exclude-throw-branches \
--exclude-unreachable-branches \
--verbose \
--xml-pretty \
-o coverage.xml
# print the test path
echo "----"
echo "Test path: ${{ steps.test.outputs.testpath }}"
echo "contents:"
ls -Ra
- name: Upload test results to Codecov
# any except canceled or skipped
@@ -673,18 +664,16 @@ jobs:
- name: Upload coverage
# any except canceled or skipped
# TODO: enable this once coverage report is fixed
if: false
# if: >-
# always() &&
# matrix.release != true &&
# (steps.test_report.outcome == 'success') &&
# startsWith(github.repository, 'LizardByte/')
if: >-
always() &&
matrix.release != true &&
(steps.test_report.outcome == 'success') &&
startsWith(github.repository, 'LizardByte/')
uses: codecov/codecov-action@v5
with:
disable_search: true
fail_ci_if_error: true
files: ./build/coverage.xml
files: ${{ steps.test.outputs.testpath }}/build/coverage.xml
flags: ${{ matrix.os_name }}-${{ matrix.os_version }} (Homebrew)
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
@@ -992,7 +981,9 @@ jobs:
- name: Generate gcov report
id: test_report
# any except canceled or skipped
if: always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure')
if: >-
always() &&
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
shell: msys2 {0}
working-directory: build
run: |

View File

@@ -32,6 +32,7 @@ class @PROJECT_NAME@ < Formula
depends_on "ninja" => :build
depends_on "node" => :build
depends_on "pkg-config" => :build
depends_on "gcovr" => :test
depends_on "curl"
depends_on "miniupnpc"
depends_on "openssl"
@@ -353,5 +354,21 @@ index 5b3638d..aca9481 100644
# run the test suite
system bin/"test_sunshine", "--gtest_color=yes", "--gtest_output=xml:test_results.xml"
assert_path_exists testpath/"test_results.xml"
# create gcovr report
if ENV["HOMEBREW_BUILDPATH"]
cd File.join(ENV["HOMEBREW_BUILDPATH"], "build") do
system "gcovr", ".",
"-r", "../src",
"--exclude-noncode-lines",
"--exclude-throw-branches",
"--exclude-unreachable-branches",
"--verbose",
"--xml-pretty",
"-o=coverage.xml"
end
assert_path_exists File.join(ENV["HOMEBREW_BUILDPATH"], "build", "coverage.xml")
end
end
end