Skip to content

Commit c605f03

Browse files
committed
Allow parallel CI runs by default with optional serialization
- Default concurrency group uses run_id (unique per run, no blocking) - Set repo variable CI_SERIAL=true to serialize runs per branch - Set CI_CANCEL_IN_PROGRESS=true to cancel older runs when new queued - Document concurrency behavior and variables in README and guide Made-with: Cursor
1 parent 967c76b commit c605f03

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ permissions:
1111
contents: read
1212

1313
concurrency:
14-
group: ci-release-${{ github.ref }}
15-
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
14+
group: ${{ vars.CI_SERIAL == 'true' && format('ci-release-{0}', github.ref) || format('ci-release-{0}', github.run_id) }}
15+
cancel-in-progress: ${{ vars.CI_CANCEL_IN_PROGRESS == 'true' }}
1616

1717
env:
1818
DOTNET_NOLOGO: true

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,19 @@ env:
144144

145145
---
146146

147+
## Concurrency
148+
149+
Multiple `CI and Release` runs execute **in parallel by default**. Each run gets a unique `run_number`, so versions never conflict.
150+
151+
To serialize runs on the same branch (only one active at a time), set repository variables in **Settings > Secrets and variables > Actions > Variables**:
152+
153+
| Variable | Default | Effect |
154+
|----------|---------|--------|
155+
| `CI_SERIAL` | _(unset / false)_ | Set to `true` to queue runs per branch instead of running in parallel |
156+
| `CI_CANCEL_IN_PROGRESS` | _(unset / false)_ | Set to `true` to cancel the running workflow when a newer one is queued |
157+
158+
---
159+
147160
## Documentation Deployment
148161

149162
To enable automatic documentation deployment to GitHub Pages:

docs/github-workflows-guide.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ push / PR to main + weekly
2525

2626
### `CI and Release`
2727
- 触发:`push``main`、对 `main``pull_request`、手动 `workflow_dispatch`
28+
- 并发:**默认并行**,多次 push 可同时运行(`run_number` 天然唯一,版本不冲突)
29+
- 如需串行:Settings → Variables → 设置 `CI_SERIAL=true`(按分支排队)
30+
- 如需取消旧 run:设置 `CI_CANCEL_IN_PROGRESS=true`
2831
- PR 行为:只在 ubuntu 上运行 Build + Test(带 prerelease suffix)
2932
- main push 行为:全平台矩阵 Build + Test + Pack + Publish + PackageApp → approval → NuGet 推送 + tag + GitHub Release → 文档部署
3033
- 产物:测试结果、NuGet 包(含 release manifest)、各平台安装包 zip

0 commit comments

Comments
 (0)