Skip to content

Commit b8365a6

Browse files
authored
chore(ci): sync improvements from HoldFast (#19)
* chore(ci): sync improvements from HoldFast - cliff.toml: add breaking changes rule; skip feat/fix with non-user-visible scopes - nexus-upload: allow hyphens in semver pre-release; smarter ref on workflow_dispatch; better input description - ci: replace native paths trigger filter with dorny/paths-filter for per-job skipping * fix(ci): address review issues - nexus-upload: revert ref to v$version (dispatch implies tag exists) - ci: skip dorny/paths-filter on workflow_dispatch (jobs already short-circuit via event_name condition) * fix(ci): remove unnecessary checkout from changes job
1 parent e7feb44 commit b8365a6

3 files changed

Lines changed: 93 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 87 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@ name: CI
33
on:
44
pull_request:
55
branches: [main]
6-
paths:
7-
- "src/**"
8-
- "test/**"
9-
- ".clang-format"
10-
- ".clang-tidy"
11-
- "CMakeLists.txt"
12-
- "CMakePresets.json"
13-
- "cmake/**"
14-
- "vcpkg.json"
15-
- ".github/workflows/ci.yml"
166
workflow_dispatch:
177

188
concurrency:
@@ -22,10 +12,56 @@ concurrency:
2212
permissions: {}
2313

2414
jobs:
15+
changes:
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
pull-requests: read
20+
21+
outputs:
22+
src: ${{ steps.filter.outputs.src }}
23+
tests: ${{ steps.filter.outputs.tests }}
24+
format: ${{ steps.filter.outputs.format }}
25+
tidy: ${{ steps.filter.outputs.tidy }}
26+
cmake: ${{ steps.filter.outputs.cmake }}
27+
ci: ${{ steps.filter.outputs.ci }}
28+
29+
steps:
30+
- uses: dorny/paths-filter@v4
31+
id: filter
32+
if: github.event_name == 'pull_request'
33+
with:
34+
filters: |
35+
src:
36+
- 'src/**'
37+
tests:
38+
- 'test/**'
39+
format:
40+
- '.clang-format'
41+
tidy:
42+
- '.clang-tidy'
43+
cmake:
44+
- 'CMakeLists.txt'
45+
- 'CMakePresets.json'
46+
- 'cmake/**'
47+
- 'vcpkg.json'
48+
ci:
49+
- '.github/workflows/ci.yml'
50+
2551
clang-format:
52+
needs: [changes]
2653
runs-on: ubuntu-latest
54+
55+
if: >-
56+
github.event_name == 'workflow_dispatch' ||
57+
needs.changes.outputs.src == 'true' ||
58+
needs.changes.outputs.tests == 'true' ||
59+
needs.changes.outputs.format == 'true' ||
60+
needs.changes.outputs.ci == 'true'
61+
2762
permissions:
2863
contents: read
64+
2965
steps:
3066
- uses: actions/checkout@v6
3167

@@ -40,8 +76,20 @@ jobs:
4076
check-path: test
4177

4278
test:
43-
needs: clang-format
79+
needs: [changes, clang-format]
4480
runs-on: windows-latest
81+
82+
if: >-
83+
always() &&
84+
(needs.clang-format.result == 'success' || needs.clang-format.result == 'skipped') &&
85+
(
86+
github.event_name == 'workflow_dispatch' ||
87+
needs.changes.outputs.src == 'true' ||
88+
needs.changes.outputs.tests == 'true' ||
89+
needs.changes.outputs.cmake == 'true' ||
90+
needs.changes.outputs.ci == 'true'
91+
)
92+
4593
permissions:
4694
contents: read
4795
actions: write
@@ -81,8 +129,19 @@ jobs:
81129
run: ctest --preset test-windows
82130

83131
build:
84-
needs: clang-format
132+
needs: [changes, clang-format]
85133
runs-on: windows-latest
134+
135+
if: >-
136+
always() &&
137+
(needs.clang-format.result == 'success' || needs.clang-format.result == 'skipped') &&
138+
(
139+
github.event_name == 'workflow_dispatch' ||
140+
needs.changes.outputs.src == 'true' ||
141+
needs.changes.outputs.cmake == 'true' ||
142+
needs.changes.outputs.ci == 'true'
143+
)
144+
86145
permissions:
87146
contents: read
88147
actions: write
@@ -127,11 +186,26 @@ jobs:
127186
build/msvc/Release/*.pdb
128187
129188
clang-tidy:
130-
needs: [build, test]
189+
needs: [changes, clang-format, build, test]
131190
runs-on: windows-latest
191+
192+
if: >-
193+
always() &&
194+
(needs.clang-format.result == 'success' || needs.clang-format.result == 'skipped') &&
195+
(needs.build.result == 'success' || needs.build.result == 'skipped') &&
196+
(needs.test.result == 'success' || needs.test.result == 'skipped') &&
197+
(
198+
github.event_name == 'workflow_dispatch' ||
199+
needs.changes.outputs.src == 'true' ||
200+
needs.changes.outputs.tidy == 'true' ||
201+
needs.changes.outputs.cmake == 'true' ||
202+
needs.changes.outputs.ci == 'true'
203+
)
204+
132205
permissions:
133206
contents: read
134207
actions: write
208+
135209
env:
136210
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
137211

.github/workflows/nexus-upload.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
workflow_dispatch:
77
inputs:
88
version:
9-
description: "Version without 'v' prefix (e.g. 1.0.0)"
9+
description: "Version without 'v' prefix (e.g. 1.0.0, 1.0.0-rc.1, 1.0.0+build.1)"
1010
type: string
1111
required: true
1212

@@ -29,8 +29,8 @@ jobs:
2929
run: |
3030
VERSION="${RELEASE_TAG#v}"
3131
VERSION="${VERSION:-$INPUT_VERSION}"
32-
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$ ]]; then
33-
echo "Error: version must be in format X.Y.Z without 'v' prefix (e.g. 1.0.0)" >&2
32+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.-]+)?$ ]]; then
33+
echo "Error: version must be in format X.Y.Z (optionally with prerelease/build metadata, e.g. 1.0.0-rc.1+build.1) without 'v' prefix" >&2
3434
exit 1
3535
fi
3636
echo "value=$VERSION" >> "$GITHUB_OUTPUT"

cliff.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ commit_preprocessors = [
1717
{ pattern = ' \(#\d+\)$', replace = "" },
1818
]
1919
commit_parsers = [
20+
{ message = "^[a-z]+(\\([^)]+\\))?!:", group = "Breaking Changes" },
21+
{ message = "^feat\\((ci|build|docs|test|style)\\)", skip = true },
22+
{ message = "^fix\\((ci|build|docs|test|style)\\)", skip = true },
2023
{ message = "^feat", group = "New Features" },
2124
{ message = "^fix", group = "Bug Fixes" },
2225
{ message = "^chore", skip = true },

0 commit comments

Comments
 (0)