Skip to content

Commit 08f8167

Browse files
committed
ci: simplify size metrics and remove broken repo-stats workflow
Replace benchmark-action/github-action-benchmark with cache-based baseline comparison for binary size tracking. On master push the metrics are cached; on PRs the baseline is restored and compared, posting a size report comment. This eliminates the gh-pages branch dependency and fixes the sparse-checkout conflict that caused persistent Size Metrics failures. Remove repo-stats.yml which used the unmaintained lowlighter/metrics action (failing 4/5 recent runs, output unused). Remove the now unreferenced ensure-branch composite action.
1 parent 3b0922c commit 08f8167

File tree

26 files changed

+330
-229
lines changed

26 files changed

+330
-229
lines changed

.github/actions/collect-artifact-sizes/action.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ runs:
3838
if (targetPlatforms.includes(run.name) &&
3939
run.status === 'completed' &&
4040
run.conclusion === 'success') {
41-
platformRuns[run.name] = run.id;
41+
const existing = platformRuns[run.name];
42+
if (!existing || new Date(run.created_at) > new Date(existing.created_at)) {
43+
platformRuns[run.name] = { id: run.id, created_at: run.created_at };
44+
}
4245
}
4346
}
4447
@@ -50,11 +53,11 @@ runs:
5053
};
5154
5255
const artifacts = [];
53-
for (const [platform, runId] of Object.entries(platformRuns)) {
56+
for (const [platform, runInfo] of Object.entries(platformRuns)) {
5457
const artifactsResponse = await github.rest.actions.listWorkflowRunArtifacts({
5558
owner: context.repo.owner,
5659
repo: context.repo.repo,
57-
run_id: runId
60+
run_id: runInfo.id
5861
});
5962
6063
for (const artifact of artifactsResponse.data.artifacts) {

.github/actions/ensure-branch/action.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/scripts/README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ Python helper scripts used by workflows and composite actions in this repository
66

77
| Script | Purpose |
88
|---|---|
9+
| `android_boot_test.py` | Android emulator boot smoke test |
910
| `benchmark_runner.py` | Run benchmark binaries and summarize output |
1011
| `coverage_comment.py` | Build coverage report comments |
1112
| `find_binary.py` | Locate produced binaries/artifacts in build trees |
1213
| `generate_build_results_comment.py` | Generate consolidated PR build-results comment |
13-
| `generate_matrix.py` | Generate workflow matrix entries from `.github/build-config.json` |
1414
| `gstreamer_archive.py` | Package GStreamer builds and optionally upload to S3 |
1515
| `install_ccache.py` | Resolve ccache config and install pinned Linux binary |
1616
| `size_analysis.py` | Analyze binary size changes |
@@ -20,10 +20,5 @@ Python helper scripts used by workflows and composite actions in this repository
2020
Run the CI script tests locally:
2121

2222
```bash
23-
pytest -q \
24-
.github/scripts/tests/test_find_binary.py \
25-
.github/scripts/tests/test_generate_matrix.py \
26-
.github/scripts/tests/test_generate_build_results_comment.py \
27-
.github/scripts/tests/test_gstreamer_archive.py \
28-
.github/scripts/tests/test_install_ccache.py
23+
pytest -q .github/scripts/tests/
2924
```

.github/scripts/coverage_comment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def main() -> None:
109109
line_delta = delta_str(baseline_cov["line"], pr_cov["line"])
110110
branch_delta = (
111111
delta_str(baseline_cov.get("branch"), pr_cov.get("branch"))
112-
if pr_cov.get("branch")
112+
if pr_cov.get("branch") is not None
113113
else "N/A"
114114
)
115115
else:

.github/scripts/generate_build_results_comment.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ def _parse_coverage_percent(path: Path) -> float | None:
2929
return None
3030
try:
3131
root = _xml_parse(path).getroot()
32+
if int(root.get("lines-valid", 0)) == 0:
33+
return None
3234
return float(root.get("line-rate", 0.0)) * 100.0
3335
except Exception:
3436
logger.debug("Failed to parse coverage from %s", path, exc_info=True)
@@ -51,7 +53,7 @@ def _parse_precommit_results(path: Path) -> tuple[str | None, str | None, str |
5153
skipped = str(data.get("skipped", "0")).strip()
5254
run_url = str(data.get("run_url", "")).strip()
5355

54-
status = "Passed" if exit_code == "0" else "Failed"
56+
status = "Passed" if exit_code == "0" else "Failed (non-blocking)"
5557
details = f"[View]({run_url})" if run_url else None
5658
note = f"Pre-commit hooks: {passed} passed, {failed or '0'} failed, {skipped or '0'} skipped."
5759
return status, details, note

.github/scripts/tests/test_coverage_comment.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,31 @@ def test_main_with_baseline_writes_delta_table(tmp_path: Path, monkeypatch: pyte
105105
text = output.read_text(encoding="utf-8")
106106
assert "| Good Lines | 80.00% | +10.00% |" in text
107107
assert "| Fair Branches | 60.00% | +10.00% |" in text
108+
109+
110+
def test_main_with_zero_branch_coverage_reports_delta(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
111+
coverage_xml = tmp_path / "coverage.xml"
112+
baseline_xml = tmp_path / "baseline.xml"
113+
output = tmp_path / "coverage-comment.md"
114+
115+
_write_xml(coverage_xml, '<coverage line-rate="0.80" branch-rate="0.00"></coverage>')
116+
_write_xml(baseline_xml, '<coverage line-rate="0.70" branch-rate="0.10"></coverage>')
117+
118+
monkeypatch.setattr(
119+
sys,
120+
"argv",
121+
[
122+
"coverage_comment.py",
123+
"--coverage-xml",
124+
str(coverage_xml),
125+
"--baseline-xml",
126+
str(baseline_xml),
127+
"--output",
128+
str(output),
129+
],
130+
)
131+
132+
main()
133+
134+
text = output.read_text(encoding="utf-8")
135+
assert "| Low Branches | 0.00% | -10.00% |" in text

.github/scripts/tests/test_generate_build_results_comment.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def test_generate_comment_precommit_artifact_overrides_status(tmp_path: Path) ->
5353

5454
out = generate_comment(env, tmp_path, now_utc=datetime(2026, 2, 17, 12, 0, 0, tzinfo=UTC))
5555

56-
assert "| pre-commit | Failed | [View](https://example.test/precommit) |" in out
56+
assert "| pre-commit | Failed (non-blocking) | [View](https://example.test/precommit) |" in out
5757
assert "Pre-commit hooks: 12 passed, 3 failed, 1 skipped." in out
5858

5959

@@ -72,10 +72,10 @@ def test_generate_comment_test_coverage_and_sizes(tmp_path: Path) -> None:
7272

7373
coverage_path = tmp_path / "artifacts" / "coverage-report" / "coverage.xml"
7474
coverage_path.parent.mkdir(parents=True)
75-
coverage_path.write_text('<coverage line-rate="0.75" />', encoding="utf-8")
75+
coverage_path.write_text('<coverage line-rate="0.75" lines-valid="100" />', encoding="utf-8")
7676

7777
baseline_coverage = tmp_path / "baseline-coverage.xml"
78-
baseline_coverage.write_text('<coverage line-rate="0.70" />', encoding="utf-8")
78+
baseline_coverage.write_text('<coverage line-rate="0.70" lines-valid="100" />', encoding="utf-8")
7979

8080
pr_sizes = tmp_path / "pr-sizes.json"
8181
pr_sizes.write_text(

.github/workflows/analysis.yml

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ jobs:
4949
with:
5050
fetch-depth: 1
5151

52-
- name: Get build config
52+
- name: Get build config (clazy/iwyu)
53+
if: contains(fromJSON('["clazy", "iwyu"]'), inputs.tool)
5354
id: config
5455
uses: ./.github/actions/build-config
5556

@@ -69,52 +70,50 @@ jobs:
6970
with:
7071
extra-packages: iwyu clang ninja-build
7172

72-
- name: Install Dependencies (sanitizers)
73-
if: contains(fromJSON('["asan", "ubsan", "tsan"]'), inputs.tool)
74-
uses: ./.github/actions/install-dependencies
75-
76-
- name: Install Qt
73+
- name: Install Qt (clazy/iwyu)
74+
if: contains(fromJSON('["clazy", "iwyu"]'), inputs.tool)
7775
uses: ./.github/actions/qt-install
7876
with:
7977
version: ${{ steps.config.outputs.qt_version }}
8078
host: linux
8179
arch: linux_gcc_64
8280
modules: ${{ steps.config.outputs.qt_modules }}
8381

84-
- name: Configure
85-
working-directory: ${{ runner.temp }}/build
86-
env:
87-
CC: ${{ inputs.tool == 'iwyu' && 'clang' || '' }}
88-
CXX: ${{ inputs.tool == 'iwyu' && 'clang++' || '' }}
89-
run: |
90-
CMAKE_ARGS=(
91-
-S "${{ github.workspace }}"
92-
-B .
93-
-G Ninja
94-
-DCMAKE_BUILD_TYPE=Debug
82+
- name: Build Setup (sanitizers)
83+
if: contains(fromJSON('["asan", "ubsan", "tsan"]'), inputs.tool)
84+
uses: ./.github/actions/build-setup
85+
with:
86+
qt-host: linux
87+
qt-arch: linux_gcc_64
88+
build-type: Debug
89+
save-cache: false
90+
91+
- name: Install Dependencies (sanitizers)
92+
if: contains(fromJSON('["asan", "ubsan", "tsan"]'), inputs.tool)
93+
uses: ./.github/actions/install-dependencies
94+
95+
- name: Configure (clazy/iwyu)
96+
if: contains(fromJSON('["clazy", "iwyu"]'), inputs.tool)
97+
uses: ./.github/actions/cmake-configure
98+
with:
99+
build-dir: ${{ runner.temp }}/build
100+
build-type: Debug
101+
extra-args: >-
95102
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
96-
)
97-
98-
if [[ "${{ contains(fromJSON('["asan", "ubsan", "tsan"]'), inputs.tool) }}" == "true" ]]; then
99-
CMAKE_ARGS+=(
100-
-DQGC_BUILD_TESTING=ON
101-
-DQGC_ENABLE_COVERAGE=OFF
102-
)
103-
104-
case "${{ inputs.tool }}" in
105-
asan)
106-
CMAKE_ARGS+=(-DQGC_ENABLE_ASAN=ON)
107-
;;
108-
ubsan)
109-
CMAKE_ARGS+=(-DQGC_ENABLE_UBSAN=ON)
110-
;;
111-
tsan)
112-
CMAKE_ARGS+=(-DQGC_ENABLE_TSAN=ON)
113-
;;
114-
esac
115-
fi
103+
${{ inputs.tool == 'iwyu' && '-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++' || '' }}
116104
117-
"${QT_ROOT_DIR}/bin/qt-cmake" "${CMAKE_ARGS[@]}"
105+
- name: Configure (sanitizers)
106+
if: contains(fromJSON('["asan", "ubsan", "tsan"]'), inputs.tool)
107+
uses: ./.github/actions/cmake-configure
108+
with:
109+
build-dir: ${{ runner.temp }}/build
110+
build-type: Debug
111+
testing: 'true'
112+
extra-args: >-
113+
-DQGC_ENABLE_COVERAGE=OFF
114+
${{ inputs.tool == 'asan' && '-DQGC_ENABLE_ASAN=ON' || '' }}
115+
${{ inputs.tool == 'ubsan' && '-DQGC_ENABLE_UBSAN=ON' || '' }}
116+
${{ inputs.tool == 'tsan' && '-DQGC_ENABLE_TSAN=ON' || '' }}
118117
119118
- name: Build (sanitizers only)
120119
if: contains(fromJSON('["asan", "ubsan", "tsan"]'), inputs.tool)
@@ -188,14 +187,14 @@ jobs:
188187
env:
189188
ASAN_OPTIONS: ${{ inputs.tool == 'asan' && 'detect_leaks=1:halt_on_error=1:check_initialization_order=1' || '' }}
190189
LSAN_OPTIONS: ${{ inputs.tool == 'asan' && format('suppressions={0}/build/asan_suppressions.txt', runner.temp) || '' }}
191-
UBSAN_OPTIONS: ${{ inputs.tool == 'ubsan' && 'print_stacktrace=1:halt_on_error=1' || '' }}
190+
UBSAN_OPTIONS: ${{ inputs.tool == 'ubsan' && format('print_stacktrace=1:halt_on_error=1:suppressions={0}/build/ubsan_suppressions.txt', runner.temp) || '' }}
192191
TSAN_OPTIONS: ${{ inputs.tool == 'tsan' && format('second_deadlock_stack=1:halt_on_error=1:suppressions={0}/build/tsan_suppressions.txt', runner.temp) || '' }}
193192
with:
194193
build-dir: ${{ runner.temp }}/build
195194
junit-output: junit-results-analysis-${{ inputs.tool }}.xml
196195
ctest-output: sanitizer-output.txt
197196
include-labels: 'Unit|Integration'
198-
exclude-labels: 'Flaky|Network'
197+
exclude-labels: 'Flaky|Network|NoSanitizer'
199198
parallel: '1'
200199

201200
- name: Upload Output

.github/workflows/android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ jobs:
165165
-DQT_ANDROID_ABIS=${{ env.QT_ANDROID_ABIS }}
166166
-DQT_HOST_PATH=${{ env.QT_ROOT_DIR }}/../${{ matrix.qt_host_path }}
167167
-DQT_ANDROID_SIGN_APK=ON
168-
${{ matrix.emulator && '-DQT_ANDROID_APPLICATION_ARGUMENTS=--simple-boot-test' || '' }}
168+
${{ matrix.emulator && '-DQT_ANDROID_APPLICATION_ARGUMENTS="--simple-boot-test"' || '' }}
169169
170170
- name: Build
171171
uses: ./.github/actions/cmake-build

.github/workflows/crowdin.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ jobs:
3131
upload:
3232
name: Upload Sources
3333
if: >-
34-
github.event_name == 'push' ||
35-
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) ||
36-
(github.event_name == 'workflow_dispatch' && inputs.action == 'upload')
34+
github.repository_owner == 'mavlink' &&
35+
(
36+
github.event_name == 'push' ||
37+
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) ||
38+
(github.event_name == 'workflow_dispatch' && inputs.action == 'upload')
39+
)
3740
runs-on: ubuntu-latest
3841
timeout-minutes: 15
3942
permissions:
@@ -64,8 +67,11 @@ jobs:
6467
download:
6568
name: Download Translations
6669
if: >-
67-
github.event_name == 'schedule' ||
68-
(github.event_name == 'workflow_dispatch' && inputs.action == 'download')
70+
github.repository_owner == 'mavlink' &&
71+
(
72+
github.event_name == 'schedule' ||
73+
(github.event_name == 'workflow_dispatch' && inputs.action == 'download')
74+
)
6975
runs-on: ubuntu-latest
7076
timeout-minutes: 15
7177
permissions:

0 commit comments

Comments
 (0)