Skip to content

Commit 8301b15

Browse files
committed
ci: create workflow
1 parent ccff880 commit 8301b15

10 files changed

Lines changed: 919 additions & 6 deletions

File tree

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Verification Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: pages
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
jobs:
19+
report:
20+
name: Build, test, and render report
21+
runs-on: ubuntu-24.04
22+
outputs:
23+
ctest_exit_code: ${{ steps.tests.outputs.exit_code }}
24+
ctest_status: ${{ steps.tests.outputs.status }}
25+
steps:
26+
- name: Check out repository
27+
uses: actions/checkout@v4
28+
with:
29+
submodules: recursive
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: "3.12"
35+
36+
- name: Install gcovr
37+
run: python -m pip install --disable-pip-version-check --no-cache-dir gcovr==7.2
38+
39+
- name: Configure GCC coverage build
40+
run: cmake --preset gcc-coverage
41+
42+
- name: Build test suite
43+
run: cmake --build --preset gcc-coverage --parallel 2
44+
45+
- name: Clear old coverage counters
46+
run: find "$GITHUB_WORKSPACE/build/gcc-coverage" -name '*.gcda' -delete
47+
48+
- name: Seed zero-count AvsCore coverage data
49+
run: "$GITHUB_WORKSPACE/build/gcc-coverage/tests/coverage/avs_coverage_inventory"
50+
51+
- name: Run CTest
52+
id: tests
53+
shell: bash
54+
run: |
55+
set +e
56+
ctest --preset gcc-coverage --output-junit "$GITHUB_WORKSPACE/build/gcc-coverage/test-results.xml"
57+
exit_code=$?
58+
set -e
59+
if [ "$exit_code" -eq 0 ]; then
60+
status=PASS
61+
else
62+
status=FAIL
63+
fi
64+
printf 'exit_code=%s\n' "$exit_code" >> "$GITHUB_OUTPUT"
65+
printf 'status=%s\n' "$status" >> "$GITHUB_OUTPUT"
66+
67+
- name: Generate full AvsCore coverage report
68+
run: |
69+
mkdir -p site/coverage site/data
70+
gcovr \
71+
--root "$GITHUB_WORKSPACE/third_party/AviSynthPlus" \
72+
--filter "$GITHUB_WORKSPACE/third_party/AviSynthPlus/avs_core/" \
73+
--html-details "$GITHUB_WORKSPACE/site/coverage/index.html" \
74+
--json-summary "$GITHUB_WORKSPACE/site/data/coverage-summary.json" \
75+
--print-summary \
76+
"$GITHUB_WORKSPACE/build/gcc-coverage"
77+
78+
- name: Render latest-result dashboard
79+
env:
80+
TEST_STATUS: ${{ steps.tests.outputs.status }}
81+
run: |
82+
upstream_sha="$(git -C third_party/AviSynthPlus rev-parse HEAD)"
83+
python tools/render_coverage_dashboard.py \
84+
--junit "$GITHUB_WORKSPACE/build/gcc-coverage/test-results.xml" \
85+
--coverage-summary "$GITHUB_WORKSPACE/site/data/coverage-summary.json" \
86+
--output-dir "$GITHUB_WORKSPACE/site" \
87+
--source-root "$GITHUB_WORKSPACE/third_party/AviSynthPlus" \
88+
--test-status "$TEST_STATUS" \
89+
--repository-sha "$GITHUB_SHA" \
90+
--upstream-sha "$upstream_sha" \
91+
--run-url "https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
92+
93+
- name: Configure GitHub Pages
94+
uses: actions/configure-pages@v5
95+
96+
- name: Upload Pages artifact
97+
uses: actions/upload-pages-artifact@v3
98+
with:
99+
path: site
100+
101+
deploy:
102+
name: Deploy latest report
103+
needs: report
104+
runs-on: ubuntu-24.04
105+
environment:
106+
name: github-pages
107+
url: ${{ steps.deployment.outputs.page_url }}
108+
steps:
109+
- name: Deploy to GitHub Pages
110+
id: deployment
111+
uses: actions/deploy-pages@v4
112+
113+
verify:
114+
name: Preserve test result
115+
needs:
116+
- report
117+
- deploy
118+
runs-on: ubuntu-24.04
119+
steps:
120+
- name: Fail after publishing a failed test run
121+
shell: bash
122+
run: |
123+
test "${{ needs.report.outputs.ctest_exit_code }}" = "0"

CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,26 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
66
set(CMAKE_CXX_EXTENSIONS OFF)
77

