]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Switch to using Codecov GitHub Action.
authorNathan Moinvaziri <nathan@nathanm.com>
Sat, 12 Feb 2022 01:23:31 +0000 (17:23 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Wed, 23 Feb 2022 20:03:18 +0000 (21:03 +0100)
.github/workflows/cmake.yml
.github/workflows/pigz.yml
tools/codecov-upload.sh [deleted file]

index f45a2261c1af441ac8aee7906fb12c21832c6b66..d5d7c389e9ae4ca61f68859a12119d7d4b8fab1a 100644 (file)
@@ -432,20 +432,25 @@ jobs:
         TSAN_OPTIONS: ${{ matrix.tsan-options || 'verbosity=0' }}:abort_on_error=1
         LSAN_OPTIONS: ${{ matrix.lsan-options || 'verbosity=0' }}:abort_on_error=1
 
-    - name: Upload coverage report
-      if: matrix.codecov && ( env.CODECOV_TOKEN_SECRET != '' || github.repository == 'zlib-ng/zlib-ng' )
+    - name: Generate coverage report
+      if: matrix.codecov
       shell: bash
       run: |
-        python -u -m pip install --user codecov
-        bash tools/codecov-upload.sh
+        python3 -u -m pip install --user gcovr
+        python3 -m gcovr --gcov-executable "${{ matrix.gcov-exec || 'gcov' }}" --root ${{ matrix.build-src-dir || '.' }} --xml --output coverage.xml --verbose
+
+    - name: Upload coverage report
+      uses: codecov/codecov-action@v2
+      if: matrix.codecov && (env.CODECOV_TOKEN != '' || github.repository == 'zlib-ng/zlib-ng')
+      with:
+        token: ${{ secrets.CODECOV_TOKEN || 'e4fdf847-f541-4ab1-9d50-3d27e5913906' }}
+        flags: ${{ matrix.codecov }}
+        name: ${{ matrix.name }}
+        directory: ${{ matrix.build-src-dir || '.' }}
+        verbose: true
+        fail_ci_if_error: true
       env:
-        # Codecov does not yet support GitHub Actions
-        CODECOV_TOKEN_SECRET: "${{secrets.CODECOV_TOKEN}}"
-        CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN || 'e4fdf847-f541-4ab1-9d50-3d27e5913906' }}"
-        CODECOV_FLAGS: "${{ matrix.codecov }}"
-        CODECOV_NAME:  "${{ matrix.name }}"
-        CODECOV_EXEC:  "${{ matrix.gcov-exec || 'gcov' }}"
-        CODECOV_DIR:   "${{ matrix.build-dir || '.' }}"
+        CODECOV_TOKEN: "${{secrets.CODECOV_TOKEN}}"
 
     - name: Upload build errors
       uses: actions/upload-artifact@v2
@@ -453,7 +458,8 @@ jobs:
       with:
         name: ${{ matrix.name }} (cmake)
         path: |
-          ${{ matrix.build-dir || '.' }}/CMakeFiles/CMakeOutput.log
-          ${{ matrix.build-dir || '.' }}/CMakeFiles/CMakeError.log
-          ${{ matrix.build-dir || '.' }}/Testing/Temporary/*
+          **/CMakeFiles/CMakeOutput.log
+          **/CMakeFiles/CMakeError.log
+          **/Testing/Temporary/*
+          coverage.xml
         retention-days: 30
index c36cfafa70a402c7682cd75a4bd915b8a6c52ee1..5f4d6620017d3a64c56df48f0881b74d8016f8d3 100644 (file)
@@ -65,11 +65,6 @@ jobs:
         sudo apt-get update
         sudo apt-get install -y ${{ matrix.packages }}
 
-    - name: Install codecov.io tools
-      if: matrix.codecov
-      run: |
-        python -u -m pip install codecov
-
     - name: Generate project files
       run: |
         cd test/pigz
@@ -90,19 +85,23 @@ jobs:
         cd test/pigz
         ctest --verbose -C Release --output-on-failure --max-width 120 -j ${{ matrix.parallels-jobs || '2' }}
 
-    - name: Upload coverage report
-      if: matrix.codecov && ( env.CODECOV_TOKEN_SECRET != '' || github.repository == 'zlib-ng/zlib-ng' )
-      shell: bash
+    - name: Generate coverage report
+      if: matrix.codecov
       run: |
-        bash tools/codecov-upload.sh
+        python3 -u -m pip install --user gcovr
+        python3 -m gcovr --gcov-executable "${{ matrix.gcov-exec || 'gcov' }}" --root . --xml --output coverage.xml --verbose
+
+    - name: Upload coverage report
+      uses: codecov/codecov-action@v2
+      if: matrix.codecov && (env.CODECOV_TOKEN != '' || github.repository == 'zlib-ng/zlib-ng')
+      with:
+        token: ${{ secrets.CODECOV_TOKEN || 'e4fdf847-f541-4ab1-9d50-3d27e5913906' }}
+        flags: ${{ matrix.codecov }}
+        name: ${{ matrix.name }}
+        verbose: true
+        fail_ci_if_error: true
       env:
-        # Codecov does not yet support GitHub Actions
-        CODECOV_TOKEN_SECRET: "${{secrets.CODECOV_TOKEN}}"
-        CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN || 'e4fdf847-f541-4ab1-9d50-3d27e5913906' }}"
-        CODECOV_FLAGS: "${{ matrix.codecov }}"
-        CODECOV_NAME:  "${{ matrix.name }}"
-        CODECOV_EXEC:  "${{ matrix.gcov-exec || 'gcov' }}"
-        CODECOV_DIR:   "."
+        CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
 
     - name: Upload build errors
       uses: actions/upload-artifact@v2
@@ -113,4 +112,5 @@ jobs:
           **/CMakeFiles/CMakeOutput.log
           **/CMakeFiles/CMakeError.log
           **/Testing/Temporary/*
+          coverage.xml
         retention-days: 30
diff --git a/tools/codecov-upload.sh b/tools/codecov-upload.sh
deleted file mode 100644 (file)
index e3a48aa..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-set -ux
-cd "$CODECOV_DIR"
-python -m codecov --required --flags "$CODECOV_FLAGS" --name "$CODECOV_NAME" --gcov-exec="$CODECOV_EXEC"
-if [ $? -ne 0 ]; then
-  sleep 30
-  python -m codecov --required --flags "$CODECOV_FLAGS" --name "$CODECOV_NAME" --gcov-exec="$CODECOV_EXEC" --tries=25
-fi
-exit $?