This is a tutorial repository that demonstrates how to set up a GitHub workflow for two independent projects, one in Python and the other in C++.
The C++ project is located in the src
directory. The project uses CMake for building, and tests are included via CMake as well.
You can check the workflow file for this project at .github/workflows/test_cpp.yml
.
The Python project is located in magic_python
and is fully set up as a module. Tests are run using pytest
.
You can check the workflow file for this project at .github/workflows/test_python.yml
.
Python project may be accompanied by jupyter notebooks, usually we want to make sure that these notebooks do not break during the development of the project. So an automated test of the notebooks is a good idea.
You can check the workflow file that automatically runs a jupyter notebooks here .github/workflows/test_jupyter.yml
.
We use trunk.io to manage formatting and software engineering. It is free for open-source projects; please refer to their website for more details.
You can check the workflow file for this project at .github/workflows/trunk.yml
. This workflow ensures that everything is up to standard.
Extra notes for the process are included below. These can be ignored.
- Create a repository, set it to public, apply MIT license, add a Python gitignore, and clone it.
- Protect the
main
branch viaSettings > Branches > Add Protection Rule
. The settings should include requiring a PR, requiring approvals (optional), dismissing stale pull request reviews, requiring status checks, and requiring the branch to be up-to-date. - Add labels to PR, assign yourself to PR, squash and merge PR.
- Add the C++ program, but not the test. Push and open a PR.
- Add a simple workflow to test.
- Add CMake to build and test.
- Create badges via
Actions > workflow name > [...] > create status badge > add text
.