github: add release workflow #55
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: C/C++ CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: "Windows MSVC17 shared library using LibreSSL" | |
os: windows-2022 | |
generator: -G "Visual Studio 17 2022" -A x64 | |
libressl: -DOPENSSL_ROOT_DIR:PATH=build/external/libressl/install | |
# don't use Debug to work around issue of FindOpenSSL.cmake which leaves us with | |
# -- Found OpenSSL: optimized;D:/a/sockpuppet/sockpuppet/build/external/libressl/install/lib/crypto.lib;debug;C:/Program Files/OpenSSL/lib/VC/libcrypto64MDd.lib (found version "2.0.0") | |
# which fails at link time | |
type: Release | |
- name: "Windows MSVC17 shared library using OpenSSL" | |
os: windows-2022 | |
generator: -G "Visual Studio 17 2022" -A x64 | |
# uses pre-installed OpenSSL 1.1.1u | |
type: Debug | |
- name: "Unix GCC shared library using LibreSSL" | |
os: ubuntu-latest | |
generator: -G "Unix Makefiles" | |
libressl: -DOPENSSL_ROOT_DIR:PATH=build/external/libressl/install | |
type: Debug | |
- name: "Unix GCC shared library using OpenSSL" | |
os: ubuntu-latest | |
generator: -G "Unix Makefiles" | |
# uses pre-installed OpenSSL 3.0.2 | |
type: Debug | |
- name: "OSX clang shared library using LibreSSL" | |
os: macos-latest | |
generator: -G "Unix Makefiles" | |
libressl: -DOPENSSL_ROOT_DIR:PATH=build/external/libressl/install | |
type: Debug | |
- name: "OSX clang shared library using OpenSSL" | |
os: macos-latest | |
generator: -G "Unix Makefiles" | |
# uses pre-installed OpenSSL 3.1.1 | |
type: Debug | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache externals restore | |
id: cache-externals-restore | |
if: matrix.libressl | |
uses: actions/cache/restore@v3 | |
with: | |
path: build/external/libressl/install | |
key: ${{ matrix.os }}-externals-${{ hashFiles('external/CMakeLists.txt') }} | |
- name: configure externals | |
if: matrix.libressl && (steps.cache-externals-restore.outputs.cache-hit != 'true') | |
run: > | |
cmake | |
-B build/external | |
-S external | |
${{ matrix.generator }} | |
-DCMAKE_BUILD_TYPE:STRING=${{ matrix.type }} | |
- name: build externals | |
if: matrix.libressl && (steps.cache-externals-restore.outputs.cache-hit != 'true') | |
run: cmake --build build/external --config ${{ matrix.type }} | |
- name: cache externals save | |
id: cache-externals-save | |
if: matrix.libressl | |
uses: actions/cache/save@v3 | |
with: | |
path: build/external/libressl/install | |
key: ${{ steps.cache-externals-restore.outputs.cache-primary-key }} | |
- name: configure library | |
run: > | |
cmake | |
-B build | |
-S . | |
${{ matrix.generator }} | |
-DBUILD_SHARED_LIBS:BOOL=ON | |
-DWITH_TLS:BOOL=ON | |
${{ matrix.libressl }} | |
-DCMAKE_BUILD_TYPE:STRING=${{ matrix.type }} | |
- name: build library | |
run: cmake --build build --config ${{ matrix.type }} | |
- name: build & run tests | |
env: | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
run: cmake --build build --target run_tests --config ${{ matrix.type }} |