Skip to content

build: install openssl via vcpkg on windows #188

build: install openssl via vcpkg on windows

build: install openssl via vcpkg on windows #188

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
linux:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- compiler: gcc
cc: gcc-13
cxx: g++-13
- compiler: gcc
cc: gcc-14
cxx: g++-14
- compiler: clang
cc: clang-18
cxx: clang++-18
name: Linux (${{ matrix.cxx }})
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev ${{ matrix.cc }} ${{ matrix.cxx }}
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: linux-${{ matrix.cxx }}
- name: Configure
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_TESTS=ON \
-DBUILD_SAMPLES=OFF \
-DBUILD_APPLICATIONS=OFF \
-DENABLE_WARNINGS_ARE_ERRORS=ON
- name: Build
run: cmake --build build --parallel $(nproc)
- name: Test
run: ctest --test-dir build --output-on-failure --parallel $(nproc)
macos:
runs-on: macos-14
name: macOS (AppleClang)
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Install dependencies
run: brew install openssl@3
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: macos
- name: Configure
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3) \
-DBUILD_TESTS=ON \
-DBUILD_SAMPLES=OFF \
-DBUILD_APPLICATIONS=OFF \
-DENABLE_WARNINGS_ARE_ERRORS=ON
- name: Build
run: cmake --build build --parallel $(sysctl -n hw.logicalcpu)
- name: Test
run: ctest --test-dir build --output-on-failure --parallel $(sysctl -n hw.logicalcpu)
macos-system-deps:
runs-on: macos-14
name: macOS (System Deps + FFmpeg)
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Install dependencies
run: |
brew install pkgconf openssl@3 ffmpeg libuv llhttp minizip
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: macos-system-deps
- name: Configure
run: |
HOMEBREW_PREFIX=$(brew --prefix)
OPENSSL_PREFIX=$(brew --prefix openssl@3)
formulas=(openssl@3 ffmpeg libuv llhttp minizip)
pkg_config_paths=()
cmake_prefix_paths=()
cmake_library_paths=()
cmake_include_paths=()
for formula in "${formulas[@]}"; do
prefix=$(brew --prefix "${formula}")
pkg_config_paths+=("${prefix}/lib/pkgconfig")
cmake_prefix_paths+=("${prefix}")
cmake_library_paths+=("${prefix}/lib")
cmake_include_paths+=("${prefix}/include")
done
export PKG_CONFIG_PATH="$(IFS=:; echo "${pkg_config_paths[*]}")"
CMAKE_PREFIX_PATH_VALUE="$(IFS=';'; echo "${cmake_prefix_paths[*]}")"
CMAKE_LIBRARY_PATH_VALUE="$(IFS=';'; echo "${cmake_library_paths[*]}")"
CMAKE_INCLUDE_PATH_VALUE="$(IFS=';'; echo "${cmake_include_paths[*]}")"
cmake -B build-system-deps \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_SHARED_LIBS=ON \
-DUSE_SYSTEM_DEPS=ON \
-DBUILD_TESTS=OFF \
-DBUILD_SAMPLES=OFF \
-DBUILD_APPLICATIONS=OFF \
-DBUILD_FUZZERS=OFF \
-DBUILD_BENCHMARKS=OFF \
-DBUILD_PERF=OFF \
-DBUILD_ALPHA=OFF \
-DBUILD_MODULE_webrtc=OFF \
-DWITH_FFMPEG=ON \
-DWITH_LIBDATACHANNEL=OFF \
-DOPENSSL_ROOT_DIR="${OPENSSL_PREFIX}" \
-DPKG_CONFIG_EXECUTABLE="${HOMEBREW_PREFIX}/bin/pkg-config" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH_VALUE}" \
-DCMAKE_LIBRARY_PATH="${CMAKE_LIBRARY_PATH_VALUE}" \
-DCMAKE_INCLUDE_PATH="${CMAKE_INCLUDE_PATH_VALUE}"
- name: Build
run: cmake --build build-system-deps --parallel $(sysctl -n hw.logicalcpu)
windows:
runs-on: windows-2022
name: Windows (MSVC 2022)
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Install OpenSSL
shell: pwsh
run: |
$vcpkgRoot = if ($env:VCPKG_INSTALLATION_ROOT) { $env:VCPKG_INSTALLATION_ROOT } else { 'C:\vcpkg' }
$vcpkgExe = Join-Path $vcpkgRoot 'vcpkg.exe'
if (-not (Test-Path $vcpkgExe)) {
throw "vcpkg.exe not found at $vcpkgExe"
}
& $vcpkgExe install openssl:x64-windows
if ($LASTEXITCODE -ne 0) {
throw 'vcpkg failed to install openssl:x64-windows'
}
$resolved = Join-Path $vcpkgRoot 'installed\x64-windows'
$includeDir = Join-Path $resolved 'include\openssl\ssl.h'
$libCrypto = Join-Path $resolved 'lib\libcrypto.lib'
$libSsl = Join-Path $resolved 'lib\libssl.lib'
$binDir = Join-Path $resolved 'bin'
if (-not ((Test-Path $includeDir) -and (Test-Path $libCrypto) -and (Test-Path $libSsl))) {
throw "OpenSSL files missing under $resolved after vcpkg install"
}
if (Test-Path $binDir) {
Add-Content -Path $env:GITHUB_PATH -Value $binDir
}
"OPENSSL_ROOT_DIR=$resolved" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
variant: sccache
key: windows
- name: Configure
run: |
cmake -B build -G "Visual Studio 17 2022" -A x64 `
-DBUILD_TESTS=ON `
-DBUILD_SAMPLES=OFF `
-DBUILD_APPLICATIONS=OFF `
-DENABLE_WARNINGS_ARE_ERRORS=ON `
-DOPENSSL_ROOT_DIR="${{ env.OPENSSL_ROOT_DIR }}" `
-DCMAKE_C_COMPILER_LAUNCHER=sccache `
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
- name: Build
run: cmake --build build --config Release --parallel
- name: Test
run: ctest --test-dir build -C Release --output-on-failure --parallel
webrtc:
runs-on: ubuntu-24.04
name: WebRTC (libdatachannel + FFmpeg)
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev \
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: webrtc
- name: Configure
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=gcc-14 \
-DCMAKE_CXX_COMPILER=g++-14 \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DWITH_FFMPEG=ON \
-DWITH_LIBDATACHANNEL=ON \
-DBUILD_TESTS=ON \
-DBUILD_SAMPLES=OFF \
-DBUILD_APPLICATIONS=OFF \
-DENABLE_WARNINGS_ARE_ERRORS=ON
- name: Build
run: cmake --build build --parallel $(nproc)
- name: Test
run: ctest --test-dir build --output-on-failure --parallel $(nproc)
sanitizers:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
sanitizer: [address, thread, undefined]
include:
- sanitizer: address
flags: -fsanitize=address -fno-omit-frame-pointer
env_name: ASAN_OPTIONS
env_value: detect_leaks=1
- sanitizer: thread
flags: -fsanitize=thread
env_name: TSAN_OPTIONS
env_value: second_deadlock_stack=1
- sanitizer: undefined
flags: -fsanitize=undefined -fno-sanitize-recover=all
env_name: UBSAN_OPTIONS
env_value: print_stacktrace=1
name: Sanitizer (${{ matrix.sanitizer }})
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libssl-dev clang-18
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: sanitizer-${{ matrix.sanitizer }}
- name: Configure
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=clang-18 \
-DCMAKE_CXX_COMPILER=clang++-18 \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_FLAGS="${{ matrix.flags }}" \
-DCMAKE_CXX_FLAGS="${{ matrix.flags }}" \
-DBUILD_TESTS=ON \
-DBUILD_SAMPLES=OFF \
-DBUILD_APPLICATIONS=OFF
- name: Build
run: cmake --build build --parallel $(nproc)
- name: Test
env:
${{ matrix.env_name }}: ${{ matrix.env_value }}
run: ctest --test-dir build --output-on-failure --parallel $(nproc)
coverage:
runs-on: ubuntu-24.04
name: Coverage
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev lcov
- name: Configure
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=gcc-14 \
-DCMAKE_CXX_COMPILER=g++-14 \
-DCMAKE_C_FLAGS="--coverage" \
-DCMAKE_CXX_FLAGS="--coverage" \
-DCMAKE_EXE_LINKER_FLAGS="--coverage" \
-DBUILD_TESTS=ON \
-DBUILD_SAMPLES=OFF \
-DBUILD_APPLICATIONS=OFF
- name: Build
run: cmake --build build --parallel $(nproc)
- name: Test
run: ctest --test-dir build --output-on-failure --parallel $(nproc)
- name: Collect coverage
run: |
echo "=== Looking for .gcno files ==="
find build -name '*.gcno' | head -20
echo "=== Looking for .gcda files ==="
find build -name '*.gcda' | head -20 || true
echo "=== Collecting coverage ==="
lcov --capture --directory build --output-file coverage.info \
--gcov-tool gcov-14 --ignore-errors mismatch,empty
lcov --remove coverage.info '/usr/*' '*/build/_deps/*' '*/vendor/*' '*/test/*' \
--output-file coverage.info --ignore-errors unused,empty
lcov --list coverage.info || true
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: coverage.info
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}