From 93aa37720f7409c35a34ddb6a79ed5fad5fc5ebf Mon Sep 17 00:00:00 2001 From: Leon Lan Date: Tue, 30 Jul 2024 08:04:51 +0200 Subject: [PATCH 1/2] CONTRIBUTING.md --- CONTRIBUTING.md | 77 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3a14dc5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,77 @@ +# Contributing to the CP-SAT Primer Book + +Thank you for your interest in contributing to the CP-SAT Primer book! + +- Discussions and issues are managed in the [GitHub repository](https://github.com/d-krupke/cpsat-primer/issues). +- Feel free to open a new issue for discussions or email me directly. +- All contributions are welcome, and substantial contributions will be recognized with co-authorship. + +## Book Code Organization + +Each chapter of the book has as a separate Markdown file in the root directory (e.g., `00_intro.md` for the introduction). +If you want to fix typos or add material, edit these chapters directly in the root directory. +Please do not make edits to the `README.md` file as this file will be automatically generated by running the `build.py` script. + +## Building the Book Locally + +To preview the changes that you make to the book: + +1. Install `mdbook` using the [official mdBook installation guide](https://rust-lang.github.io/mdBook/guide/installation.html). + +2. From the root directory, run: + ``` + python3 build.py + ``` + +3. Navigate to the `.mdbook` directory: + ``` + cd .mdbook + ``` + +4. Build the book: + ``` + mdbook build + ``` + +5. To view and automatically update the book in your browser: + ``` + mdbook watch --open . + ``` + +6. After any changes, rerun `python3 build.py` from the root directory to see the changes reflected in your browser. + + +## Submitting a Pull Request + +1. Fork the repository to your GitHub account. + +2. Make your changes directly to the relevant Markdown files in the root directory of your fork. + +3. Build and preview your changes locally by following the steps in the [Building the Book Locally](#building-the-book-locally) section above. + ``` + python3 build.py + cd .mdbook + mdbook build + mdbook watch --open + ``` + +4. Commit your changes (including changes to the `README.md` file) with a clear and descriptive commit message: + ``` + git commit -am "Add description of your changes" + ``` + +5. Push your changes to your forked repository: + ``` + git push origin main + ``` + +6. Go to the original repository on GitHub and click "New pull request". + +7. Select your fork and ensure the changes you want to submit are included. + +8. Provide a clear title and description for your pull request, explaining the changes you've made. + +9. Submit the pull request for review. + +10. Be prepared to make additional changes if requested by the maintainers. + From d96bff435efd84014859e2abffb6caf99a0fc48f Mon Sep 17 00:00:00 2001 From: "Dr. Dominik Krupke" Date: Tue, 30 Jul 2024 10:19:43 +0200 Subject: [PATCH 2/2] Added a short section to pre-commit and testing. --- CONTRIBUTING.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a14dc5..facc401 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,6 +12,9 @@ Each chapter of the book has as a separate Markdown file in the root directory ( If you want to fix typos or add material, edit these chapters directly in the root directory. Please do not make edits to the `README.md` file as this file will be automatically generated by running the `build.py` script. +If you install [pre-commit](https://pre-commit.com/), formatting and building will be done automatically for every commit. +pre-commit can be installed from pip via `pip install pre-commit` and activated with `pre-commit install` in the repository. + ## Building the Book Locally To preview the changes that you make to the book: @@ -75,3 +78,13 @@ To preview the changes that you make to the book: 10. Be prepared to make additional changes if requested by the maintainers. +## Testing + +CP-SAT is under rapid development, and its behavior can change from time to time. +Therefore, while it is not mandatory, it is highly appreciated if code snippets are +converted into simple test cases. These test cases do not need to be complex; +even detecting syntax errors when CP-SAT changes is valuable. +All test cases will be automatically run every week against the latest version +of CP-SAT to ensure that the code snippets remain valid. + +