Skip to content

Commit d86ad8d

Browse files
authored
CI improvements (#273)
1 parent 8b90376 commit d86ad8d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+162
-109
lines changed

.clang-format

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
Language: Cpp
13
BasedOnStyle: Google
24
IndentWidth: 4
35
ColumnLimit: 120

.github/workflows/arduino_esp32.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
os: [ubuntu-latest]
3030

3131
steps:
32-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v4
3333

3434
- name: Install requirements
3535
run: |

.github/workflows/build-check.yaml

+25-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,28 @@ on:
2020
branches: [ '**' ]
2121

2222
jobs:
23+
run_tests:
24+
name: Run unit tests on ubuntu-latest
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
30+
- name: Build & run tests
31+
run: |
32+
sudo apt install -y ninja-build
33+
CMAKE_GENERATOR=Ninja make test
34+
35+
check_format:
36+
name: Check codebase format with clang-format
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v4
41+
42+
- name: Run clang-format dry-run
43+
run: find include/ src/ tests/ examples/ -iname "*.ino" -o -iname "*.h" -o -iname "*.c" | xargs clang-format -n -Werror
44+
2345
modular_build:
2446
name: Modular build on ubuntu-latest
2547
runs-on: ubuntu-latest
@@ -38,7 +60,8 @@ jobs:
3860

3961
- name: Build project
4062
run: |
41-
make all
63+
sudo apt install -y ninja-build
64+
CMAKE_GENERATOR=Ninja make
4265
python3 ./build/tests/modularity.py --pub $Z_FEATURE_PUBLICATION --sub $Z_FEATURE_SUBSCRIPTION --queryable $Z_FEATURE_QUERYABLE --query $Z_FEATURE_QUERY
4366
timeout-minutes: 5
4467
env:
@@ -51,4 +74,4 @@ jobs:
5174
if: always()
5275
run: |
5376
docker stop zenoh_router
54-
docker rm zenoh_router
77+
docker rm zenoh_router

.github/workflows/build-shared.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
matrix:
2929
os: [ubuntu-latest, macOS-latest, windows-latest]
3030
steps:
31-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v4
3232
- name: Compile debug
3333
run: make all
3434
env:
@@ -44,10 +44,10 @@ jobs:
4444
name: Build on ubuntu-latest
4545
runs-on: ubuntu-latest
4646
steps:
47-
- uses: actions/checkout@v2
47+
- uses: actions/checkout@v4
4848
- name: Crosscompile debug
4949
run: make crossbuilds
5050
env:
5151
BUILD_TYPE: Debug
5252
BUILD_SHARED_LIBS: ON
53-
ZENOH_DEBUG: 3
53+
ZENOH_DEBUG: 3

.github/workflows/build-static.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
matrix:
2929
os: [ubuntu-latest, macOS-latest, windows-latest]
3030
steps:
31-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v4
3232
- name: Compile debug
3333
run: make all
3434
env:
@@ -44,7 +44,7 @@ jobs:
4444
name: Build on ubuntu-latest
4545
runs-on: ubuntu-latest
4646
steps:
47-
- uses: actions/checkout@v2
47+
- uses: actions/checkout@v4
4848
- name: Crosscompile debug
4949
run: make crossbuilds
5050
env:

.github/workflows/codacy-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
steps:
2222
# Checkout the repository to the GitHub Actions runner
2323
- name: Checkout code
24-
uses: actions/checkout@v2
24+
uses: actions/checkout@v4
2525

2626
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
2727
- name: Run Codacy Analysis CLI

.github/workflows/emscripten.yaml

+3-5
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ jobs:
2828
matrix:
2929
os: [ubuntu-latest]
3030
steps:
31-
- uses: actions/checkout@v2
32-
- uses: jwlawson/actions-setup-cmake@v1.13
33-
- uses: mymindstorm/setup-emsdk@v11
31+
- uses: actions/checkout@v4
32+
- uses: jwlawson/actions-setup-cmake@v1.14
33+
- uses: mymindstorm/setup-emsdk@v12
3434
- name: Compile debug
3535
run: |
3636
mkdir build
3737
emcmake cmake -E env CFLAGS="-DZ_FEATURE_LINK_WS=1 -DZ_FEATURE_LINK_TCP=0 -DZ_FEATURE_LINK_UDP_MULTICAST=0 -DZ_FEATURE_LINK_UDP_UNICAST=0 -DZ_FEATURE_SCOUTING_UDP=0" cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_STANDARD=11 -DBUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=OFF -DBUILD_MULTICAST=OFF -DBUILD_INTEGRATION=OFF -DBUILD_TOOLS=OFF -DZENOH_DEBUG=3 -H. -Bbuild
3838
make -C build
39-
40-

.github/workflows/espidf.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
os: [ubuntu-latest]
3030

3131
steps:
32-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v4
3333

3434
- name: Install requirements
3535
run: |

.github/workflows/freertos_plus_tcp.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
matrix:
2929
os: [ubuntu-latest]
3030
steps:
31-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v4
3232
- uses: jwlawson/[email protected]
3333
- name: Install requirements
3434
run: |

.github/workflows/integration.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ jobs:
3232
os: [ ubuntu-latest, macOS-latest ]
3333

3434
steps:
35-
- uses: actions/checkout@v2
35+
- uses: actions/checkout@v4
3636

3737
- name: Install latest stable
38-
uses: actions-rs/toolchain@v1
38+
uses: actions-rs/toolchain@v1.0.7
3939
with:
4040
toolchain: stable
4141
override: true

.github/workflows/mbed.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
os: [ubuntu-latest]
3030

3131
steps:
32-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v4
3333

3434
- name: Install requirements
3535
run: |

.github/workflows/multicast.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
os: [macOS-latest]
3232

3333
steps:
34-
- uses: actions/checkout@v2
34+
- uses: actions/checkout@v4
3535

3636
- name: Compile debug
3737
run: make all

.github/workflows/release.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
name: Preparation
2626
runs-on: ubuntu-latest
2727
steps:
28-
- uses: actions/checkout@v2
28+
- uses: actions/checkout@v4
2929
- name: Environment setup
3030
id: env
3131
shell: bash
@@ -73,7 +73,7 @@ jobs:
7373
needs: preps
7474
runs-on: macos-latest
7575
steps:
76-
- uses: actions/checkout@v2
76+
- uses: actions/checkout@v4
7777
- name: MacOS build
7878
run: make
7979
env:
@@ -108,7 +108,7 @@ jobs:
108108
fail-fast: false
109109
matrix: ${{fromJson(needs.preps.outputs.TARGET_MATRIX)}}
110110
steps:
111-
- uses: actions/checkout@v2
111+
- uses: actions/checkout@v4
112112
- name: make for ${{ matrix.target }}
113113
env:
114114
BUILD_TYPE: RELEASE

.github/workflows/zephyr.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
os: [ubuntu-latest]
3030

3131
steps:
32-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v4
3333

3434
- name: Install requirements
3535
run: |

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ endif()
138138

139139
if(CMAKE_BUILD_TYPE MATCHES "DEBUG")
140140
if(UNIX)
141-
add_compile_options(-c -Wall -Wextra -Werror -Wunused -Wstrict-prototypes -pipe -g -O0)
141+
add_compile_options(-c -Wall -Wextra -Werror -Wshadow -Wpedantic -Wunused -Wstrict-prototypes -pipe -g -O0)
142142
elseif(MSVC)
143143
add_compile_options(/W4 /WX /Od)
144144
elseif(CMAKE_SYSTEM_NAME MATCHES "Generic")

examples/arduino/z_get.ino

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ void loop() {
122122
#else
123123
void setup() {
124124
Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.");
125+
return;
125126
}
126127
void loop() {}
127128
#endif

examples/arduino/z_pub.ino

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ void loop() {
111111
#else
112112
void setup() {
113113
Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.");
114+
return;
114115
}
115116
void loop() {}
116117
#endif

examples/arduino/z_pull.ino

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ void loop() {
112112
#else
113113
void setup() {
114114
Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.");
115+
return;
115116
}
116117
void loop() {}
117118
#endif

examples/arduino/z_queryable.ino

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ void loop() { delay(5000); }
111111
#else
112112
void setup() {
113113
Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.");
114+
return;
114115
}
115116
void loop() {}
116117
#endif

examples/arduino/z_sub.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ void loop() { delay(5000); }
109109
#else
110110
void setup() {
111111
Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.");
112+
return;
112113
}
113114
void loop() {}
114-
#endif
115+
#endif

examples/espidf/z_get.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,4 @@ void app_main() {
175175
}
176176
#else
177177
void app_main() { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n"); }
178-
#endif
178+
#endif

examples/espidf/z_pull.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,4 @@ void app_main() {
173173
void app_main() {
174174
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
175175
}
176-
#endif
176+
#endif

examples/espidf/z_sub.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,4 @@ void app_main() {
171171
void app_main() {
172172
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
173173
}
174-
#endif
174+
#endif

examples/freertos_plus_tcp/include/FreeRTOSIPConfig.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@
5151
#define ipconfigBUFFER_PADDING 14U
5252
#endif
5353

54-
#endif /* FREERTOS_IP_CONFIG_H */
54+
#endif /* FREERTOS_IP_CONFIG_H */

examples/freertos_plus_tcp/z_get.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@ void app_main(void) {
9898
void app_main(void) {
9999
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n");
100100
}
101-
#endif
101+
#endif

examples/freertos_plus_tcp/z_queryable.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ void app_main(void) {
9494
void app_main(void) {
9595
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n");
9696
}
97-
#endif
97+
#endif

examples/mbed/z_get.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ int main(void) {
100100
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it\n");
101101
return -2;
102102
}
103-
#endif
103+
#endif

examples/mbed/z_pub.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@ int main(void) {
9191
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
9292
return -2;
9393
}
94-
#endif
94+
#endif

examples/mbed/z_pull.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,4 @@ int main(void) {
9797
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
9898
return -2;
9999
}
100-
#endif
100+
#endif

examples/mbed/z_queryable.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ int main(void) {
100100
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n");
101101
return -2;
102102
}
103-
#endif
103+
#endif

examples/mbed/z_sub.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,4 @@ int main(void) {
9595
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
9696
return -2;
9797
}
98-
#endif
98+
#endif

examples/unix/c11/z_get.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ int main(int argc, char **argv) {
105105
char c = '\0';
106106
while (1) {
107107
fflush(stdin);
108-
scanf("%c", &c);
108+
int ret = scanf("%c", &c);
109+
(void)ret; // Remove unused result warning
109110
if (c == 'q') {
110111
break;
111112
}
@@ -135,4 +136,4 @@ int main(void) {
135136
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n");
136137
return -2;
137138
}
138-
#endif
139+
#endif

examples/unix/c11/z_ping.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,4 @@ int main(void) {
179179
"requires them.\n");
180180
return -2;
181181
}
182-
#endif
182+
#endif

examples/unix/c11/z_pong.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ int main(void) {
7676
"requires them.\n");
7777
return -2;
7878
}
79-
#endif
79+
#endif

examples/unix/c11/z_pub_st.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,4 @@ int main(void) {
109109
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
110110
return -2;
111111
}
112-
#endif
112+
#endif

examples/unix/c11/z_pull.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ int main(int argc, char **argv) {
8282
char c = '\0';
8383
while (1) {
8484
fflush(stdin);
85-
scanf("%c", &c);
85+
int ret = scanf("%c", &c);
86+
(void)ret; // Remove unused result warning
8687
if (c == 'q') {
8788
break;
8889
}
@@ -104,4 +105,4 @@ int main(void) {
104105
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
105106
return -2;
106107
}
107-
#endif
108+
#endif

0 commit comments

Comments
 (0)