From 5eaee428f74923c35a83fad9a520f478f4211dbb Mon Sep 17 00:00:00 2001 From: Anzal Date: Sat, 13 Jun 2026 11:00:53 +0200 Subject: [PATCH] ci: fix coverage badge push and update actions for Node.js 24 Badge fix: the 'Push coverage badge data' step was re-running pytest which triggered conftest.py::pytest_sessionfinish -> os._exit() before pytest-cov could write coverage.xml. With bash set -e, exit code 3 aborted the script before git push ran. Fix: read coverage data already collected by the main test run using python -m coverage report --include='*/Synaptipy/core/**'. No second pytest invocation needed. Node.js 24 (mandatory from 2026-06-16): - codecov/codecov-action v5 -> v7 - actions/github-script v7 -> v9 - softprops/action-gh-release v2 -> v3 Closes dependabot PRs: #23 (action-gh-release), #24 (github-script), #26 (codecov-action) --- .github/workflows/release.yml | 6 +++--- .github/workflows/test.yml | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 524dfe0..efe0745 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -291,7 +291,7 @@ jobs: - name: Find installer workflow run for this commit id: installer_run if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false') - uses: actions/github-script@v7 + uses: actions/github-script@v9 with: script: | const { owner, repo } = context.repo; @@ -391,14 +391,14 @@ jobs: echo "notes_file=release_notes.md" >> "$GITHUB_OUTPUT" - name: Create or update GitHub Release - # softprops/action-gh-release@v2 creates the release if it does not exist + # softprops/action-gh-release@v3 creates the release if it does not exist # and updates (appends files to) the release if it was already created by # the installer.yml workflow running in parallel. The old # "gh release delete + recreate" pattern was destructive: it wiped any # .exe / .dmg binaries that installer.yml had already attached, because # both workflows fire in parallel on the same tag push. if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false') - uses: softprops/action-gh-release@v2 + uses: softprops/action-gh-release@v3 with: tag_name: ${{ github.ref_name }} name: "${{ github.ref_name }} (${{ steps.pre.outputs.label }})" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fee0e62..ad15b2c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -112,7 +112,7 @@ jobs: # Push core test coverage badge endpoint.json to the data branch so the - name: Upload coverage to Codecov if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' - uses: codecov/codecov-action@v5 + uses: codecov/codecov-action@v7 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -127,10 +127,13 @@ jobs: continue-on-error: true # badge push is informational; must not block the build env: GITHUB_TOKEN: ${{ github.token }} - QT_QPA_PLATFORM: offscreen run: | - xvfb-run python -m pytest -p faulthandler tests/core/ -q --cov=src/Synaptipy/core --cov-report=term --cov-report=xml --cov-fail-under=0 - CORE_COVERAGE=$(python -m coverage report --format=total 2>/dev/null || echo "0") + # Read coverage collected during the main test run and filter to core/. + # Do NOT re-run pytest here: conftest.py calls os._exit() in + # pytest_sessionfinish, which kills the process before pytest-cov can + # write coverage.xml, causing set -e to abort the script before the + # badge JSON is pushed. + CORE_COVERAGE=$(python -m coverage report --include="*/Synaptipy/core/**" --format=total 2>/dev/null || echo "0") if [ "$CORE_COVERAGE" -ge 90 ]; then COLOR="brightgreen" elif [ "$CORE_COVERAGE" -ge 75 ]; then COLOR="green" elif [ "$CORE_COVERAGE" -ge 60 ]; then COLOR="yellow"