From 32ebc05f5f29ad069d0a7d9cc2211fde119a8ac3 Mon Sep 17 00:00:00 2001 From: "pascal.tremblin" Date: Sat, 28 Nov 2026 16:11:53 +0100 Subject: [PATCH] docs: contribution rules, changelog; CI on every pull request CONTRIBUTING.md: GitHub as the reference repository, protected main, short branches merged by pull requests with a green CI, versions and releases, protected release tags. CHANGELOG.md with an Unreleased section and 0.1.0. AGENTS.md: agents never push to main nor touch release tags. The CI now runs on every pull request (documentation included) and on pushes to main only, so that its check can be required to merge into main: a check skipped by a path filter would block the pull request, and a job skipped by a condition counts as passed. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 7 ++-- AGENTS.md | 6 ++++ CHANGELOG.md | 22 +++++++++++++ CONTRIBUTING.md | 60 +++++++++++++++++++++++++++++++++++ REUSE.toml | 2 +- docs/developer-guide/tests.md | 16 ++++++---- 6 files changed, 102 insertions(+), 11 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c786f14..8313f8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,11 +10,14 @@ # input files of its runs of canoP are kept as an artifact of the run. name: CI +# Every pull request is tested, documentation included: the check of this job is required to merge +# into main (CONTRIBUTING.md), and a check that never runs would block the pull request. A push is +# tested only on main (the branches are tested by their pull requests). on: push: + branches: [main] paths-ignore: ["docs/**", "**.md", ".readthedocs.yaml"] pull_request: - paths-ignore: ["docs/**", "**.md", ".readthedocs.yaml"] workflow_dispatch: concurrency: @@ -39,8 +42,6 @@ env: jobs: openmp: name: Build and tests (OpenMP) - # a pull request from a branch of this repository is already tested by its push - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository runs-on: ubuntu-24.04 timeout-minutes: 180 steps: diff --git a/AGENTS.md b/AGENTS.md index b57f7fc..8345fe2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -102,6 +102,12 @@ only when the user asks for a change of the studio. ## Git +The rules of the repository are in `CONTRIBUTING.md`; for agents: + - Commit or push only when the user asks. +- Never push to `main` (protected): work on a branch from `main` (`feature/...`, `fix/...`, + `docs/...`), push that branch to GitHub (`origin`) and let the user open and merge the pull request. +- Never create, move or delete a release tag (`v*`) unless the user asks for that release. +- Add a line to the `Unreleased` section of `CHANGELOG.md` for a user-visible change. - Do not commit the user's local ini changes or the `external/kalypsso-core` submodule pointer unless asked. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..18c9ad4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +The user-visible changes of canoP, by version (see `CONTRIBUTING.md` for the versioning rules). + +## Unreleased + +## 0.1.0 - 2026-11-27 + +First release of canoP with its physics written in Python. The numbering restarts at 0.1.0. + +- Physics in Python with pykokkos: one directory per model in `physics/`, one file per option + (initial condition, boundary condition, flux, ...) chosen in the `[physics]` section of the input + file; kernels compiled for the CPU or the GPU at the first run. +- Models `onephase`, `twophase5eq` and `twophase7eq`. +- HLL, HLLC and all-regime fluxes, MUSCL reconstruction, forward Euler or SSP Runge-Kutta 2, + viscous and thermal fluxes with compact gradients, gravity, block-based AMR, MPI. +- Kokkos backends OpenMP and CUDA. +- Self-contained build: canoP builds Kokkos, pykokkos-base and pykokkos, and sets up its Python + environment in `.local/`. Linux and macOS. +- canoP studio: input files, builds, runs (local or Slurm), parameter studies with versioned + physics, views of the results, MCP tools for AI agents. +- Documentation on Read the Docs, CI on GitHub Actions. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b36196e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,60 @@ +# Contributing to canoP + +The reference repository is : issues, pull requests, CI and +releases are there. + +## Branches + +- `main` always builds and passes its tests. It is protected: no direct push, no force-push; every + change comes through a pull request whose CI is green. +- Work on a short branch from `main`, one topic per branch: `feature/`, `fix/`, + `docs/`. Bring it up to date with `main` when needed and delete it once merged. A branch + that lives for weeks is expensive to merge: split the work instead. +- `release/X.Y` branches exist only to fix an older release (see below). + +## Pull requests + +- One topic per pull request, small enough to be read. Its description says what changes, why, and + how it was tested. +- The CI (GitHub Actions: OpenMP build, unit, regression and physics tests) must pass. Run the tests + locally first: see `docs/developer-guide/tests.md`. +- Install the pre-commit hooks once per clone: `pre-commit install`. They check formatting + (clang-format, cmake-format), pylint, typos, licenses (REUSE) and secrets. +- A user-visible change adds a line to the `Unreleased` section of `CHANGELOG.md`: new parameters or + options of the input file, changes of the interface of the physics or of the outputs, canoP studio, + build. Say when a change breaks existing input files or models. +- Update the documentation (`docs/`) in the same pull request as the code. + +## Commits + +- A summary line `: ` (`physics: ...`, `studio: ...`, `docs: ...`, `build: ...`), then + if useful a body that explains why. +- Commit under your own name. Credit the other authors of a change with `Co-authored-by:` lines. +- Do not commit local input files, outputs or build directories. Update the `external/kalypsso-core` + submodule pointer only on purpose, in its own commit. + +## Versions + +canoP follows [semantic versioning](https://semver.org): `MAJOR.MINOR.PATCH`, tags `vX.Y.Z`. Its +interface is the input file (sections, parameters, options), the interface of the physics +(`physics/`: layout, `params(dim)`, the functions canoP calls) and the format of the outputs. + +- While the version is `0.x`, a new feature or a change that breaks the interface raises MINOR, a + fix raises PATCH. +- From `1.0.0`, a change that breaks the interface raises MAJOR. + +## Releases + +1. On `main` with a green CI, a pull request `Release X.Y.Z` sets `CANOP_VERSION` in + `CMakeLists.txt`, `version` and `date-released` in `CITATION.cff`, and turns the `Unreleased` + section of `CHANGELOG.md` into `X.Y.Z`. +2. Once it is merged, an annotated tag `vX.Y.Z` on that commit, pushed to GitHub. +3. A GitHub release from the tag, with the section of `CHANGELOG.md` as notes. + +Release tags `v*` are protected: never move or delete them. To fix an older release without +releasing `main`, create `release/X.Y` from its tag, merge the fix there through a pull request, tag +`vX.Y.(Z+1)`, and bring the fix to `main` too. + +## AI agents + +Coding agents follow `AGENTS.md`: same branches and pull requests, no push to `main`. diff --git a/REUSE.toml b/REUSE.toml index d4df4ec..b2869e5 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -5,7 +5,7 @@ SPDX-PackageDownloadLocation = "https://github.com/canoPdev/canoP" [[annotations]] path = [ - ".github/**", "Readme.md", "docs/**", ".readthedocs.yaml", "tools/vscode/media/**" + ".github/**", "Readme.md", "CONTRIBUTING.md", "CHANGELOG.md", "AGENTS.md", "CLAUDE.md", "docs/**", ".readthedocs.yaml", "tools/vscode/media/**" ] precedence = "aggregate" SPDX-FileCopyrightText = "canoP authors" diff --git a/docs/developer-guide/tests.md b/docs/developer-guide/tests.md index 53169cf..4a4609e 100644 --- a/docs/developer-guide/tests.md +++ b/docs/developer-guide/tests.md @@ -27,13 +27,15 @@ to add a case and produce its reference. ## Continuous integration -`.github/workflows/ci.yml` runs on GitHub Actions at each push and pull request (not for a change of -the documentation alone): a build of canoP for CPUs (OpenMP) on Ubuntu 24.04 with gcc, OpenMPI and -HDF5, then all the tests (unit, regression, physics), a skipped test counting as a failure. ccache -keeps the compilations from one run to the next, and the kernels of the physics compiled by pykokkos -are kept too (49 kernels, about 4 minutes to compile): a run takes a few minutes, about 15 without -these caches. A failed test is reported as an annotation of the run, and the logs and input files -of its runs of canoP are kept for 7 days as an artifact of the run (`logs`). +`.github/workflows/ci.yml` runs on GitHub Actions for each pull request and each push to `main` (not +for a push that changes the documentation alone); its check, `Build and tests (OpenMP)`, is required +to merge into `main` (see `CONTRIBUTING.md`). It is a build of canoP for CPUs (OpenMP) on Ubuntu +24.04 with gcc, OpenMPI and HDF5, then all the tests (unit, regression, physics), a skipped test +counting as a failure. ccache keeps the compilations from one run to the next, and the kernels of +the physics compiled by pykokkos are kept too (49 kernels, about 4 minutes to compile): a run takes a +few minutes, about 15 without these caches. A failed test is reported as an annotation of the run, +and the logs and input files of its runs of canoP are kept for 7 days as an artifact of the run +(`logs`). The GitHub runners have no GPU: the Cuda build and the GPU runs are not tested there. ## Code quality