Skip to content

Commit 085add4

Browse files
committed
ci fix
1 parent 1c26a9f commit 085add4

5 files changed

Lines changed: 25 additions & 10 deletions

File tree

.github/workflows/client-cpp-package.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ jobs:
8888
set -euxo pipefail
8989
sudo apt-get update
9090
sudo apt-get install -y libboost-all-dev openssl libssl-dev clang-format-17
91-
clang-format-17 --version
91+
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-17 100
92+
sudo update-alternatives --set clang-format /usr/bin/clang-format-17
93+
clang-format --version
9294
- name: Cache Maven packages
9395
uses: actions/cache@v5
9496
with:
@@ -133,6 +135,7 @@ jobs:
133135
run: |
134136
set -euxo pipefail
135137
brew install boost openssl llvm@17
138+
ln -sf "$(brew --prefix llvm@17)/bin/clang-format" "$(brew --prefix)/bin/clang-format"
136139
echo "$(brew --prefix llvm@17)/bin" >> "$GITHUB_PATH"
137140
clang-format --version
138141
- name: Cache Maven packages
@@ -193,7 +196,7 @@ jobs:
193196
$sslPath = (Get-ChildItem 'C:\Program Files\OpenSSL*' -Directory | Select-Object -First 1).FullName
194197
echo "$sslPath\bin" >> $env:GITHUB_PATH
195198
echo "OPENSSL_ROOT_DIR=$sslPath" >> $env:GITHUB_ENV
196-
choco install llvm --version=17.0.6 -y
199+
choco install llvm --version=17.0.6 --force -y
197200
clang-format --version
198201
- name: Cache Maven packages
199202
uses: actions/cache@v5

.github/workflows/multi-language-client.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,18 @@ jobs:
5757
sudo apt-get update
5858
sudo apt-get install -y libboost-all-dev
5959
sudo apt-get install -y openssl libssl-dev clang-format-17
60-
clang-format-17 --version
60+
# Align default /usr/bin/clang-format with 17.x (Apache TsFile CI pattern; avoids Spotless picking 18.x)
61+
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-17 100
62+
sudo update-alternatives --set clang-format /usr/bin/clang-format-17
63+
clang-format --version
6164
- name: Install CPP Dependencies (Mac)
6265
# remove some xcode to release disk space
6366
if: runner.os == 'macOS'
6467
shell: bash
6568
run: |
6669
brew install boost
6770
brew install openssl llvm@17
71+
ln -sf "$(brew --prefix llvm@17)/bin/clang-format" "$(brew --prefix)/bin/clang-format"
6872
echo "$(brew --prefix llvm@17)/bin" >> "$GITHUB_PATH"
6973
clang-format --version
7074
sudo rm -rf /Applications/Xcode_14.3.1.app
@@ -84,7 +88,7 @@ jobs:
8488
$sslPath = (Get-ChildItem 'C:\Program Files\OpenSSL*' -Directory | Select-Object -First 1).FullName
8589
echo "$sslPath\bin" >> $env:GITHUB_PATH
8690
echo "OPENSSL_ROOT_DIR=$sslPath" >> $env:GITHUB_ENV
87-
choco install llvm --version=17.0.6 -y
91+
choco install llvm --version=17.0.6 --force -y
8892
clang-format --version
8993
- name: Cache Maven packages
9094
uses: actions/cache@v5

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ plugin](https://github.com/diffplug/spotless/tree/main/plugin-maven) together wi
110110
### C++ formatting
111111

112112
- Formatter: `clang-format` only
113-
- Version: `17.0.6` (must match CI)
113+
- Version: pinned as `clang.format.version` in the root `pom.xml` (currently `17.0.6`, aligned with Apache TsFile); CI installs LLVM/clang-format so the default `clang-format` on the runner matches that version
114114
- Entrypoint: Maven Spotless
115115

116116
Check only:

iotdb-client/client-cpp/README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,19 @@ We use `clang-format` as the only formatter for C++ code and trigger it through
102102

103103
### Required version
104104

105-
Use `clang-format 17.0.6` locally to keep behavior consistent with CI.
105+
The version is pinned in the root `pom.xml` as property `clang.format.version` (same approach as Apache TsFile). Use **clang-format 17.0.6** locally so Spotless agrees with CI.
106106

107107
### Install clang-format 17.0.6
108108

109-
- Linux (Ubuntu): `sudo apt-get install -y clang-format-17`
110-
- macOS: `brew install llvm@17` and make sure `clang-format` from `llvm@17` is in `PATH`
111-
- Windows: `choco install llvm --version=17.0.6 -y`
109+
- Linux (Ubuntu): `sudo apt-get install -y clang-format-17`, then point the default `clang-format` at 17.x (Spotless invokes `clang-format` on `PATH`, and Ubuntu may ship 18.x as the default):
110+
111+
`sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-17 100`
112+
113+
`sudo update-alternatives --set clang-format /usr/bin/clang-format-17`
114+
115+
- macOS: `brew install llvm@17`, then e.g. `ln -sf "$(brew --prefix llvm@17)/bin/clang-format" "$(brew --prefix)/bin/clang-format"` and/or put `$(brew --prefix llvm@17)/bin` on your `PATH`.
116+
117+
- Windows: `choco install llvm --version=17.0.6 --force -y` (CI uses `--force` like TsFile so the expected LLVM is selected).
112118

113119
### Validate only (no changes)
114120

pom.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@
150150
<!-- Override this to `true`, if you want to disable spotless -->
151151
<spotless.skip>false</spotless.skip>
152152
<spotless.version>2.44.5</spotless.version>
153+
<!-- C++: same pin as Apache TsFile (Spotless clang-format step). CI should expose this via PATH (see workflows). -->
154+
<clang.format.version>17.0.6</clang.format.version>
153155
<!-- This was the last version to support Java 8 -->
154156
<swagger.version>1.6.14</swagger.version>
155157
<thrift.exec-cmd.executable>chmod</thrift.exec-cmd.executable>
@@ -844,7 +846,7 @@
844846
<include>src/**/*.cpp</include>
845847
</includes>
846848
<clangFormat>
847-
<version>17.0.6</version>
849+
<version>${clang.format.version}</version>
848850
<style>file</style>
849851
</clangFormat>
850852
</cpp>

0 commit comments

Comments
 (0)