adding vcpkg as a submodule to speed up CI #154
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: MLSPP CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
CMAKE_BUILD_DIR: ${{ github.workspace }}/build | |
CMAKE_TEST_DIR: ${{ github.workspace }}/build/test | |
CMAKE_BUILD_OPENSSL3_DIR: ${{ github.workspace }}/build_openssl3 | |
CMAKE_TEST_OPENSSL3_DIR: ${{ github.workspace }}/build_openssl3/test | |
VCPKG_BINARY_SOURCES: files,${{ github.workspace }}/build/cache,readwrite | |
TOOLCHAIN_FILE: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake | |
OPENSSL3_MANIFEST_DIR: ${{ github.workspace }}/alternatives/openssl_3 | |
DEFAULT_VCPKG_CONFIG: ${{ github.workspace }}/vcpkg.json | |
OPENSSL3_VCPKG_CONFIG: ${{ github.workspace }}/alternatives/openssl_3/vcpkg.json | |
VCPKG_REPO: ${{ github.workspace }}/vcpkg | |
DEFAULT_CTEST_TARGET: test | |
WINDOWS_CTEST_TARGET: RUN_TESTS | |
jobs: | |
formatting-check: | |
name: Formatting Check | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
path: | |
- 'include' | |
- 'src' | |
- 'test' | |
- 'cmd' | |
- 'lib' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run clang-format style check for C/C++ programs | |
uses: jidicula/[email protected] | |
with: | |
clang-format-version: '16' | |
check-path: ${{ matrix.path }} | |
fallback-style: 'Mozilla' | |
quick-linux-interop-check: | |
needs: formatting-check | |
name: Quick Linux Check and Interop | |
runs-on: ubuntu-latest | |
steps: | |
# check out the repository recursively pulling the submodules | |
- name: Checkout repository and submodules | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
# write the commit hash of vcpkg to a text file so we can use it in the | |
# hashFiles for cache | |
- run: | | |
git -C ${{ env.VCPKG_REPO }} rev-parse HEAD > vcpkg_commit.txt | |
- name: Dependencies (Ubuntu) | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
sudo apt-get install -y linux-headers-$(uname -r) | |
# 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 | |
# matrix.os - cache per OS and version | |
# hashFiles - Recache if the vcpkg files change | |
- name: Restore Cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/build/cache | |
key: VCPKG-BinaryCache-ubuntu-latest-0-v1-${{ hashFiles('vcpkg_commit.txt', 'vcpkg.json', 'alternatives/openssl_3/vcpkg.json') }} | |
restore-keys: | | |
VCPKG-BinaryCache-ubuntu-latest-0-v1 | |
VCPKG-BinaryCache-ubuntu-latest-0 | |
VCPKG-BinaryCache-ubuntu-latest | |
- name: Build (OpenSSL 1.1) | |
run: | | |
cmake -B "${{ env.CMAKE_BUILD_DIR }}" -DTESTING=ON -DCMAKE_TOOLCHAIN_FILE="${{ env.TOOLCHAIN_FILE }}" | |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target all --parallel 3 | |
- name: Unit Test (OpenSSL 1.1) | |
run: | | |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target test | |
- name: Build (Interop Harness) | |
run: | | |
cd cmd/interop | |
cmake -B build -DCMAKE_TOOLCHAIN_FILE="${{ env.TOOLCHAIN_FILE }}" | |
cmake --build build --parallel 3 | |
- name: Test self-interop | |
run: | | |
make -C cmd/interop self-test | |
- name: Test interop on test vectors | |
run: | | |
make -C cmd/interop interop-test | |
- name: Test gRPC live interop with self | |
run: | | |
cd cmd/interop | |
./grpc-self-test.sh | |
- name: Build (OpenSSL 3) | |
run: | | |
cmake -B "${{ env.CMAKE_BUILD_OPENSSL3_DIR }}" -DTESTING=ON -DVCPKG_MANIFEST_DIR="${{ env.OPENSSL3_MANIFEST_DIR }}" -DCMAKE_TOOLCHAIN_FILE="${{ env.TOOLCHAIN_FILE }}" | |
cmake --build "${{ env.CMAKE_BUILD_OPENSSL3_DIR }}" --parallel 3 | |
- name: Unit Test (OpenSSL 3) | |
run: | | |
cmake --build "${{ env.CMAKE_BUILD_OPENSSL3_DIR }}" --target test | |
# recently, the oldest supported macos image was added to this matrix. This is | |
# to ensure backward compatibility on existing integrations. The goal is to | |
# have the newest and oldest OS's represented for macOs. Only using latest | |
# windows and linux images because they have not been an challenge. | |
platform-sanitizer-tests: | |
if: github.event.pull_request.draft == false | |
needs: quick-linux-interop-check | |
name: Build and test platforms using sanitizers and clang-tidy | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
deployment_target: [0] | |
include: | |
- os: macos-latest | |
deployment_target: 10.11 | |
steps: | |
- name: Checkout repository and submodules | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
# write the commit hash of vcpkg to a text file so we can use it in the | |
# hashFiles for cache | |
- run: | | |
git -C ${{ env.VCPKG_REPO }} rev-parse HEAD > vcpkg_commit.txt | |
- name: Set Deployment Target | |
if: ${{ startsWith(matrix.os, 'macos') && matrix.deployment_target > 0 }} | |
run: | | |
echo "MACOSX_DEPLOYMENT_TARGET=${{ matrix.deployment_target }}" >> $GITHUB_ENV | |
# Because Homebrew promotes versions regularly this will locking llvm at 14 | |
- name: Dependencies (macOs) | |
if: ${{ startsWith(matrix.os, 'macos') }} | |
run: | | |
brew install llvm@14 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: Dependencies (Ubuntu) | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
sudo apt-get install -y linux-headers-$(uname -r) | |
- name: Restore Cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/build/cache | |
key: VCPKG-BinaryCache-${{ matrix.os }}-${{ matrix.deployment_target }}-v1-${{ hashFiles('vcpkg_commit.txt', 'vcpkg.json', 'alternatives/openssl_3/vcpkg.json') }} | |
restore-keys: | | |
VCPKG-BinaryCache-${{ matrix.os }}-${{ matrix.deployment_target }}-v1 | |
VCPKG-BinaryCache-${{ matrix.os }}-${{ matrix.deployment_target }} | |
VCPKG-BinaryCache-${{ matrix.os }} | |
- name: Build (OpenSSL1.1) | |
run: | | |
cmake -B "${{ env.CMAKE_BUILD_DIR }}" -DTESTING=ON -DCLANG_TIDY=ON -DSANITIZERS=ON -DCMAKE_TOOLCHAIN_FILE="${{ env.TOOLCHAIN_FILE }}" | |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --parallel 3 | |
- name: Unit Test (OpenSSL1.1) (Windows) | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target "${{ env.WINDOWS_CTEST_TARGET }}" | |
- name: Unit Test (OpenSSL1.1) (Non-Windows) | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: | | |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target "${{ env.DEFAULT_CTEST_TARGET }}" | |
- name: Build (OpenSSL3) | |
run: | | |
cmake -B "${{ env.CMAKE_BUILD_OPENSSL3_DIR }}" -DTESTING=ON -DCLANG_TIDY=ON -DSANITIZERS=ON -DVCPKG_MANIFEST_DIR="${{ env.OPENSSL3_MANIFEST_DIR }}" -DCMAKE_TOOLCHAIN_FILE="${{ env.TOOLCHAIN_FILE }}" | |
cmake --build "${{ env.CMAKE_BUILD_OPENSSL3_DIR }}" --parallel 3 | |
- name: Unit Test (OpenSSL3) (Windows) | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
cmake --build "${{ env.CMAKE_BUILD_OPENSSL3_DIR }}" --target "${{ env.WINDOWS_CTEST_TARGET }}" | |
- name: Unit Test (OpenSSL3) (Non-Windows) | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: | | |
cmake --build "${{ env.CMAKE_BUILD_OPENSSL3_DIR }}" --target "${{ env.DEFAULT_CTEST_TARGET }}" |