Conversation
There was a problem hiding this comment.
Pull request overview
Bootstraps the new invariants C++ project with a Nix-flake-driven dev/build workflow, a CMake + GoogleTest build/test setup, and initial contributor tooling/docs to support a reproducible, test-first development process.
Changes:
- Added Nix flake environment (devShell, build/checks, helper app) and locked inputs.
- Introduced initial CMake project with a
hello_worldexecutable and a GoogleTest-based test target. - Added developer workflow files:
prekhooks config, clangd/direnv integration, gitignore updates, and a CONTRIBUTING guide.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
flake.nix |
Defines reproducible build/devShell, package/checks/apps outputs for the C++ project |
flake.lock |
Pins Nix inputs for reproducibility |
lang/CMakeLists.txt |
Sets C++23, enables testing, wires in GTest and test subdirectory |
lang/src/main.cpp |
Adds initial hello_world executable source |
lang/tests/CMakeLists.txt |
Adds GTest executable and test discovery |
lang/tests/hello_test.cpp |
Adds initial GoogleTest smoke test |
prek.toml |
Adds pre-commit hook configuration for formatting and static analysis |
CONTRIBUTING.md |
Adds contribution and workflow guidelines |
.clangd |
Configures clangd compilation database location |
.envrc |
Enables direnv to load the flake environment |
.gitignore |
Ignores Nix/direnv artifacts and compile DB output |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ## 2. Branching & PRs | ||
| Always use branches and PRs to trigger GitHub Actions and Copilot reviews. | ||
|
|
There was a problem hiding this comment.
The PR metadata and contributing guide reference GitHub Actions/CI being triggered by PRs, but this change set doesn’t add any workflow configuration (there is no .github/workflows directory). Either add the initial CI workflow(s) as part of this PR, or update the PR description/docs to avoid implying CI is already in place.
There was a problem hiding this comment.
Added .github/workflows/ci.yml in f7ff9f1. The workflow triggers on pushes and PRs to main, installs Nix, and runs nix build --show-trace — which includes the CTest suite automatically because doCheck = true in flake.nix. Explicit contents: read permissions are set on the job.
| id = "clang-format", | ||
| args = ["--style=Google"] | ||
| }, | ||
| { |
There was a problem hiding this comment.
The clang-tidy hook hard-codes -p=.nix-dev/build, but that build directory won’t exist on a fresh checkout unless the developer has run the configure step first. This will cause the hook to fail unexpectedly. Consider making the hook create/configure the build dir when missing, or document the required nix run .#configure/CMake configure step in CONTRIBUTING/README.
| { | |
| # `clang-tidy` reads compile commands from `.nix-dev/build`. | |
| # On a fresh checkout, run the configure step first (for example | |
| # `nix run .#configure`) so `.nix-dev/build/compile_commands.json` exists. | |
| { |
There was a problem hiding this comment.
I'll document this properly later. I don't have anything about setup in the readme to begin with so...
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ujaandas/invariants/sessions/6f0e6d5d-100e-41cd-8cc3-6627b9b7f380 Co-authored-by: ujaandas <79176268+ujaandas@users.noreply.github.com>
|
@copilot can you update the readme based on what we have right now and what the project is generally about? |
Agent-Logs-Url: https://github.com/ujaandas/invariants/sessions/1b5320b4-f691-4bec-bcf7-a0521e37d320 Co-authored-by: ujaandas <79176268+ujaandas@users.noreply.github.com>
Done in 17a46a3. The README now covers what the project is, prerequisites (Nix with flakes), dev-shell entry, the |
This pull request introduces a foundational C++ project structure for the "invariants" project, complete with build tooling, development environment setup, and initial documentation. The changes establish a reproducible and test-driven workflow using Nix, CMake, and GoogleTest, and add basic automation and contribution guidelines.
Project bootstrapping and build system:
flake.nixto provide a reproducible Nix-based development environment, including build, test, and formatting tools, as well as shell and app definitions for building and configuring the project.lang/CMakeLists.txtto define the CMake build for the C++ project, enabling testing, setting C++23, and building thehello_worldexecutable..clangdand.envrcto configure clangd integration and automatically load the Nix flake environment for development.Source code and testing:
lang/src/main.cppand set up a basic GoogleTest-based test inlang/tests/hello_test.cppwith corresponding CMake configuration.Developer workflow and automation:
prek.tomlconfiguration for pre-commit hooks, automating code formatting and static analysis withclang-format,clang-tidy, andcppcheck.CONTRIBUTING.mdwith clear guidelines for TDD, branching, PRs, and project structure to enforce code quality and maintainability.CI/CD:
.github/workflows/ci.yml— a GitHub Actions workflow that triggers on pushes and pull requests targetingmain. It installs Nix with flakes enabled and runsnix build --show-trace, which automatically executes the full CTest suite viadoCheck = trueinflake.nix. The job is scoped tocontents: readpermissions.Documentation:
README.mdwith a project overview, prerequisites (Nix with flakes), dev-shell entry instructions, thenix run .#configuresetup step required for clangd and pre-commit hooks, a build/test command reference table, pre-commit hook installation instructions, and a project layout map.