Skip to content

Commit

Permalink
Created script for running all examples (#634)
Browse files Browse the repository at this point in the history
Signed-off-by: gsstoykov <georgi.stoykov@limechain.tech>
Signed-off-by: gsstoykov <146725010+gsstoykov@users.noreply.github.com>
Co-authored-by: Rob Walworth <110835868+rwalworth@users.noreply.github.com>
  • Loading branch information
gsstoykov and rwalworth authored Dec 6, 2023
1 parent a9c34a2 commit 7e47814
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 7 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
For MacOS and Linux users:

- ninja
- MacOS: `brew install ninja`
- Linux: `apt-get install ninja`
- MacOS: `brew install ninja`
- Linux: `apt-get install ninja`
- pkg-config
- MacOS: `brew install pkg-config`
- Linux: `apt-get install pkg-config`
- MacOS: `brew install pkg-config`
- Linux: `apt-get install pkg-config`
- cmake
- MacOS: `brew install cmake`
- Linux: `apt-get install cmake`
- MacOS: `brew install cmake`
- Linux: `apt-get install cmake`

📣 **Note**: Ensure you install all three `ninja`, `pkg-config`, and `cmake` to avoid errors in subsequent steps. The
installations might take a few minutes.
Expand Down Expand Up @@ -160,7 +160,15 @@ From there, you can run:
examples/<EXAMPLE_NAME>
```

__NOTE:__ Make sure you copy your `.env` file with your environment variables into this folder as well.
**NOTE:** Make sure you copy your `.env` file with your environment variables into this folder as well.

Additionally, the examples can be run using the `run_examples` scripts(`.sh` for macOS, Linux/ `.bat` for Windows systems) from the project root directory. In the scripts you will find an `EXECUTABLES_DIRECTORY` variable.

```
EXECUTABLES_DIRECTORY = <build_folder_with_exec_binaries>
```

Make sure to set it to the proper build folder of the binaries after building the project.

## Contributing to this Project

Expand Down
25 changes: 25 additions & 0 deletions run_examples.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@echo off

REM Script should be executed from project root
REM Directory containing executable files
set EXECUTABLES_DIRECTORY=build_folder_with_exec_binaries

if exist %EXECUTABLES_DIRECTORY% (
echo %EXECUTABLES_DIRECTORY% does exist.

REM Iterate over all executables in the directory
for %%f in (%EXECUTABLES_DIRECTORY%\*.exe) do (
if exist "%%f" (
echo Running %%f...

REM Execute the binary executable without additional arguments
"%%f"

echo Done
)
)
) else (
echo %EXECUTABLES_DIRECTORY% does not exist.
)

pause
21 changes: 21 additions & 0 deletions run_examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Script should be executed from project root
# Directory containing executable files
EXECUTABLES_DIRECTORY="build_folder_with_exec_binaries"

if [ -d "$EXECUTABLES_DIRECTORY" ]; then
echo "$EXECUTABLES_DIRECTORY does exist."
fi

# Iterate over all executables in the directory
for file in "$EXECUTABLES_DIRECTORY"/*; do
if [ -x "$file" ]; then
echo "Running $file..."

# Execute the binary executable without additional arguments
"$file"

echo "Done"
fi
done

0 comments on commit 7e47814

Please sign in to comment.