From a127704e4072a3066ac5de9a3ad4b3aa3570ed1c Mon Sep 17 00:00:00 2001 From: Archit Aggarwal Date: Fri, 25 Sep 2020 18:11:27 -0700 Subject: [PATCH] Update submodule configuration for hub repo cloning efficiency (#75) * Update submodules to not be auto cloned * Update README about submoduling CMock * Attempt to fix ci.yml * Fix submodule init issue * Add --recursive flags to submodule clone command * Add section link in README --- .github/workflows/ci.yml | 2 ++ .gitmodules | 3 +++ README.md | 10 +++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f7da74..305cb19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ jobs: steps: - name: Clone This Repo uses: actions/checkout@v2 + - name: Checkout CMock submodule + run: git submodule update --checkout --init --recursive test/unit-test/CMock - name: Build run: | sudo apt-get install -y lcov diff --git a/.gitmodules b/.gitmodules index e0ff332..9d3f0f2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,12 @@ [submodule "test/unit-test/CMock"] path = test/unit-test/CMock url = https://github.com/ThrowTheSwitch/CMock + update = none [submodule "test/cbmc/aws-templates-for-cbmc-proofs"] path = test/cbmc/aws-templates-for-cbmc-proofs url = https://github.com/awslabs/aws-templates-for-cbmc-proofs.git + update = none [submodule "test/cbmc/litani"] path = test/cbmc/litani url = https://github.com/awslabs/aws-build-accumulator + update = none diff --git a/README.md b/README.md index 02576b9..70da4c9 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,14 @@ For a CMake example of building the MQTT library with the `mqttFilePaths.cmake` ## Building Unit Tests +### Checkout CMock Submodule +By default, the submodules in this repository are configured with `update=none` in [.gitmodules](.gitmodules) to avoid increasing clone time and disk space usage of other repositories (like [amazon-freertos](https://github.com/aws/amazon-freertos) that submodule this repository. + +To build unit tests, the submodule dependency of CMock is required. Use the following command to clone the submodule: +``` +git submodule update --checkout --init --recursive --test/unit-test/CMock +``` + ### Platform Prerequisites - For running unit tests @@ -39,7 +47,7 @@ For a CMake example of building the MQTT library with the `mqttFilePaths.cmake` ### Steps to build **Unit Tests** -1. Go to the root directory of this repository. +1. Go to the root directory of this repository. (Make sure that the **CMock** submodule is cloned as described [above](#checkout-cmock-submodule)) 1. Run the *cmake* command: `cmake -S test -B build -DBUILD_CLONE_SUBMODULES=ON `