Files
vectorcraft/.github/workflows/sonarcloud.yml
T
dotCooCoo 26c58af1a2 CI: run SonarCloud coverage in 8 test shards so each fits on the runner
Every test writes its own raw coverage profile in the shared SonarCloud
workflow, and at 4 shards each shard wrote about 80 GB in 8,000 files.
Since 2026-12-05 the shards of main's SonarCloud runs fail with "No
space left on device" in "Run this shard's tests" (runs 47575790406
and 47566278173), so main's nightly commit gets no analysis.

8 shards halve the raw profiles each runner holds. The shared workflow
fix is storytold/craft-common-actions#486, which merges the profiles
of one test binary as each test exits; this goes back to the default
once it merges.
2026-12-05 16:09:27 -08:00

60 lines
2.4 KiB
YAML

name: SonarCloud
# Main is analyzed once a day, at the commit the nightly builds: Stage 2 admits a nightly only on
# that commit's own analysis, and nightly-dispatch.yml waits for it before dispatching the signer.
on:
workflow_dispatch:
workflow_run:
workflows: [VectorCraft unsigned nightly]
types: [requested]
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
concurrency:
group: ${{ github.ref == 'refs/heads/main' && format('sonarcloud-main-{0}', github.sha) || format('sonarcloud-{0}', github.ref) }}
# A main run is the analysis a nightly waits for; superseded runs there would never finish.
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
nightly-commit:
name: Nightly commit is main's head
# A workflow_run checks out and analyzes main's head, so main must not have moved since the
# nightly started.
if: github.event_name == 'workflow_run'
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- name: Require main's head to be the nightly's commit
env:
NIGHTLY_SHA: ${{ github.event.workflow_run.head_sha }}
RUN_SHA: ${{ github.sha }}
run: |
if [ "$NIGHTLY_SHA" != "$RUN_SHA" ]; then
echo "::error::main moved from $NIGHTLY_SHA to $RUN_SHA after the nightly started; this run would not analyze the nightly's commit"
exit 1
fi
sonarcloud:
needs: nightly-commit
if: ${{ !cancelled() && contains(fromJSON('["success","skipped"]'), needs.nightly-commit.result) }}
# Tracked at @main so org-wide CI improvements propagate without PR churn.
# The reusable workflow defaults build-jobs to 2 so a cold instrumented
# archive stays within hosted-runner memory (craft-common-actions#333).
uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main
with:
# Each test writes its own raw coverage profile, about 80 GB per shard at 4 shards, which
# fills the runner. 8 shards halve that. Go back to the default once
# storytold/craft-common-actions#486 merges.
shards: 8
python-coverage-source: .github/scripts
python-coverage-script: .github/scripts/tests/test_release_rpm_smoke.py
secrets: inherit