Professionalize the C++ exercise repository#28
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR professionalizes the C++ examples repository by standardizing local developer commands, hardening/expanding CI (sanitizers + coverage + PR coverage comments), and adding contributor-facing repository documentation and housekeeping files.
Changes:
- Introduces a consistent top-level
makeinterface (build/test/format/lint/coverage/check), sanitizer-aware clean builds, and aggregate coverage reporting/gates. - Expands GitHub Actions into dedicated sanitizer and coverage jobs, plus a separate
workflow_run-based coverage comment workflow with pinned action SHAs. - Updates examples and docs: propagates shared linker flags in example Makefiles, fixes escaped newline output in examples, replaces
bcwith strictawkvalidation in Pi tests, and adds repo policy docs/templates.
Reviewed changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Makefile | Adds top-level build/test/lint/coverage/check targets, WSL-aware sanitizer matrix defaults, and aggregate coverage generation via gcovr. |
| common.mk | Adds COVERAGE switch for --coverage flags and makes UBSan fail-fast with -fno-sanitize-recover=undefined. |
| .github/workflows/ci.yml | Splits CI into ASan/UBSan, dedicated TSan (with instrumented oneTBB), and coverage jobs; pins actions by SHA. |
| .github/workflows/coverage-comment.yml | Adds isolated workflow_run workflow to post/update PR coverage summary comments from artifacts. |
| .gitignore | Ignores additional build/coverage artifacts (deps, gcov outputs, binaries, coverage directory). |
| .gitattributes | Enforces LF EOL normalization across common source/config file types. |
| README.md | Expands documentation for prerequisites, commands, sanitizers (incl. WSL2 notes), CI behavior, and repo meta/badges. |
| CONTRIBUTING.md | Adds contributor workflow, prerequisites, and required local validation commands. |
| SECURITY.md | Adds a security policy and private reporting guidance. |
| SUPPORT.md | Adds support channels and guidance for issues/discussions/security reports. |
| PRIVACY.md | Documents repository privacy expectations and cautions about sharing sensitive data in public channels. |
| CHANGELOG.md | Introduces a changelog entry describing the repo “professionalization” changes. |
| .github/PULL_REQUEST_TEMPLATE.md | Adds PR template with validation and checklist items aligned with new make targets. |
| .github/ISSUE_TEMPLATE/bug_report.md | Updates bug report template to request repro commands, sanitizer config, and environment details. |
| .github/FUNDING.yml | Updates sponsorship configuration links. |
| .github/dependabot.yml | Adds Dependabot configuration for GitHub Actions updates. |
| virtual-interface/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS) (sanitizers/coverage runtime linkage). |
| views-zip-enumerate/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| unique-ptr-basics/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| thread-safe-queue/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| sudoku-solver/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| sudoku-solver/main.cpp | Fixes escaped newline output to print real line breaks in usage/errors/results. |
| smart-ptr/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| smart-ptr/main.cpp | Fixes escaped newline output to print real line breaks in test output. |
| rot47/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| ranges-find-in-vector-string/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| prefix-sum/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| pi/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| pi/tests.sh | Replaces bc comparisons with strict numeric validation and range checks via awk; uses safer bash flags. |
| pi-monte-carlo/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| pi-monte-carlo/tests.sh | Replaces bc comparisons with strict numeric validation and range checks via awk; uses safer bash flags. |
| parallel-integral-pi/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| oop-with-exception/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| multithread-sum/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| map-with-unknown-key/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| integer-factorization/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
| fold-left-fold-right/Makefile | Ensures link rules honor shared $(LDFLAGS)/$(LDLIBS). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Professionalize the C++ exercise repository with a consistent local/CI verification interface, sanitizer-aware builds, aggregate coverage gates, secure pull request coverage comments, and complete contributor-facing repository documentation.
Changes
build,test,format,lint,coverage, andcheckMake targets.bc-based Pi checks with strict numericawkvalidation..gitattributes, generated-artifact ignores, Dependabot configuration, issue/PR templates, and contributor, security, support, privacy, and changelog documentation..github/FUNDING.yml.Coverage
Validation
make checkon Ubuntu 24.04 under WSL2: passed with ASan and fail-fast UBSan; TSan was skipped as documented because the GCC runtime cannot reliably reserve its shadow-memory layout under WSL2.make coverage: passed all aggregate thresholds and generated text, HTML, XML, and JSON reports.actions/github-scriptJavaScript syntax check: passed.clang-check.shand alltests.shfiles: passed.git diff HEAD --check: passed.Notes
workflow_runcoverage-comment path, including fork PR association and concurrency cancellation, requires an actual pull request to verify end to end on GitHub.