Skip to content

Commit

Permalink
feat: Add optional Tests/TCK builds (#824)
Browse files Browse the repository at this point in the history
Signed-off-by: gsstoykov <[email protected]>
  • Loading branch information
gsstoykov authored Nov 14, 2024
1 parent 50b6f54 commit d937521
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/zxc-build-library.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
VCPKG_BINARY_SOURCES: clear
run: |
echo "::group::Configure Project"
${{ steps.cgroup.outputs.exec }} cmake --preset ${{ matrix.preset }}-debug
${{ steps.cgroup.outputs.exec }} cmake --preset ${{ matrix.preset }}-debug -DBUILD_TESTS=ON
echo "::endgroup::"
echo "::group::Build Project"
Expand All @@ -143,7 +143,7 @@ jobs:
VCPKG_BINARY_SOURCES: clear
run: |
echo "::group::Configure Project"
${{ steps.cgroup.outputs.exec }} cmake --preset ${{ matrix.preset }}-release
${{ steps.cgroup.outputs.exec }} cmake --preset ${{ matrix.preset }}-release -DBUILD_TESTS=ON
echo "::endgroup::"
echo "::group::Build Project"
Expand Down
39 changes: 33 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,56 @@ git clone https://github.com/hiero-ledger/hiero-sdk-cpp.git
cd hiero-sdk-cpp
```

3. Complete the following tasks within your project directory for the build you want
3. You can configure and build the project for various platforms using CMake presets. Additionally, optional components like TCK and Tests can be included in the build using flags.

```sh
# Ensure the VCPkg Submodule is initialized
git submodule update --init

# Windows (x64) Build
cmake --preset windows-x64-release
cmake --preset windows-x64-release -DBUILD_TCK=ON -DBUILD_TESTS=ON
cmake --build --preset windows-x64-release

# Linux (x64) Build
cmake --preset linux-x64-release
cmake --preset linux-x64-release -DBUILD_TCK=ON -DBUILD_TESTS=ON
cmake --build --preset linux-x64-release

# MacOS (Intel x64) Build
cmake --preset macos-x64-release
cmake --preset macos-x64-release -DBUILD_TCK=ON -DBUILD_TESTS=ON
cmake --build --preset macos-x64-release

# MacOS (Aarch64) Build
cmake --preset macos-arm64-release
cmake --preset macos-arm64-release -DBUILD_TCK=ON -DBUILD_TESTS=ON
cmake --build --preset macos-arm64-release
```

Optional Build Flags
The project supports the following optional flags to include or exclude specific components:

`BUILD_TCK`

```
Description: Controls whether the TCK tests are included in the build.
Default: OFF
Enable: Add -DBUILD_TCK=ON during configuration.
```

`BUILD_TESTS`

```
Description: Controls whether the test suite is included in the build.
Default: OFF
Enable: Add -DBUILD_TESTS=ON during configuration.
```

`BUILD_EXAMPLES`

```
Description: Controls whether the user examples are included in the build.
Default: OFF
Enable: Add -DBUILD_EXAMPLES=ON during configuration.
```

## Testing

To run all SDK tests (for Release or Debug builds):
Expand Down Expand Up @@ -177,7 +204,7 @@ More instructions for contribution can be found in the

## Code of Conduct

Hiero uses the Linux Foundation Decentralised Trust [Code of Conduct]([https://github.com/hashgraph/.github/blob/main/CODE_OF_CONDUCT.md](https://www.lfdecentralizedtrust.org/code-of-conduct)).
Hiero uses the Linux Foundation Decentralised Trust [Code of Conduct](<[https://github.com/hashgraph/.github/blob/main/CODE_OF_CONDUCT.md](https://www.lfdecentralizedtrust.org/code-of-conduct)>).

## License

Expand Down
10 changes: 9 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
add_subdirectory(sdk)
add_subdirectory(tck)
# Optional TCK build
option(BUILD_TCK "Build the TCK tests" OFF)

if(BUILD_TCK)
message(STATUS "Including TCK tests in the build.")
add_subdirectory(tck)
else()
message(STATUS "TCK tests are not included in the build.")
endif()
20 changes: 18 additions & 2 deletions src/sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
add_subdirectory(examples)
# Optional Examples build
option(BUILD_EXAMPLES "Build the example builds" OFF)

if(BUILD_EXAMPLES)
message(STATUS "Including examples in the build.")
add_subdirectory(tests)
else()
message(STATUS "Examples are not included in the build.")
endif()
add_subdirectory(main)
add_subdirectory(tests)
# Optional Tests build
option(BUILD_TESTS "Build the test suite" OFF)

if(BUILD_TESTS)
message(STATUS "Including tests in the build.")
add_subdirectory(tests)
else()
message(STATUS "Tests are not included in the build.")
endif()

0 comments on commit d937521

Please sign in to comment.