Skip to content

Commit c3d12af

Browse files
committed
Improve CI script by adding checks for existing directories before cloning/building yaml-cpp
- Prevent redundant cloning by verifying the existence and content of the yaml-cpp directory. - Ensure the build directory is only created if it doesn't already exist.
1 parent 1dc7b0c commit c3d12af

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/workflows/workflow.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,16 @@ jobs:
4848
ninja-build \
4949
clang
5050
# Build and install yaml-cpp from source
51-
git clone https://github.com/jbeder/yaml-cpp.git
51+
if [ ! -d "yaml-cpp" ] || [ -z "$(ls -A yaml-cpp)" ]; then
52+
# Directory doesn't exist or is empty, clone the repository
53+
rm -rf yaml-cpp # Remove directory if it exists but is empty
54+
git clone https://github.com/jbeder/yaml-cpp.git
55+
fi
5256
cd yaml-cpp
53-
cmake -B build -DCMAKE_BUILD_TYPE=Release -DYAML_BUILD_SHARED_LIBS=ON
57+
# Only create build directory if it doesn't exist
58+
if [ ! -d "build" ]; then
59+
cmake -B build -DCMAKE_BUILD_TYPE=Release -DYAML_BUILD_SHARED_LIBS=ON
60+
fi
5461
cmake --build build --config Release -j4
5562
sudo cmake --install build
5663
test-cmd: |

0 commit comments

Comments
 (0)