diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml index 8f6c3168..ba7b1ae5 100644 --- a/.github/workflows/main_ci.yml +++ b/.github/workflows/main_ci.yml @@ -29,7 +29,7 @@ jobs: - 'cmd' - 'lib' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run clang-format style check for C/C++ programs uses: jidicula/clang-format-action@v4.11.0 @@ -42,23 +42,37 @@ jobs: needs: formatting-check name: Quick Linux Check and Interop runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v3 + - name: Checkout repository and submodules + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 - name: Dependencies (Ubuntu) if: ${{ matrix.os == 'ubuntu-latest' }} run: | sudo apt-get install -y linux-headers-$(uname -r) - - name: Restore cache + # First, attempt to pull key key, if that is not present, pull one of the + # restore-keys so we do not need to build from scratch. + # VCPKG-BinaryCache - description of cache + # v1 - provide a way to reset cache + # runner.os - cache per OS + # hashFiles - Recache if the vcpkg.json changes + - name: Restore Cache uses: actions/cache@v3 with: path: ${{ github.workspace }}/build/cache - key: VCPKG-BinaryCache-${{ runner.os }} + key: VCPKG-BinaryCache-${{ runner.os }}-v1-${{ hashFiles('vcpkg.json', 'alternatives/openssl_3/vcpkg.json') }} + restore-keys: | + VCPKG-BinaryCache-${{ runner.os }}-v1 + VCPKG-BinaryCache-${{ runner.os }} - name: Build (OpenSSL 1.1) run: | - cmake -B "${{ env.CMAKE_BUILD_DIR }}" -DTESTING=ON -DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" + cmake -B "${{ env.CMAKE_BUILD_DIR }}" -DTESTING=ON -DCMAKE_TOOLCHAIN_FILE="vcpkg/scripts/buildsystems/vcpkg.cmake" cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target all --parallel 2 - name: Unit Test (OpenSSL 1.1) @@ -68,7 +82,7 @@ jobs: - name: Build (Interop Harness) run: | cd cmd/interop - cmake -B build -DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" + cmake -B build -DCMAKE_TOOLCHAIN_FILE="../../vcpkg/scripts/buildsystems/vcpkg.cmake" cmake --build build - name: Test self-interop @@ -86,7 +100,7 @@ jobs: - name: Build (OpenSSL 3) run: | - cmake -B "${{ env.CMAKE_BUILD_OPENSSL3_DIR }}" -DTESTING=ON -DVCPKG_MANIFEST_DIR="alternatives/openssl_3" -DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" + cmake -B "${{ env.CMAKE_BUILD_OPENSSL3_DIR }}" -DTESTING=ON -DVCPKG_MANIFEST_DIR="alternatives/openssl_3" -DCMAKE_TOOLCHAIN_FILE="vcpkg/scripts/buildsystems/vcpkg.cmake" cmake --build "${{ env.CMAKE_BUILD_OPENSSL3_DIR }}" - name: Unit Test (OpenSSL 3) @@ -104,20 +118,24 @@ jobs: os: [windows-latest, ubuntu-latest, macos-latest] include: - os: windows-latest - vcpkg-cmake-file: "$env:VCPKG_INSTALLATION_ROOT\\scripts\\buildsystems\\vcpkg.cmake" + vcpkg-cmake-file: "vcpkg\\scripts\\buildsystems\\vcpkg.cmake" ossl3-vcpkg-dir: "alternatives\\openssl_3" ctest-target: RUN_TESTS - os: ubuntu-latest - vcpkg-cmake-file: "$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" + vcpkg-cmake-file: "vcpkg/scripts/buildsystems/vcpkg.cmake" ossl3-vcpkg-dir: "alternatives/openssl_3" ctest-target: test - os: macos-latest - vcpkg-cmake-file: "$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" + vcpkg-cmake-file: "vcpkg/scripts/buildsystems/vcpkg.cmake" ossl3-vcpkg-dir: "alternatives/openssl_3" ctest-target: test steps: - - uses: actions/checkout@v3 + - name: Checkout repository and submodules + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 - name: Dependencies (macOs) if: ${{ matrix.os == 'macos-latest' }} @@ -131,11 +149,14 @@ jobs: run: | sudo apt-get install -y linux-headers-$(uname -r) - - name: Restore cache + - name: Restore Cache uses: actions/cache@v3 with: path: ${{ github.workspace }}/build/cache - key: VCPKG-BinaryCache-${{ runner.os }} + key: VCPKG-BinaryCache-${{ runner.os }}-v1-${{ hashFiles('vcpkg.json', 'alternatives/openssl_3/vcpkg.json') }} + restore-keys: | + VCPKG-BinaryCache-${{ runner.os }}-v1 + VCPKG-BinaryCache-${{ runner.os }} - name: Build (OpenSSL1.1) run: | @@ -163,12 +184,15 @@ jobs: env: CMAKE_BUILD_DIR: ${{ github.workspace }}/build - TOOLCHAIN_FILE: $VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake - VCPKG_BINARY_SOURCES: files,${{ github.workspace }}/build/cache,readwrite + TOOLCHAIN_FILE: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake MACOSX_DEPLOYMENT_TARGET: 10.11 steps: - - uses: actions/checkout@v3 + - name: Checkout repository and submodules + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 - name: dependencies run: | @@ -176,11 +200,14 @@ jobs: ln -s "/usr/local/opt/llvm/bin/clang-format" "/usr/local/bin/clang-format" ln -s "/usr/local/opt/llvm/bin/clang-tidy" "/usr/local/bin/clang-tidy" - - name: Restore cache + - name: Restore Cache uses: actions/cache@v3 with: path: ${{ github.workspace }}/build/cache - key: VCPKG-BinaryCache-${{ runner.os }} + key: VCPKG-BinaryCache-${{ runner.os }}-v1-${{ hashFiles('vcpkg.json', 'alternatives/openssl_3/vcpkg.json') }} + restore-keys: | + VCPKG-BinaryCache-${{ runner.os }}-v1 + VCPKG-BinaryCache-${{ runner.os }} - name: Build run: | diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..a0a57f3d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vcpkg"] + path = vcpkg + url = https://github.com/microsoft/vcpkg.git diff --git a/Makefile b/Makefile index 206d326e..bde4a406 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ TEST_DIR=build/test CLANG_FORMAT=clang-format -i CLANG_TIDY=OFF OPENSSL3_MANIFEST=alternatives/openssl_3 +TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake .PHONY: all dev dev3 test ctest dtest dbtest libs test-libs test-all everything ci ci3 clean cclean format @@ -25,7 +26,7 @@ dev: dev3: # Like `dev`, but using OpenSSL 3 - cmake -B${BUILD_DIR} -DTESTING=ON -DCMAKE_BUILD_TYPE=Debug -DVCPKG_MANIFEST_DIR=${OPENSSL3_MANIFEST} . + cmake -B${BUILD_DIR} -DTESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} -DVCPKG_MANIFEST_DIR=${OPENSSL3_MANIFEST} . test: ${BUILD_DIR} test/* cmake --build ${BUILD_DIR} --target mlspp_test diff --git a/vcpkg b/vcpkg new file mode 160000 index 00000000..962e5e39 --- /dev/null +++ b/vcpkg @@ -0,0 +1 @@ +Subproject commit 962e5e39f8a25f42522f51fffc574e05a3efd26b