Repository navigation
Commit 0efd400
authored
ci(release): add a manual dry run that builds everything and publishes nothing (#14)
## Summary
`release.yml` runs only for a `v*` tag, so the only way to test a release is to make one. This PR adds `workflow_dispatch`. A manual run is a dry run: `test`, `build`, `build-tui` and `build-tui-macos-arm` run and keep their artifacts. `publish-pypi` and `github-release` do not run.
```yaml
on:
push:
tags:
- "v*"
workflow_dispatch:
# publish-pypi and github-release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
```
The `if` tests the event, not only the ref. A manual run can name a tag as its ref, and then `startsWith(github.ref, 'refs/tags/v')` alone is true.
Seven lines change, in one file. Nothing else changes: the jobs, the artifacts and the tag trigger are the same.
## Why now
This is exit condition 3 of the V0.5 milestone ([v0.5.0](https://github.com/zy1233/pi-python/milestone/1)).
- The macOS arm64 job (PR #6) has never run in a release. `github-release` waits for it. `publish-pypi` does not wait: if the macOS job fails, the Python packages are already on PyPI and the GitHub Release is missing.
- Linux CI cannot compile code that is only for macOS. 75 files under `tui/crates` hold `cfg(target_os = "macos")`. After the last macOS build, 88 files of `tui/` changed, and 8 of them hold such code.
- The release workflow of v0.3.0 needed three runs before it passed.
## Verification
- `actionlint` 1.7.12: no findings.
- The YAML parses, and the two `if` lines are the only changed conditions.
- The dry run ran from this branch (`gh workflow run release.yml --ref ci/release-dry-run`; GitHub accepts a manual run from a branch that is not on `main`). Run [38223353755](https://github.com/zy1233/pi-python/actions/runs/38223353755) succeeded in 27 minutes: `test` 97 s, the Python packages 29 s, the Linux x86_64 binary 16 m 26 s, the macOS arm64 binary 25 m 27 s. `publish-pypi` and `github-release` were skipped, so nothing was published. The artifacts (`dist`, `tui-binary`, `tui-binary-macos-arm64`) are kept until 2027-01-10.
- Not verified: the true side of the two `if` lines. It runs only for a real tag push.
## For the reviewer
- The three build jobs need `test`, so a dry run first runs the full pytest suite and Ruff. A dry run costs as much as a release run. The repository is public, so the minutes are free.
- A dry run does not use the `pypi` environment: the job that needs it is skipped.
- Creating the tag and the release stays a step for the maintainer.1 parent d57fd9b commit 0efd400
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
| 151 | + | |
| 152 | + | |
148 | 153 | | |
149 | 154 | | |
150 | 155 | | |
| |||
162 | 167 | | |
163 | 168 | | |
164 | 169 | | |
| 170 | + | |
| 171 | + | |
165 | 172 | | |
166 | 173 | | |
167 | 174 | | |
| |||
0 commit comments