This repository demonstrates a scalable C++ project structure with multiple applications and Google Test integration for unit testing.
- Modular structure supporting multiple applications
- Google Test integration for unit testing
- Automated build and test workflow using GitHub Actions
- Scalable Makefile system
- G++ compiler with C++14 support
- GNU Make
- Google Test library
To build all applications and run tests:
make
To build a specific application:
make app_name
For example:
make sumofnumbers
To run all tests:
make tests
- Create a new directory under
apps/
for your application. - Add your source files and a
Makefile
to the new directory. - Update the root
Makefile
if necessary (it should automatically detect new apps). - Add corresponding test files in the
tests/
directory.
This project includes a GitHub Actions workflow that:
- Builds all applications
- Runs linting checks
- Executes all tests
The workflow is triggered on pushes to the main branch and pull requests.
The root Makefile
coordinates the building of all applications and tests. It automatically detects subdirectories in the apps/
folder and generates appropriate build targets.
Each application in the apps/
directory should have its own Makefile
and source files. The sumofnumbers
application serves as an example.
The tests/
directory mirrors the structure of the apps/
directory. Each test file should correspond to an application and contain unit tests for that application's functionality.
The GitHub Actions workflow defined in .github/workflows/stagemain.yml
automates the build and test process. It uses an Ubuntu container to set up the environment, install dependencies, and run the build and test commands.
- Keep application logic in header files to make it easily testable.
- Write unit tests for all significant functionality.
- Use meaningful names for applications, test files, and test cases.
- Keep the project structure modular to allow easy addition of new applications.
If you encounter build issues:
- Ensure all dependencies are correctly installed.
- Check that your G++ version supports C++14.
- Verify that the Google Test library is properly set up on your system.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE
file for details.
- Google Test for providing the testing framework
- The C++ community for continuous support and inspiration