|
1 | 1 | # Contributing to GEMC |
2 | 2 |
|
3 | | -We welcome contributions of code, documentation, tests, examples, and bug reports. This guide explains how to propose changes via GitHub. |
| 3 | +Contributions to GEMC are welcome. Useful contributions include source code, Python API improvements, documentation, examples, tests, bug reports, build-system fixes, and reproducible simulation problems. |
4 | 4 |
|
5 | | -> **Quickstart** |
6 | | -> 1. Open an issue to discuss your idea or bug. |
7 | | -> 2. Fork the repo and clone your fork. |
8 | | -> 3. Create a feature branch. |
9 | | -> 4. Commit changes with clear messages and add tests/docs. |
10 | | -> 5. Keep your fork in sync with `upstream`. |
11 | | -> 6. Open a pull request (PR) from your branch. |
| 5 | +Keep changes focused and reviewable. A small pull request with clear motivation is easier to review and safer to merge than a broad rewrite. |
12 | 6 |
|
13 | | ---- |
| 7 | +## Before You Start |
14 | 8 |
|
15 | | -## 1) Before you start: open an issue |
16 | | -Have a feature in mind? Open an issue describing the problem, proposed solution, and any alternatives. For obvious, small bug fixes, opening a PR directly is fine—but filing an issue first is still appreciated. |
| 9 | +Open an issue before working on large changes, new features, build-system changes, public APIs, file formats, or behavior that affects examples and documentation. Small typo fixes, narrow documentation edits, and obvious bug fixes can go directly to a pull request. |
17 | 10 |
|
18 | | -If you’re not sure where to help, ask in an issue—documentation improvements are always welcome. |
| 11 | +For security vulnerabilities, do not open a public issue. Follow [`SECURITY.md`](SECURITY.md). |
19 | 12 |
|
20 | | -## 2) Fork and clone |
| 13 | +## Development Setup |
21 | 14 |
|
22 | | -Create your fork on GitHub, then: |
| 15 | +Fork `gemc/src` on GitHub, then clone your fork: |
23 | 16 |
|
24 | | -```bash |
25 | | -git clone https://github.com/<your-username>/src.git gemc |
26 | | -cd gemc |
27 | | -git remote add upstream https://github.com/gemc/src.git |
28 | | -git remote -v |
| 17 | +```shell |
| 18 | +git clone https://github.com/<your-username>/src.git gemc-src |
| 19 | +cd gemc-src |
29 | 20 | ``` |
30 | 21 |
|
31 | | -## 3) Create a branch |
| 22 | +## Build and Test |
32 | 23 |
|
33 | | -Use a descriptive branch name: |
| 24 | +Use the project Meson build. The normal local command for building and installing the current tree is: |
34 | 25 |
|
35 | | -```bash |
36 | | -# Replace "main" with "master" if your fork uses that as the default |
37 | | -git switch -c feature/my-awesome-idea |
38 | | -# or: git checkout -b feature/my-awesome-idea |
| 26 | +```shell |
| 27 | +meson install -C build |
39 | 28 | ``` |
40 | 29 |
|
41 | | -## 4) Keep your fork in sync |
42 | | -Update your local default branch and your feature branch regularly: |
| 30 | +List available tests: |
43 | 31 |
|
44 | | -```bash |
45 | | -git fetch upstream |
46 | | -git switch main |
47 | | -git merge upstream/main # or: git rebase upstream/main |
48 | | -git push origin main |
49 | | - |
50 | | -# Update your feature branch |
51 | | -git switch feature/my-awesome-idea |
52 | | -git rebase main # keeps history clean; use merge if you prefer |
| 32 | +```shell |
| 33 | +meson test -C build --list |
53 | 34 | ``` |
54 | 35 |
|
55 | | -## 5) Code standards & tests |
| 36 | +Run the relevant test with logs: |
| 37 | + |
| 38 | +```shell |
| 39 | +meson test -C build -v --print-errorlogs <testname> |
| 40 | +``` |
56 | 41 |
|
57 | | -- **Style**: Match the existing project style. If a .clang-format/formatter is present, use it before committing. |
58 | | -- **C++/Python APIs**: Keep naming, headers, and error handling consistent with the code around your changes. |
59 | | -- **Tests**: Add or update tests for any behavior change. |
60 | | -- **Docs**: Update README/installation/examples and any relevant docs when behavior or options change. |
61 | | -- **Small, focused PR**s: Prefer multiple small PRs over one very large PR. |
| 42 | +When a change touches shared code, run the smallest useful set of related tests plus any examples that exercise the behavior. If a test cannot be run locally, say why in the pull request. |
62 | 43 |
|
63 | | -## 6) Commit messages |
| 44 | +## Contribution Guidelines |
64 | 45 |
|
65 | | -Write clear, imperative messages: |
| 46 | +- Match the style of the surrounding C++ or Python code. |
| 47 | +- Prefer clear, local fixes over broad refactors. |
| 48 | +- Add or update tests for behavior changes. |
| 49 | +- Update README files, examples, and website documentation when user-facing behavior changes. |
| 50 | +- Keep generated files, build output, caches, and local IDE files out of commits. |
| 51 | +- Do not mix unrelated cleanup with feature or bug-fix work. |
| 52 | +- For geometry or visualization changes, include screenshots or links to generated images when that helps review. |
66 | 53 |
|
67 | | -```bash |
| 54 | +## Commit Messages |
68 | 55 |
|
69 | | -Short summary (max ~72 chars) |
| 56 | +Use short, imperative commit summaries: |
70 | 57 |
|
71 | | -Longer explanation of what and why, |
72 | | -including any breaking changes or migration notes. |
| 58 | +```text |
| 59 | +Fix flux digitization timestamp output |
73 | 60 | ``` |
74 | 61 |
|
75 | | -If your PR closes an issue, end the description with: Closes #<issue-number>. |
| 62 | +When the reasoning is not obvious, add a body explaining what changed and why. If the pull request closes an issue, include `Closes #123` in the pull request description. |
| 63 | + |
| 64 | +## Pull Requests |
| 65 | + |
| 66 | +Open a pull request from your fork to `gemc/src`. |
| 67 | + |
| 68 | +Before requesting review, check that: |
76 | 69 |
|
77 | | -## 7) Open a Pull Request |
78 | | -From your fork/branch, open a PR against gemc/source: |
| 70 | +- The title and description explain the change. |
| 71 | +- Related issues are linked. |
| 72 | +- Relevant tests or examples were run and listed. |
| 73 | +- Documentation and examples were updated if needed. |
| 74 | +- The pull request is focused on one topic. |
79 | 75 |
|
80 | | -**Checklist** |
| 76 | +Reviews may ask for changes to improve correctness, maintainability, performance, documentation, or test coverage. |
81 | 77 |
|
82 | | -- Clear title and concise description |
83 | | -- Link to related issues; include Closes #123 when appropriate |
84 | | -- Include screenshots for UI/visual changes |
85 | | -- Tests pass locally; CI is green |
86 | | -- Docs/examples updated as needed |
| 78 | +## Communication |
87 | 79 |
|
88 | | -Reviews in this project are thorough. Feedback is offered in good spirit to improve clarity, performance, and maintainability. |
| 80 | +- General questions: open an issue. |
| 81 | +- Security vulnerabilities: email **ungaro@jlab.org** instead of opening a public issue. |
| 82 | +- Conduct concerns: email **ungaro@jlab.org** and see [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md). |
89 | 83 |
|
90 | | -## 8) Communication & support |
| 84 | +## Licensing and Citation |
91 | 85 |
|
92 | | -- Questions / help: Open an issue. |
93 | | -- Security vulnerabilities: Do not open a public issue. Email gemc@jlab.org. |
94 | | -- Conduct: All interactions are governed by our Code of Conduct. |
| 86 | +By contributing, you agree that your contributions are licensed under the GEMC Software License v1.0. See [`LICENSE.md`](LICENSE.md). |
95 | 87 |
|
96 | | -## 9) Licensing of contributions |
97 | | -By contributing, you agree that your contributions are licensed under the GEMC Software License v1.0 and |
98 | | -that publications using GEMC should cite: |
| 88 | +If you use GEMC in scientific work, cite: |
99 | 89 |
|
100 | | -M. Ungaro, “Geant4 Monte-Carlo (GEMC) A database-driven simulation program,” EPJ Web of Conferences 295, 05005 (2024), https://doi.org/10.1051/epjconf/202429505005 |
| 90 | +> M. Ungaro, "Geant4 Monte-Carlo (GEMC) A database-driven simulation program," EPJ Web of Conferences 295, 05005 (2024). https://doi.org/10.1051/epjconf/202429505005 |
0 commit comments