Debian Codegraph @

dev/ci/user-overlays/README.md

raw symbols SCIP
1 # Add overlays for your pull requests in this directory
2
3 _Overlays_ let you test pull requests that break the base version of
4 external projects by applying PRs of the external project during CI
5 testing (1 PR per broken external project). Once Rocq CI's tests of the
6 external projects pass, the Rocq PR can be merged, then the assignee must
7 ask the external projects to merge their PRs (for example by commenting
8 in the external PRs). External projects are then expected to merge their
9 PRs promptly.
10
11 ## Typical workflow
12
13 Overlay files can be created automatically using the script
14 [`create_overlays.sh`](../../tools/create_overlays.sh).
15
16 - Observe that your changes breaks some external projects `<project1>` ... `<projectn>` in CI
17 (`<projecti>` is the name of a project, without the `ci-` prefix.
18 Note that some jobs run multiple projects, e.g. `plugin:ci-elpi_hb` runs `elpi` and `hb`)
19 - If necessary, fork the broken projects from their github pages.
20 (Only needs to be done once per project for the lifetime of your github account)
21 (Ask for help for projects not on github)
22 - Compile your PR locally (`make world`).
23 - Run `dev/tools/create_overlays.sh <account> <PR> <project1> ... <projectn>`
24 where `<account>` is your github account name and `PR` is the PR number.
25 This will download the given projects to `_build_ci` (and their dependencies),
26 declare your fork (using the account name) as a remote
27 and checkout a new branch for your fixes.
28 - For each broken project:
29 - run `make ci-<project>`, e.g. `make ci-elpi`.
30 This should produce the error observed in CI.
31 - Make necessary changes, then rerun the script to verify they work.
32 - From the `_build_ci/<project>` subdirectory, commit your changes to the current
33 branch (it was created by create_overlays).
34 - Push to your fork of the project and create a new PR. Make sure you pick
35 the correct base branch in the github GUI for the comparison
36 (c.f. `dev/ci/ci-basic-overlay.sh`, e.g. `master` for elpi).
37 If the fix is backwards compatible (preferred for library changes), open the PR as ready
38 and ask for it to be merged (eg "Should be backwards compatible, please merge.").
39 Otherwise (typical for plugin changes, including plugins with optional compilation to support multiple Rocq versions) the PR needs to be merged in sync with the Rocq PR, so open as draft.
40 - link the overlay PR in the Rocq PR (at the end of the opening post add a list
41 ~~~
42 Overlays:
43 - <PR1>
44 - <PR2>
45 ~~~
46 )
47 - Commit the overlay file (`git add dev/ci/user-overlays && git commit`),
48 push to the Rocq PR and run full CI
49 (wait for the assignee to run full CI if you don't have the rights)
50 - When your PR is merged, the assignee notifies the maintainers of the
51 external project to merge the changes you submitted. This should happen
52 promptly; the external project's CI will fail until the change is merged.
53 - Beer.
54
55 Notes:
56 - running `create_overlays` multiple times is fine
57 - running `make ci-foo` before `create_overlays` it's also fine
58
59 So for instance you can have an alternate workflow of
60
61 - run `make ci-project1`
62 - fix
63 - `dev/tools/create_overlays.sh <account> <PR> <project1>`
64 - commit, push and PR for project 1
65 - run `make ci-project2`
66 - fix
67 - `dev/tools/create_overlays.sh <account> <PR> <project1> <project2>`
68 - commit push and PR for project 2
69 - repeat until project `n` is done
70 - commit and push overlay file
71
72 ## Overlay file specification
73
74 An overlay file specifies the external PRs that should be applied during CI.
75 A single file can cover multiple external projects. Create your
76 overlay file in the `dev/ci/user-overlays` directory.
77 The name of the overlay file should start with a five-digit pull request
78 number, followed by a dash, anything (by convention, your GitHub nickname
79 and the branch name), then an `.sh` extension (`[0-9]{5}-[a-zA-Z0-9-_]+.sh`).
80
81 The file must contain a call to the `overlay` function for each
82 affected external project:
83 ```
84 overlay <project> <giturl> <ref> <prnumber> [<prbranch>]
85 ```
86 Each call creates an overlay for `project` using a given `giturl` and
87 `ref` which is active for `prnumber` or `prbranch` (`prbranch` defaults
88 to `ref`).
89
90 For example, an overlay for the project `elpi` that uses the branch `noinstance`
91 from the fork of `SkySkimmer` and is active for pull request `13128`:
92 ```
93 overlay elpi https://github.com/SkySkimmer/coq-elpi noinstance 13128
94 ```
95
96 The github URL and base branch name for each external project are listed in
97 [`ci-basic-overlay.sh`](../ci-basic-overlay.sh). For example, the entry for
98 `elpi` is
99 ```
100 project elpi "https://github.com/LPCIC/coq-elpi" "master"
101 ```
102 But substitute the name of your fork into the URL, e.g. `SkySkimmer/coq-elpi`
103 rather than `LPCIC/coq-elpi`. Use `#` to mark any comments.
104
105 If the branch name in the external project differs from the Rocq branch name,
106 include the external branch name as `[prbranch]` to apply it when you run
107 the test suite locally, e.g. `make ci-elpi`.
108
109 ## Branching conventions
110
111 We suggest you use the convention of identical branch names for the
112 Rocq branch and the CI project branch used in the overlay. For example,
113 if your Rocq PR is in your branch `more_efficient_tc` and
114 breaks `ltac2`, we suggest you create an `ltac2` overlay with a branch
115 named `more_efficient_tc`.