Skip to content

Commit 1eb0831

Browse files
andrechiarelliAndre Chiarelliohtanim
authored
Adjust Rust Lint CI (#30)
* fix main.rs lint * Clean Rust lint dependencies * Clean Rust lint dependencies * Review C lint workflow * Adjust build dependency order * Build daapi_c * Build daapi_c * Build daapi_c * Build daapi_c * Build daapi_c * Build daapi_c * Adjsut Rust lint * Adjsut Rust lint * removed unused include path * remove unnecessary libs --------- Co-authored-by: Andre Chiarelli <[email protected]> Co-authored-by: Munetaka Ohtani <[email protected]>
1 parent a654d8e commit 1eb0831

File tree

2 files changed

+31
-55
lines changed

2 files changed

+31
-55
lines changed

.github/workflows/linting.yaml

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,14 @@ jobs:
2323
sudo apt-get update
2424
sudo apt-get install -y clang-tidy
2525
sudo apt-get install -y slurm-wlm slurm-wlm-basic-plugins libslurm-dev
26-
git clone https://github.com/DaveGamble/cJSON.git
27-
cd cJSON
28-
mkdir build && cd build
29-
cmake ..
30-
make -j$(nproc)
31-
sudo make install
32-
33-
- name: Debug cJSON Installation
34-
run: |
35-
echo "Checking cJSON installation..."
36-
echo "cJSON include directory:"
37-
find /usr -type d -name "cjson" 2>/dev/null
38-
echo "cJSON library files:"
39-
find /usr -type f -name "libcjson*" 2>/dev/null
40-
echo "cJSON CMake files:"
41-
find /usr -type f -name "cJSONConfig.cmake" 2>/dev/null
4226
4327
- name: Install pkg-config
4428
run: sudo apt-get install -y pkg-config
4529

4630
- name: Set up C environment
4731
run: |
48-
mkdir -p build_skeleton build_spank_ibm_qrun daapi_c
49-
cd daapi_c
50-
cmake ../commands/qrun/daapi_c/app -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
51-
cd ../build_skeleton
32+
mkdir -p build_skeleton build_spank_ibm_qrun
33+
cd build_skeleton
5234
cmake ../plugins/skeleton -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
5335
cd ../build_spank_ibm_qrun
5436
cmake ../plugins/spank_ibm_qrun -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
@@ -84,33 +66,36 @@ jobs:
8466
- name: Checkout repository
8567
uses: actions/[email protected]
8668

87-
- name: Install Dependencies
88-
run: |
89-
sudo apt-get update
90-
sudo apt-get install -y clang-tidy
91-
sudo apt-get install -y slurm-wlm slurm-wlm-basic-plugins libslurm-dev
92-
git clone https://github.com/DaveGamble/cJSON.git
93-
cd cJSON
94-
mkdir build && cd build
95-
cmake ..
96-
make -j$(nproc)
97-
sudo make install
98-
99-
- name: Install pkg-config
100-
run: sudo apt-get install -y pkg-config
101-
102-
- name: Set up C environment
103-
run: |
104-
mkdir -p daapi_c
105-
cd daapi_c
106-
cmake ../commands/qrun/daapi_c/app -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
107-
cd ../../
108-
10969
- name: Install Rust
11070
run: |
11171
rustup update stable
11272
rustup component add clippy rustfmt
11373
rustfmt --version
74+
75+
- name: Set up Python ${{ env.PYTHON_VERSION }}
76+
uses: actions/setup-python@v5
77+
with:
78+
python-version: ${{ env.PYTHON_VERSION }}
79+
80+
- name: Run rustfmt (daapi_c)
81+
working-directory: commands/qrun/daapi_c
82+
run: |
83+
cargo fmt --all -- --check
84+
cargo build --release
85+
86+
- name: Build daapi_c/app
87+
working-directory: commands/qrun/daapi_c/app
88+
run: |
89+
python -m pip install --upgrade pip
90+
pip install conan
91+
conan profile detect
92+
conan install conanfile.txt --build=missing
93+
pushd build
94+
cJSON_DIR=./Release/generators cmake .. -DCMAKE_BUILD_TYPE=Release
95+
popd
96+
cd build
97+
make clean
98+
make
11499
115100
- name: Run rustfmt (daapi)
116101
working-directory: commands/qrun/daapi

commands/qrun/daapi_c/app/CMakeLists.txt

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
cmake_minimum_required(VERSION 3.10)
2-
32
set(CMAKE_CXX_STANDARD 17)
43
SET(CMAKE_OSX_DEPLOYMENT_TARGET 15.2)
54

@@ -13,15 +12,7 @@ endif()
1312

1413
set(PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
1514

16-
# Ensure CMake can find cJSON
17-
set(CJSON_SEARCH_PATHS
18-
$ENV{CJSON_DIR}
19-
/usr/local/lib/cmake/cJSON
20-
/usr/lib/cmake/cJSON
21-
/usr/share/cmake/cJSON
22-
)
23-
24-
find_package(cJSON REQUIRED CONFIG PATHS ${CJSON_SEARCH_PATHS} NO_DEFAULT_PATH)
15+
find_package(cJSON REQUIRED)
2516

2617
function(add_example TARGET_NAME CPP_FILE)
2718
# source files for the client app
@@ -36,10 +27,9 @@ function(add_example TARGET_NAME CPP_FILE)
3627
target_link_libraries(${TARGET_NAME}
3728
PUBLIC
3829
"-L${PROJECT_ROOT}/target/${LIB_PATH} -Wl,-rpath ${PROJECT_ROOT}/target/${LIB_PATH}" direct_access_capi
39-
"-lm -lstdc++"
4030
)
4131

42-
target_link_libraries(${TARGET_NAME} PRIVATE cJSON)
32+
target_link_libraries(${TARGET_NAME} PRIVATE cjson::cjson)
4333

4434
if (APPLE)
4535
target_link_libraries(${TARGET_NAME} PUBLIC "-framework Security")
@@ -50,12 +40,13 @@ function(add_example TARGET_NAME CPP_FILE)
5040
target_link_libraries(${TARGET_NAME} PUBLIC "-lcrypto")
5141
target_link_libraries(${TARGET_NAME} PUBLIC "-ldl")
5242
target_link_libraries(${TARGET_NAME} PUBLIC "-lpthread")
43+
target_link_libraries(${TARGET_NAME} PUBLIC "-lm")
5344
endif()
5445

46+
# path to headerfile
5547
target_include_directories(${TARGET_NAME}
5648
PRIVATE
5749
${CMAKE_CURRENT_SOURCE_DIR}/..
58-
/usr/local/include
5950
)
6051

6152
install (TARGETS ${TARGET_NAME} DESTINATION .)

0 commit comments

Comments
 (0)