Splits the one long paragraph into the four workflow settings, what script/cibuild does, and the separate-workflow rule; merges the two descriptions of script/cibuild and drops the sentence that names it, which Entrypoints states; every setting and its reason stays. Model: opus-5-5
This commit is contained in:
1 parent
e80de25c48
commit
64b8139d44
1 file changed
+33
-28
+33
-28
@@ -608,37 +608,42 @@ style conventions are in separate documents:
|
||||
`--build-arg VERSION=...`, as `script/docker` and `script/cibuild`
|
||||
already do.
|
||||
|
||||
# CI
|
||||
|
||||
- Every repo should have a Gitea Actions workflow (`.gitea/workflows/`) that
|
||||
runs `script/cibuild` on push. The workflow's only other step checks out the
|
||||
repo, with `persist-credentials: false`. `script/cibuild` needs no token, and
|
||||
without that setting the checkout leaves the job's token in `.git/config` for
|
||||
every later step. The checkout step also sets `fetch-depth: 0`, which fetches
|
||||
the tags `git describe` needs. By default it clones shallow with no tags, and
|
||||
a tagged repository's CI build would stamp a bare short commit id. The
|
||||
workflow's `concurrency` block groups runs by workflow and branch
|
||||
(`${{ github.workflow }}-${{ github.ref }}`) with `cancel-in-progress: true`.
|
||||
A new push then cancels the older run on the same branch, queued or running,
|
||||
and no other: runs for replaced commits do not hold up the shared runner.
|
||||
`script/cibuild` bootstraps, runs the gate phases, and then builds the image,
|
||||
so a successful run means every check passed. The image build reuses the gate
|
||||
phases that the check has just built. The `check` job sets
|
||||
`timeout-minutes: 20`, so a hung build frees the shared runner after 20
|
||||
minutes. That allows for the three Docker builds described above, each held to
|
||||
the 5-minute Docker build limit below, plus the bootstrap. Those builds are
|
||||
the test phase, the lint phase, then the image. A separate workflow limited to
|
||||
`main` by a `branches` list under `on: push` cannot be checked by review. To
|
||||
try a change to it, add the feature branch to that list and push, then remove
|
||||
the branch from the list again before merging. Keep any job in it that
|
||||
publishes behind `if: github.ref_name == 'main'`, so the run from the feature
|
||||
branch publishes nothing.
|
||||
repo. The workflow sets these:
|
||||
- `persist-credentials: false` on the checkout step. `script/cibuild` needs
|
||||
no token, and without that setting the checkout leaves the job's token in
|
||||
`.git/config` for every later step.
|
||||
- `fetch-depth: 0` on the checkout step, which fetches the tags
|
||||
`git describe` needs. The default is a shallow clone with no tags, and a
|
||||
tagged repository's CI build would then stamp a bare short commit id.
|
||||
- a `concurrency` block that groups runs by workflow and branch
|
||||
(`${{ github.workflow }}-${{ github.ref }}`) with
|
||||
`cancel-in-progress: true`. A new push then cancels the older run on the
|
||||
same branch, queued or running, and no other: runs for replaced commits do
|
||||
not hold up the shared runner.
|
||||
- `timeout-minutes: 20` on the `check` job, so a hung build frees the shared
|
||||
runner after 20 minutes. That allows for the bootstrap and three Docker
|
||||
builds, each held to the 5-minute limit.
|
||||
|
||||
`script/cibuild` runs the CI build, and the Gitea workflow calls it. The
|
||||
script changes to the repo root, runs `script/bootstrap`, runs
|
||||
`script/check`, and builds the image with the version. **`script/cibuild`
|
||||
runs `script/bootstrap` first**, because the workflow checks out the repo
|
||||
and runs nothing else, while `script/fmt-check` runs the formatter on the
|
||||
host. On a pristine checkout with nothing installed, the run dies there,
|
||||
after the containerised gates have passed.
|
||||
`script/cibuild` changes to the repo root, runs `script/bootstrap`, runs
|
||||
`script/check`, and builds the image with the version:
|
||||
- **`script/cibuild` runs `script/bootstrap` first**, because the workflow
|
||||
checks out the repo and runs nothing else, while `script/fmt-check` runs
|
||||
the formatter on the host. On a pristine checkout with nothing installed,
|
||||
the run dies there, after the containerised gates have passed.
|
||||
- Its three Docker builds are the test phase, the lint phase, then the
|
||||
image. So a successful run means every check passed.
|
||||
- The image build reuses the gate phases that the check has just built.
|
||||
|
||||
A separate workflow limited to `main` by a `branches` list under `on: push`
|
||||
cannot be checked by review. To try a change to it, add the feature branch
|
||||
to that list and push, then remove the branch from the list again before
|
||||
merging. Keep any job in it that publishes behind
|
||||
`if: github.ref_name == 'main'`, so the run from the feature branch
|
||||
publishes nothing.
|
||||
|
||||
- `.gitignore` should be comprehensive from the start:
|
||||
- OS files (`.DS_Store`)
|
||||
|
||||
Reference in new issue
Block a user