Просмотр исходного кода

Migrate Coveralls upload to the official coverallsapp/github-action

The previous `AndreMiras/coveralls-python-action` was pinned to a
2024-09-26 develop SHA and is effectively unmaintained. Switch to
`coverallsapp/github-action@v2.3.6` (SHA-pinned), which is the
Coveralls-published action and is still receiving updates.

The official action reads coverage report files directly (LCOV /
Cobertura / etc.) rather than running the Python `coveralls` package
under the hood, so the data-shape conversion has to happen explicitly.
tox.ini now runs `coverage combine` + `coverage xml` after the pytest
step in every testenv, producing a Cobertura `coverage.xml` that both
CI uploads consume and IDEs can read locally. `coverage combine` is
required because `setup.cfg` enables `parallel = True` and pytest-xdist
forks workers, so each tox run leaves multiple `.coverage.<env>.*`
data files that need merging.

`coverage.xml` was already in `.gitignore`, so this introduces no
new untracked artefacts in local checkouts.
Nuwan Goonasekera 7 часов назад
Родитель
Сommit
85f9e3a8a7
2 измененных файлов с 10 добавлено и 3 удалено
  1. 5 3
      .github/workflows/integration-cloud.yaml
  2. 5 0
      tox.ini

+ 5 - 3
.github/workflows/integration-cloud.yaml

@@ -134,13 +134,15 @@ jobs:
           message: ${{ fromJSON('["passing", "failing"]')[steps.tox.outcome != 'success'] }}
           color: ${{ fromJSON('["green", "red"]')[steps.tox.outcome != 'success'] }}
 
-      - name: Coveralls
+      - name: Upload coverage to Coveralls
         if: ${{ steps.tox.outcome == 'success' }}
-        uses: AndreMiras/coveralls-python-action@ac868b9540fad490f7ca82b8ca00480fd751ed19 # develop @ 2024-09-26
+        uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
         with:
           github-token: ${{ secrets.GITHUB_TOKEN }}
           flag-name: run-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
           parallel: true
+          file: coverage.xml
+          format: cobertura
 
   finish:
     needs: cloud
@@ -148,7 +150,7 @@ jobs:
     runs-on: ubuntu-latest
     steps:
     - name: Coveralls Finished
-      uses: AndreMiras/coveralls-python-action@ac868b9540fad490f7ca82b8ca00480fd751ed19 # develop @ 2024-09-26
+      uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
       with:
         github-token: ${{ secrets.GITHUB_TOKEN }}
         parallel-finished: true

+ 5 - 0
tox.ini

@@ -11,6 +11,11 @@ envlist = {py3.13,pypy}-{aws,azure,gcp,openstack,mock},lint
 [testenv]
 commands = # see setup.cfg for options sent to pytest and coverage
            coverage run --source=cloudbridge -m pytest -v {posargs:-n 5 tests/}
+           # Combine parallel-mode data files and emit Cobertura XML for upload
+           # by coverallsapp/github-action in CI. Locally this produces
+           # coverage.xml in the project root, which IDEs can also consume.
+           coverage combine
+           coverage xml
 setenv =
     # Fix for moto import issue: https://github.com/travis-ci/travis-ci/issues/7940
     BOTO_CONFIG=/dev/null