Skip to content

Commit db58280

Browse files
Add some CI
1 parent a1bc17f commit db58280

File tree

2 files changed

+78
-1
lines changed

2 files changed

+78
-1
lines changed

.github/workflows/ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#
2+
# Copyright © 2026-2026 ThingsBoard, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
name: CI
18+
19+
on:
20+
push:
21+
branches: [ master ]
22+
pull_request:
23+
branches: [ master ]
24+
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: true
28+
29+
jobs:
30+
build:
31+
name: Build
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Set up Java 25
37+
uses: actions/setup-java@v4
38+
with:
39+
distribution: temurin
40+
java-version: 25
41+
cache: maven
42+
43+
- name: Build
44+
run: mvn clean install -DskipTests
45+
46+
verify-codegen:
47+
name: Verify codegen
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v4
51+
52+
- name: Set up Java 25
53+
uses: actions/setup-java@v4
54+
with:
55+
distribution: temurin
56+
java-version: 25
57+
cache: maven
58+
59+
- name: Set up Node.js 20
60+
uses: actions/setup-node@v4
61+
with:
62+
node-version: 20
63+
64+
- name: Install openapi-generator-cli
65+
run: npm install -g @openapitools/openapi-generator-cli
66+
67+
- name: Regenerate all clients
68+
run: ./generate-client.sh all
69+
70+
- name: Check for drift
71+
run: |
72+
if ! git diff --cached --exit-code; then
73+
echo ""
74+
echo "Generated code is out of sync with specs."
75+
echo "Run './generate-client.sh all' locally and commit the changes."
76+
exit 1
77+
fi

generate-client.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ generate() {
190190
find "$output_dir/src" -name "*.java" -exec perl -i -0pe 's|/\*\n \* ThingsBoard REST API.*?\*/\n+||s' {} +
191191

192192
# Make ApiException unchecked (extend RuntimeException instead of Exception)
193-
sed -i '' 's/extends Exception/extends RuntimeException/' "$output_dir/src/main/java/org/thingsboard/client/ApiException.java"
193+
perl -i -pe 's/extends Exception/extends RuntimeException/' "$output_dir/src/main/java/org/thingsboard/client/ApiException.java"
194194

195195
if [ "$DRY_RUN" = true ]; then
196196
echo "Dry run: generated client is in $output_dir"

0 commit comments

Comments
 (0)