From 21186df058790ae82d087bfdb5613eabdad28922 Mon Sep 17 00:00:00 2001 From: nerix Date: Sun, 21 Jul 2024 11:40:29 +0200 Subject: [PATCH] ci: collect code coverage (#5516) https://app.codecov.io/gh/Chatterino/chatterino2 --- .codecov.yml | 7 +++++++ .github/workflows/test.yml | 20 +++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..db7699448 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,7 @@ +comment: false +ignore: + - "/usr/local*/**/*" + - "/usr/include/**/*" + - "lib/" + - "**/ui_*.h" + - "**/moc_*.cpp" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 45c1a291b..c79569ff3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,10 @@ on: pull_request: workflow_dispatch: merge_group: + push: + branches: + - master + - main env: TWITCH_PUBSUB_SERVER_TAG: v1.0.7 @@ -39,11 +43,11 @@ jobs: - name: Create build directory (Ubuntu) run: mkdir build-test - - name: Install googlebench + - name: Install dependencies run: | sudo apt update - sudo apt -y install \ - libbenchmark-dev + sudo DEBIAN_FRONTEND=noninteractive apt -y --no-install-recommends install \ + libbenchmark-dev gcovr gnupg - name: Build (Ubuntu) run: | @@ -55,6 +59,8 @@ jobs: -DCMAKE_PREFIX_PATH="$Qt6_DIR/lib/cmake" \ -DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \ -DCHATTERINO_STATIC_QT_BUILD=On \ + -DCHATTERINO_GENERATE_COVERAGE=On \ + -DCMAKE_BUILD_TYPE=Debug \ .. cmake --build . working-directory: build-test @@ -84,3 +90,11 @@ jobs: cd ../build-test ctest --repeat until-pass:4 --output-on-failure --exclude-regex ClassicEmoteNameFiltering working-directory: build-test + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.5.0 + with: + token: ${{ secrets.CODECOV_TOKEN }} + plugin: gcov + fail_ci_if_error: true + verbose: true