Skip to content

Commit

Permalink
adding vcpkg as a submodule to speed up CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Hewett committed Sep 12, 2023
1 parent c6de4ca commit 34dc8c6
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 19 deletions.
63 changes: 45 additions & 18 deletions .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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' }}
Expand All @@ -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: |
Expand Down Expand Up @@ -163,24 +184,30 @@ 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: |
brew install llvm pkg-config
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: |
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg.git
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions vcpkg
Submodule vcpkg added at 962e5e

0 comments on commit 34dc8c6

Please sign in to comment.