Skip to content

Commit f16e50a

Browse files
committed
CI: Add check-commit workflow and message checker
Add a reusable check-commit workflow and wire it into the main PR pipeline as a prerequisite before the Linux build jobs run. Move the commit message checker and its tests into cvm/conf, enforce the 120-character title limit and 80-character body limit, and reject Co-Authored-By and Change-Id trailers.
1 parent 6a90dfb commit f16e50a

4 files changed

Lines changed: 523 additions & 4 deletions

File tree

.github/workflows/check-commit.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: check-commit
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
base-ref:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
check-commit:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.x"
23+
24+
- name: Check commit messages
25+
run: |
26+
python3 cvm/conf/check_commit.py --range origin/${{ inputs.base-ref }}..HEAD

.github/workflows/main.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ concurrency:
4949

5050
jobs:
5151

52+
check-commit:
53+
name: check-commit
54+
if: github.event_name == 'pull_request'
55+
uses: ./.github/workflows/check-commit.yml
56+
with:
57+
base-ref: ${{ github.base_ref }}
58+
5259
###
5360
### Determine platforms to include
5461
###
@@ -112,25 +119,29 @@ jobs:
112119

113120
build-linux-x64:
114121
name: linux-x64
115-
needs: select
122+
needs:
123+
- select
124+
- check-commit
116125
uses: ./.github/workflows/build-linux.yml
117126
with:
118127
platform: linux_x64
119128
apt-gcc-version: '9'
120129
runs-on: ubuntu-22.04
121130
# The linux-x64 jdk bundle is used as buildjdk for the cross-compile job
122-
if: needs.select.outputs.linux-x64 == 'true' || needs.select.outputs.linux-cross-compile == 'true'
131+
if: (github.event_name != 'pull_request' || needs.check-commit.result == 'success') && (needs.select.outputs.linux-x64 == 'true' || needs.select.outputs.linux-cross-compile == 'true')
123132

124133
build-linux-aarch64:
125134
name: linux-aarch64
126-
needs: select
135+
needs:
136+
- select
137+
- check-commit
127138
uses: ./.github/workflows/build-linux.yml
128139
with:
129140
platform: linux_aarch64
130141
apt-gcc-version: '9'
131142
runs-on: ubuntu-22.04-arm
132143
# The linux-aarch64 jdk bundle is used as buildjdk for the cross-compile job
133-
if: needs.select.outputs.linux-aarch64 == 'true' || needs.select.outputs.linux-cross-compile == 'true'
144+
if: (github.event_name != 'pull_request' || needs.check-commit.result == 'success') && (needs.select.outputs.linux-aarch64 == 'true' || needs.select.outputs.linux-cross-compile == 'true')
134145

135146
###
136147
### GTest jobs

0 commit comments

Comments
 (0)