From 3be31bdd0115f7a1dc04673488da9f9e3ce3168a Mon Sep 17 00:00:00 2001 From: Alexander Piskun <13381981+bigcat88@users.noreply.github.com> Date: Mon, 5 Feb 2024 23:28:54 +0300 Subject: [PATCH] CI: coverage upload fix (#219) Signed-off-by: Alexander Piskun --- .github/.codecov.yml | 4 - .github/workflows/analysis-coverage.yml | 147 +++++++++--------------- 2 files changed, 54 insertions(+), 97 deletions(-) diff --git a/.github/.codecov.yml b/.github/.codecov.yml index a746e6f4..60c8a4f6 100644 --- a/.github/.codecov.yml +++ b/.github/.codecov.yml @@ -1,7 +1,3 @@ -codecov: - notify: - after_n_builds: 11 - comment: require_changes: true layout: "diff, files" diff --git a/.github/workflows/analysis-coverage.yml b/.github/workflows/analysis-coverage.yml index f6da46d4..9ae6afbd 100644 --- a/.github/workflows/analysis-coverage.yml +++ b/.github/workflows/analysis-coverage.yml @@ -170,25 +170,15 @@ jobs: kill -15 $(cat /tmp/_install_models.pid) timeout 3m tail --pid=$(cat /tmp/_install_models.pid) -f /dev/null cd nc_py_api - coverage combine && coverage xml && coverage html + coverage combine && coverage xml -o coverage_maria_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }}.xml - - name: HTML coverage to artifacts - uses: actions/upload-artifact@v3 + - name: Upload Codecov to artifacts + uses: actions/upload-artifact@v4 with: - name: coverage_maria_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} - path: nc_py_api/htmlcov + name: coverage_maria_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }}.xml + path: nc_py_api/coverage_maria_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }}.xml if-no-files-found: error - - name: Upload report to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - name: coverage_maria_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} - file: coverage.xml - fail_ci_if_error: true - verbose: true - working-directory: nc_py_api - - name: Upload NC logs if: always() uses: actions/upload-artifact@v3 @@ -332,25 +322,15 @@ jobs: kill -15 $(cat /tmp/_install_models.pid) timeout 3m tail --pid=$(cat /tmp/_install_models.pid) -f /dev/null cd nc_py_api - coverage combine && coverage xml && coverage html + coverage combine && coverage xml -o coverage_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }}.xml - - name: HTML coverage to artifacts - uses: actions/upload-artifact@v3 + - name: Upload Codecov to artifacts + uses: actions/upload-artifact@v4 with: - name: coverage_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} - path: nc_py_api/htmlcov + name: coverage_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }}.xml + path: nc_py_api/coverage_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }}.xml if-no-files-found: error - - name: Upload report to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - name: coverage_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} - file: coverage.xml - fail_ci_if_error: true - verbose: true - working-directory: nc_py_api - - name: Upload NC logs if: always() uses: actions/upload-artifact@v3 @@ -449,27 +429,17 @@ jobs: run: | coverage run --data-file=.coverage.ci -m pytest coverage run --data-file=.coverage.at_the_end -m pytest tests/_tests_at_the_end.py - coverage combine && coverage xml && coverage html + coverage combine && coverage xml -o coverage_oci_stable27_3.11_8.1.xml env: SKIP_NC_CLIENT_TESTS: 1 - - name: HTML coverage to artifacts - uses: actions/upload-artifact@v3 + - name: Upload Codecov to artifacts + uses: actions/upload-artifact@v4 with: - name: coverage_oci_stable27_3.11_8.1 - path: nc_py_api/htmlcov + name: coverage_oci_stable27_3.11_8.1.xml + path: nc_py_api/coverage_oci_stable27_3.11_8.1.xml if-no-files-found: error - - name: Upload report to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - name: coverage_oci_stable27_3.11_8.1 - file: coverage.xml - fail_ci_if_error: true - verbose: true - working-directory: nc_py_api - - name: Upload NC logs if: always() uses: actions/upload-artifact@v3 @@ -628,25 +598,15 @@ jobs: kill -15 $(cat /tmp/_install_models.pid) timeout 3m tail --pid=$(cat /tmp/_install_models.pid) -f /dev/null cd nc_py_api - coverage combine && coverage xml && coverage html + coverage combine && coverage xml -o coverage_maria_${{ matrix.nextcloud }}.xml - - name: HTML coverage to artifacts - uses: actions/upload-artifact@v3 + - name: Upload Codecov to artifacts + uses: actions/upload-artifact@v4 with: - name: coverage_maria_${{ matrix.nextcloud }} - path: nc_py_api/htmlcov + name: coverage_maria_${{ matrix.nextcloud }}.xml + path: nc_py_api/coverage_maria_${{ matrix.nextcloud }}.xml if-no-files-found: error - - name: Upload report to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - name: coverage_maria_${{ matrix.nextcloud }} - file: coverage.xml - fail_ci_if_error: true - verbose: true - working-directory: nc_py_api - - name: Upload NC logs if: always() uses: actions/upload-artifact@v3 @@ -809,25 +769,15 @@ jobs: kill -15 $(cat /tmp/_install_models.pid) timeout 3m tail --pid=$(cat /tmp/_install_models.pid) -f /dev/null cd nc_py_api - coverage combine && coverage xml && coverage html + coverage combine && coverage xml -o coverage_pgsql_${{ matrix.nextcloud }}.xml - - name: HTML coverage to artifacts - uses: actions/upload-artifact@v3 + - name: Upload Codecov to artifacts + uses: actions/upload-artifact@v4 with: - name: coverage_pgsql_${{ matrix.nextcloud }} - path: nc_py_api/htmlcov + name: coverage_pgsql_${{ matrix.nextcloud }}.xml + path: nc_py_api/coverage_pgsql_${{ matrix.nextcloud }}.xml if-no-files-found: error - - name: Upload report to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - name: coverage_pgsql_${{ matrix.nextcloud }} - file: coverage.xml - fail_ci_if_error: true - verbose: true - working-directory: nc_py_api - - name: Upload NC logs if: always() uses: actions/upload-artifact@v3 @@ -931,30 +881,18 @@ jobs: - name: Generate coverage report working-directory: nc_py_api - run: | - coverage run -m pytest - coverage xml && coverage html + run: coverage run -m pytest && coverage xml -o coverage_sqlite_${{ matrix.nextcloud }}_client.xml env: SKIP_AA_TESTS: 1 NPA_NC_CERT: '' - - name: HTML coverage to artifacts - uses: actions/upload-artifact@v3 + - name: Upload Codecov to artifacts + uses: actions/upload-artifact@v4 with: - name: coverage_sqlite_${{ matrix.nextcloud }} - path: nc_py_api/htmlcov + name: coverage_sqlite_${{ matrix.nextcloud }}_client.xml + path: nc_py_api/coverage_sqlite_${{ matrix.nextcloud }}_client.xml if-no-files-found: error - - name: Upload report to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - name: coverage_sqlite_${{ matrix.nextcloud }}_client - file: coverage.xml - fail_ci_if_error: true - verbose: true - working-directory: nc_py_api - - name: Upload NC logs if: always() uses: actions/upload-artifact@v3 @@ -963,11 +901,34 @@ jobs: path: data/nextcloud.log if-no-files-found: warn + tests-upload-coverage: + needs: [tests-maria, tests-pgsql, tests-stable27-oci, tests-latest-maria, test-latest-pgsql, tests-client-sqlite] + permissions: + contents: none + runs-on: ubuntu-22.04 + name: Upload Coverage + steps: + - uses: actions/checkout@v4 + - name: Download Coverage Artifacts + uses: actions/download-artifact@v4 + with: + path: coverage + pattern: coverage_* + merge-multiple: true + + - name: Upload report to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: coverage + fail_ci_if_error: true + verbose: true + tests-success: permissions: contents: none runs-on: ubuntu-22.04 - needs: [tests-maria, tests-pgsql, tests-stable27-oci, tests-latest-maria, test-latest-pgsql, tests-client-sqlite] + needs: [tests-upload-coverage] name: Tests-OK steps: - run: echo "Tests passed successfully"