From 141eccb5a18a713fe6f2542910801b2440de8cfc Mon Sep 17 00:00:00 2001 From: dgw Date: Mon, 6 Nov 2023 20:03:46 -0600 Subject: [PATCH 1/4] ci: switch to Coveralls' first-party GitHub Action Dropped `coveralls` dev-requirement in favor of using the `coverage` package directly, and upgraded it to the latest release series (7.x). The `line_bits` table in .coverage (SQLite DB of results, generated by `coverage`) isn't populated. coverallsapp/coverage-reporter tries an SQL query against the database based on this empty table, and fails because there aren't any coverage results to upload. We work around this by having `coverage xml` generate a file format that the reporter can understand. In `.coveragerc`, switched from setting the `source` option to using the `include` option instead; this fixes incorrect relative paths being reported to Coveralls (which breaks both source-fetching and the tree). --- .coveragerc | 3 ++- .github/workflows/ci.yml | 24 +++++++++++++----------- dev-requirements.txt | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.coveragerc b/.coveragerc index f23c5159b3..55e833f0c8 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,6 +1,7 @@ # Sample conf file from http://nedbatchelder.com/code/coverage/config.html [run] -source = sopel +include = + sopel/* branch = True omit = sopel/web.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8b7d05b6c..4755a48266 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,12 +41,16 @@ jobs: run: make lint - name: Run pytest run: make test_norecord + - name: Generate XML coverage report + # Coveralls reporter doesn't understand branch coverage in .coverage DB + # and conversion to LCOV doesn't work right either + run: coverage xml - name: Upload coverage data to coveralls.io - run: coveralls --service=github - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_FLAG_NAME: ${{ matrix.python-version }} - COVERALLS_PARALLEL: true + uses: coverallsapp/github-action@v2 + with: + flag-name: ${{ matrix.python-version }} + parallel: true + file: coverage.xml coveralls: if: ${{ github.repository_owner == 'sopel-irc' }} @@ -55,11 +59,9 @@ jobs: name: Finalize job on coveralls.io needs: tests runs-on: ubuntu-latest - container: python:3-slim steps: - name: Notify coveralls.io - run: | - pip install --upgrade coveralls - coveralls --finish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true + carryforward: all diff --git a/dev-requirements.txt b/dev-requirements.txt index 39c25f980e..3b6ea72d82 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,5 @@ # These are requirements to develop Sopel itself. -coveralls>=2.0 +coverage~=7.0 flake8>=5 flake8-coding flake8-future-import From 328982ac520a317774e0088650d3d9a5c7b4d311 Mon Sep 17 00:00:00 2001 From: dgw Date: Thu, 18 Apr 2024 14:29:33 -0500 Subject: [PATCH 2/4] Smoke test of coverallsapp/coverage-reporter 0.6.10 New release today is supposed to fix the issues with Python coverage parsing. We will see! --- .github/workflows/ci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4755a48266..2786421dad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,11 +41,9 @@ jobs: run: make lint - name: Run pytest run: make test_norecord - - name: Generate XML coverage report - # Coveralls reporter doesn't understand branch coverage in .coverage DB - # and conversion to LCOV doesn't work right either - run: coverage xml - - name: Upload coverage data to coveralls.io + - name: Generate coverage report + run: coverage report + - name: Upload coverage report to coveralls.io uses: coverallsapp/github-action@v2 with: flag-name: ${{ matrix.python-version }} From 9c028f6c7a9a40d14cf8a528f71f9bda60e03efb Mon Sep 17 00:00:00 2001 From: dgw Date: Thu, 18 Apr 2024 14:32:43 -0500 Subject: [PATCH 3/4] Remember not to specify a coverage file we aren't using --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2786421dad..66d159a87c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,6 @@ jobs: with: flag-name: ${{ matrix.python-version }} parallel: true - file: coverage.xml coveralls: if: ${{ github.repository_owner == 'sopel-irc' }} From 3cf95520343c630e35d9c4542fd2bc6ec7e58e0b Mon Sep 17 00:00:00 2001 From: dgw Date: Thu, 18 Apr 2024 14:51:26 -0500 Subject: [PATCH 4/4] Revert previous two commits and return to `coverage xml` output --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66d159a87c..4755a48266 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,13 +41,16 @@ jobs: run: make lint - name: Run pytest run: make test_norecord - - name: Generate coverage report - run: coverage report - - name: Upload coverage report to coveralls.io + - name: Generate XML coverage report + # Coveralls reporter doesn't understand branch coverage in .coverage DB + # and conversion to LCOV doesn't work right either + run: coverage xml + - name: Upload coverage data to coveralls.io uses: coverallsapp/github-action@v2 with: flag-name: ${{ matrix.python-version }} parallel: true + file: coverage.xml coveralls: if: ${{ github.repository_owner == 'sopel-irc' }}