88
option(AVSUT_ENABLE_SANITIZERS "Enable AddressSanitizer and UBSan" OFF)
9+
option(AVSUT_ENABLE_COVERAGE "Enable GCC gcov coverage instrumentation" OFF)
10+
11+
if(AVSUT_ENABLE_SANITIZERS AND AVSUT_ENABLE_COVERAGE)
12+
message(FATAL_ERROR
13+
"AVSUT_ENABLE_SANITIZERS and AVSUT_ENABLE_COVERAGE require separate builds")
14+
endif()
15+
916
if(AVSUT_ENABLE_SANITIZERS)
1017
add_compile_options(-fsanitize=address,undefined -fno-omit-frame-pointer)
1118
add_link_options(-fsanitize=address,undefined -fno-omit-frame-pointer)
1219
endif()
1320

21+
if(AVSUT_ENABLE_COVERAGE)
22+
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
23+
message(FATAL_ERROR "AVSUT_ENABLE_COVERAGE requires GCC")
24+
endif()
25+
add_compile_options(-O0 -g --coverage)
26+
add_link_options(--coverage)
27+
endif()
28+
1429
include(FetchContent)
1530
include(CTest)
1631

@@ -31,4 +46,7 @@ FetchContent_Declare(
3146
FetchContent_MakeAvailable(googletest xxhash)
3247

3348
include(cmake/UpstreamTargets.cmake)
49+
if(AVSUT_ENABLE_COVERAGE)
50+
add_subdirectory(tests/coverage)
51+
endif()
3452
add_subdirectory(tests)

CMakePresets.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
"AVSUT_ENABLE_SANITIZERS": "ON"
4343
}
4444
},
45+
{
46+
"name": "gcc-coverage",
47+
"inherits": "gcc-debug",
48+
"binaryDir": "${sourceDir}/build/gcc-coverage",
49+
"cacheVariables": {
50+
"AVSUT_ENABLE_COVERAGE": "ON"
51+
}
52+
},
4553
{
4654
"name": "msvc-debug",
4755
"generator": "Visual Studio 18 2026",
@@ -58,6 +66,7 @@
5866
{ "name": "clang19-debug", "configurePreset": "clang19-debug" },
5967
{ "name": "clang22-debug", "configurePreset": "clang22-debug" },
6068
{ "name": "gcc-sanitize", "configurePreset": "gcc-sanitize" },
69+
{ "name": "gcc-coverage", "configurePreset": "gcc-coverage" },
6170
{
6271
"name": "msvc-debug",
6372
"configurePreset": "msvc-debug",
@@ -97,6 +106,14 @@
97106
"outputOnFailure": true
98107
}
99108
},
109+
{
110+
"name": "gcc-coverage",
111+
"configurePreset": "gcc-coverage",
112+
"output": {
113+
"shortProgress": true,
114+
"outputOnFailure": true
115+
}
116+
},
100117
{
101118
"name": "msvc-debug",
102119
"configurePreset": "msvc-debug",

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ ctest --preset gcc-debug
2121
```
2222

2323
Use `clang19-debug` or `clang22-debug` for Clang, or `gcc-sanitize` for ASan
24-
plus UBSan.
24+
plus UBSan. Use `gcc-coverage` to build the GCC gcov instrumentation profile
25+
used by the hosted source-coverage report.
2526

2627
The upstream `AvsCore` static library is built in a separate ExternalProject
2728
build tree and linked as a normal imported target. The sanitizer preset applies
@@ -41,8 +42,17 @@ ctest --preset msvc-debug
4142
The Visual Studio 2026 generator requires a CMake version that supports it
4243
(CMake 4.2 or newer).
4344

44-
Windows/MSVC is part of the supported test matrix. Continuous integration is
45-
not configured in this repository yet.
45+
Windows/MSVC is part of the supported test matrix. On pushes to `master` and
46+
manual dispatches, GitHub Actions builds the `gcc-coverage` profile, runs
47+
CTest, and publishes the latest test result plus full Linux/GCC-compiled
48+
`AvsCore` coverage report to GitHub Pages. Enable GitHub Pages with the
49+
`GitHub Actions` source in repository settings before the first deployment.
50+
51+
The coverage profile links a reporting-only inventory executable against every
52+
object in the upstream static library. This records zero-count files as well
53+
as executed files, so the report represents the full set of Linux/GCC-compiled
54+
`AvsCore` sources. It does not include platform-specific sources that the
55+
Linux upstream build does not compile.
4656

4757
## Layout
4858

cmake/UpstreamTargets.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ set(AVS_UPSTREAM_CMAKE_ARGS
2020
-DENABLE_CUDA=OFF
2121
-DENABLE_INTEL_SIMD=ON
2222
)
23+
if(AVSUT_ENABLE_COVERAGE)
24+
list(APPEND AVS_UPSTREAM_CMAKE_ARGS
25+
"-DCMAKE_C_FLAGS:STRING=-O0 -g --coverage"
26+
"-DCMAKE_CXX_FLAGS:STRING=-O0 -g --coverage"
27+
)
28+
endif()
2329
if(CMAKE_C_COMPILER)
2430
list(APPEND AVS_UPSTREAM_CMAKE_ARGS
2531
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}

memory-bank/coverage.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,25 @@ sources and test vectors.
1010

1111
| Environment | Presets | Coverage role |
1212
| --- | --- | --- |
13-
| Linux x86_64, GCC | `gcc-debug`, `gcc-sanitize` | Supported test matrix; SIMD cases run only when their runtime ISA requirements are available |
13+
| Linux x86_64, GCC | `gcc-debug`, `gcc-sanitize`, `gcc-coverage` | Supported test matrix; SIMD cases run only when their runtime ISA requirements are available. `gcc-coverage` measures the complete Linux/GCC-compiled `AvsCore` source set. |
1414
| Linux x86_64, Clang | `clang19-debug`, `clang22-debug` | Supported test matrix; SIMD cases run only when their runtime ISA requirements are available |
15-
| Windows x64, native MSVC | `msvc-debug` | Supported test matrix with the same CPU-gated SIMD behavior as GCC; continuous integration is outside the current scope |
15+
| Windows x64, native MSVC | `msvc-debug` | Supported test matrix with the same CPU-gated SIMD behavior as GCC |
16+
17+
## Hosted Coverage Reporting
18+
19+
The `gcc-coverage` preset is a GCC gcov reporting profile, separate from the
20+
sanitizer profile. It instruments both the test targets and the external
21+
`AvsCore` static-library build with `-O0 -g --coverage`. A reporting-only
22+
whole-archive inventory executable runs before CTest so every Linux/GCC-
23+
compiled `AvsCore` object produces zero-count data even when no test references
24+
it. gcovr filters the report to `avs_core/` using the AviSynthPlus submodule as
25+
the report root, so published source paths begin with `avs_core/`.
26+
27+
GitHub Actions runs this profile only for `master` pushes and manual dispatches.
28+
It publishes the latest CTest status plus line, branch, and function coverage
29+
to GitHub Pages without a coverage threshold or retained report history. A
30+
failing CTest run is published as `FAIL` before the workflow is marked failed;
31+
its coverage result can therefore be partial.
1632

1733
## Support Coverage
1834

memory-bank/project-context.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pointer or retaining a minimal production fix is an explicit, reviewed change.
2424
- Differential checks between scalar C and available SIMD implementations.
2525
- Memory-integrity checks for active pixels, row padding, and allocation guards.
2626
- Linux GCC/Clang and native Windows x64 MSVC builds, with C++17 throughout.
27+
- A master-branch GitHub Actions GCC coverage profile with a latest-result
28+
GitHub Pages report for test status and compiled `AvsCore` source coverage.
2729

2830
The test project owns its support layer and converts RAII views to the exact
2931
raw-pointer and pitch arguments expected by upstream functions at the call
@@ -32,6 +34,12 @@ boundary.
3234
## Architecture
3335

3436
- CMake and CMake Presets define configure, build, and test entry points.
37+
- The `gcc-coverage` preset instruments both the test project and the external
38+
upstream `AvsCore` build. A reporting-only whole-archive inventory executable
39+
creates zero-count data for every Linux/GCC-compiled upstream object before
40+
CTest runs.
41+
- GitHub Actions runs `gcc-coverage` on `master` pushes and manual dispatches,
42+
then publishes only the latest CTest and gcovr report through GitHub Pages.
3543
- GoogleTest `v1.17.0` is acquired with `FetchContent`.
3644
- xxHash `v0.8.3` provides explicit `XXH3_64bits`-based stable hashes.
3745
- CTest discovers individual GoogleTest cases using module prefixes.
@@ -110,7 +118,9 @@ disassembly.
110118
- `.avs` script execution, filter `Create` entry points, `Invoke` conversion
111119
orchestration, or black-box filter-graph tests.
112120
- Filter registration, full distribution, or plugin-loading tests.
113-
- Continuous-integration configuration and hosted execution.
121+
- Pull-request-triggered, scheduled, or historical hosted reporting. Hosted
122+
reporting runs only on `master` pushes and manual dispatches, and Pages keeps
123+
the latest generated report rather than a result history.
114124
- Performance benchmarks and unbounded fuzzing.
115125
- ISA-dispatch contract testing, illegal-instruction testing, or FMA-specific
116126
environment simulation.

tests/coverage/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
add_executable(avs_coverage_inventory coverage_inventory.cpp)
2+
target_link_libraries(avs_coverage_inventory PRIVATE
3+
"$<LINK_LIBRARY:WHOLE_ARCHIVE,AvsCoreExternal>"
4+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
int main() {
2+
return 0;
3+
}

0 commit comments

Comments
 (0)