From f99af5e4041163b467c36e347164ee29f2ac9092 Mon Sep 17 00:00:00 2001 From: harryswift01 Date: Fri, 26 Jun 2026 09:15:46 +0100 Subject: [PATCH] ci: split PR checks and main Coveralls coverage workflow --- .github/workflows/coveralls-main.yaml | 54 +++++++++++++++++++++++++++ .github/workflows/pr.yaml | 23 +++++------- 2 files changed, 64 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/coveralls-main.yaml diff --git a/.github/workflows/coveralls-main.yaml b/.github/workflows/coveralls-main.yaml new file mode 100644 index 00000000..6537127d --- /dev/null +++ b/.github/workflows/coveralls-main.yaml @@ -0,0 +1,54 @@ +name: Coveralls Main + +on: + push: + branches: [main] + + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: coveralls-main-${{ github.ref }} + cancel-in-progress: true + +jobs: + coveralls: + name: Build main coverage baseline + runs-on: ubuntu-24.04 + timeout-minutes: 30 + + permissions: + contents: read + checks: write + statuses: write + + steps: + - name: Checkout + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 + + - name: Set up Python 3.14 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 + with: + python-version: "3.14" + + - name: Install testing dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e .[testing] + + - name: Run coverage + run: | + python -m pytest tests/unit \ + --cov CodeEntropy \ + --cov-report term-missing \ + --cov-report xml \ + -q + + - name: Upload coverage to Coveralls + uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + file: coverage.xml + fail-on-error: false diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index e2269cbe..795348dc 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -2,22 +2,17 @@ name: Pull Request CI on: pull_request: - push: - branches: [main] permissions: contents: read - checks: write - pull-requests: write concurrency: - group: pr-${{ github.ref }} + group: pr-ci-${{ github.ref }} cancel-in-progress: true jobs: unit: name: Unit - if: github.event_name == 'pull_request' runs-on: ${{ matrix.os }} timeout-minutes: 25 strategy: @@ -40,12 +35,11 @@ jobs: python -m pip install --upgrade pip python -m pip install -e .[testing] - - name: Pytest (unit) • ${{ matrix.os }}, ${{ matrix.python-version }} + - name: Pytest unit • ${{ matrix.os }}, ${{ matrix.python-version }} run: python -m pytest tests/unit discover-systems: name: Discover regression systems - if: github.event_name == 'pull_request' runs-on: ubuntu-24.04 outputs: systems: ${{ steps.set-systems.outputs.systems }} @@ -68,11 +62,10 @@ jobs: id: set-systems run: | SYSTEMS=$(python -m tests.regression.list_systems) - echo "systems=$SYSTEMS" >> $GITHUB_OUTPUT + echo "systems=$SYSTEMS" >> "$GITHUB_OUTPUT" regression-quick: - name: Regression (fast) • ${{ matrix.system }} - if: github.event_name == 'pull_request' + name: Regression fast • ${{ matrix.system }} needs: discover-systems runs-on: ubuntu-24.04 timeout-minutes: 35 @@ -117,7 +110,6 @@ jobs: docs: name: Docs - if: github.event_name == 'pull_request' needs: unit runs-on: ubuntu-24.04 timeout-minutes: 25 @@ -150,7 +142,6 @@ jobs: pre-commit: name: Pre-commit - if: github.event_name == 'pull_request' needs: unit runs-on: ubuntu-24.04 timeout-minutes: 15 @@ -184,6 +175,12 @@ jobs: runs-on: ubuntu-24.04 timeout-minutes: 30 + permissions: + contents: read + checks: write + statuses: write + pull-requests: write + steps: - name: Checkout uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8