Skip to content

Commit

Permalink
CI improvements (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland authored Nov 9, 2023
1 parent 8b90376 commit d86ad8d
Show file tree
Hide file tree
Showing 66 changed files with 162 additions and 109 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
Language: Cpp
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 120
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/arduino_esp32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install requirements
run: |
Expand Down
27 changes: 25 additions & 2 deletions .github/workflows/build-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@ on:
branches: [ '**' ]

jobs:
run_tests:
name: Run unit tests on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build & run tests
run: |
sudo apt install -y ninja-build
CMAKE_GENERATOR=Ninja make test
check_format:
name: Check codebase format with clang-format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run clang-format dry-run
run: find include/ src/ tests/ examples/ -iname "*.ino" -o -iname "*.h" -o -iname "*.c" | xargs clang-format -n -Werror

modular_build:
name: Modular build on ubuntu-latest
runs-on: ubuntu-latest
Expand All @@ -38,7 +60,8 @@ jobs:

- name: Build project
run: |
make all
sudo apt install -y ninja-build
CMAKE_GENERATOR=Ninja make
python3 ./build/tests/modularity.py --pub $Z_FEATURE_PUBLICATION --sub $Z_FEATURE_SUBSCRIPTION --queryable $Z_FEATURE_QUERYABLE --query $Z_FEATURE_QUERY
timeout-minutes: 5
env:
Expand All @@ -51,4 +74,4 @@ jobs:
if: always()
run: |
docker stop zenoh_router
docker rm zenoh_router
docker rm zenoh_router
6 changes: 3 additions & 3 deletions .github/workflows/build-shared.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Compile debug
run: make all
env:
Expand All @@ -44,10 +44,10 @@ jobs:
name: Build on ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Crosscompile debug
run: make crossbuilds
env:
BUILD_TYPE: Debug
BUILD_SHARED_LIBS: ON
ZENOH_DEBUG: 3
ZENOH_DEBUG: 3
4 changes: 2 additions & 2 deletions .github/workflows/build-static.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Compile debug
run: make all
env:
Expand All @@ -44,7 +44,7 @@ jobs:
name: Build on ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Crosscompile debug
run: make crossbuilds
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codacy-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/emscripten.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ jobs:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: jwlawson/actions-setup-cmake@v1.13
- uses: mymindstorm/setup-emsdk@v11
- uses: actions/checkout@v4
- uses: jwlawson/actions-setup-cmake@v1.14
- uses: mymindstorm/setup-emsdk@v12
- name: Compile debug
run: |
mkdir build
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
make -C build
2 changes: 1 addition & 1 deletion .github/workflows/espidf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install requirements
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/freertos_plus_tcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: jwlawson/actions-setup-cmake@v1.13
- name: Install requirements
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:
os: [ ubuntu-latest, macOS-latest ]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install latest stable
uses: actions-rs/toolchain@v1
uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mbed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install requirements
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/multicast.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
os: [macOS-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Compile debug
run: make all
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
name: Preparation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Environment setup
id: env
shell: bash
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
needs: preps
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: MacOS build
run: make
env:
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
fail-fast: false
matrix: ${{fromJson(needs.preps.outputs.TARGET_MATRIX)}}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: make for ${{ matrix.target }}
env:
BUILD_TYPE: RELEASE
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zephyr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install requirements
run: |
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ endif()

if(CMAKE_BUILD_TYPE MATCHES "DEBUG")
if(UNIX)
add_compile_options(-c -Wall -Wextra -Werror -Wunused -Wstrict-prototypes -pipe -g -O0)
add_compile_options(-c -Wall -Wextra -Werror -Wshadow -Wpedantic -Wunused -Wstrict-prototypes -pipe -g -O0)
elseif(MSVC)
add_compile_options(/W4 /WX /Od)
elseif(CMAKE_SYSTEM_NAME MATCHES "Generic")
Expand Down
1 change: 1 addition & 0 deletions examples/arduino/z_get.ino
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ void loop() {
#else
void setup() {
Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.");
return;
}
void loop() {}
#endif
1 change: 1 addition & 0 deletions examples/arduino/z_pub.ino
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ void loop() {
#else
void setup() {
Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.");
return;
}
void loop() {}
#endif
1 change: 1 addition & 0 deletions examples/arduino/z_pull.ino
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void loop() {
#else
void setup() {
Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.");
return;
}
void loop() {}
#endif
1 change: 1 addition & 0 deletions examples/arduino/z_queryable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ void loop() { delay(5000); }
#else
void setup() {
Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.");
return;
}
void loop() {}
#endif
3 changes: 2 additions & 1 deletion examples/arduino/z_sub.ino
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ void loop() { delay(5000); }
#else
void setup() {
Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.");
return;
}
void loop() {}
#endif
#endif
2 changes: 1 addition & 1 deletion examples/espidf/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,4 @@ void app_main() {
}
#else
void app_main() { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n"); }
#endif
#endif
2 changes: 1 addition & 1 deletion examples/espidf/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ void app_main() {
void app_main() {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
}
#endif
#endif
2 changes: 1 addition & 1 deletion examples/espidf/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,4 @@ void app_main() {
void app_main() {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
}
#endif
#endif
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/include/FreeRTOSIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
#define ipconfigBUFFER_PADDING 14U
#endif

#endif /* FREERTOS_IP_CONFIG_H */
#endif /* FREERTOS_IP_CONFIG_H */
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ void app_main(void) {
void app_main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n");
}
#endif
#endif
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ void app_main(void) {
void app_main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n");
}
#endif
#endif
2 changes: 1 addition & 1 deletion examples/mbed/z_get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it\n");
return -2;
}
#endif
#endif
2 changes: 1 addition & 1 deletion examples/mbed/z_pub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -2;
}
#endif
#endif
2 changes: 1 addition & 1 deletion examples/mbed/z_pull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -2;
}
#endif
#endif
2 changes: 1 addition & 1 deletion examples/mbed/z_queryable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n");
return -2;
}
#endif
#endif
2 changes: 1 addition & 1 deletion examples/mbed/z_sub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -2;
}
#endif
#endif
5 changes: 3 additions & 2 deletions examples/unix/c11/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ int main(int argc, char **argv) {
char c = '\0';
while (1) {
fflush(stdin);
scanf("%c", &c);
int ret = scanf("%c", &c);
(void)ret; // Remove unused result warning
if (c == 'q') {
break;
}
Expand Down Expand Up @@ -135,4 +136,4 @@ int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n");
return -2;
}
#endif
#endif
2 changes: 1 addition & 1 deletion examples/unix/c11/z_ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ int main(void) {
"requires them.\n");
return -2;
}
#endif
#endif
2 changes: 1 addition & 1 deletion examples/unix/c11/z_pong.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ int main(void) {
"requires them.\n");
return -2;
}
#endif
#endif
2 changes: 1 addition & 1 deletion examples/unix/c11/z_pub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -2;
}
#endif
#endif
5 changes: 3 additions & 2 deletions examples/unix/c11/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ int main(int argc, char **argv) {
char c = '\0';
while (1) {
fflush(stdin);
scanf("%c", &c);
int ret = scanf("%c", &c);
(void)ret; // Remove unused result warning
if (c == 'q') {
break;
}
Expand All @@ -104,4 +105,4 @@ int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -2;
}
#endif
#endif
Loading

0 comments on commit d86ad8d

Please sign in to comment.