Skip to content
49 changes: 21 additions & 28 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,18 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025]
cpp_compiler: [g++, clang++, cl]
build_shared_libs: [ON]
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025, macos-26]
include:
- os: ubuntu-24.04
cpp_compiler: g++
- os: ubuntu-24.04
cpp_compiler: clang++
- os: ubuntu-24.04-arm
cpp_compiler: g++
- os: ubuntu-24.04-arm
cpp_compiler: clang++
- os: windows-2025
cpp_compiler: cl
exclude:
- os: ubuntu-24.04
cpp_compiler: cl
- os: ubuntu-24.04-arm
cpp_compiler: cl
- os: windows-2025
cpp_compiler: g++
- os: windows-2025
- os: macos-26
cpp_compiler: clang++

steps:
Expand All @@ -45,21 +31,26 @@ jobs:
submodules: recursive
fetch-depth: 0

- name: Install Required Packages
if: matrix.os == 'ubuntu-24.04' || matrix.os == 'ubuntu-24.04-arm'
- name: Setup Packages
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install nasm

- name: Setup Packages
if: runner.os == 'macOS'
run: |
brew install nasm go

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "vcpkg-manifest-dir=${{ github.workspace }}/libdave/cpp/vcpkg-alts/boringssl" >> "$GITHUB_OUTPUT"
echo "cmake-toolchain-file=${{ github.workspace }}/libdave/cpp/vcpkg/scripts/buildsystems/vcpkg.cmake" >> "$GITHUB_OUTPUT"
echo "build-type=Release" >> "$GITHUB_OUTPUT"
echo "build-shared-libs=ON" >> "$GITHUB_OUTPUT"
echo "pdb=ON" >> "$GITHUB_OUTPUT"

- name: Configure CMake
Expand All @@ -70,12 +61,11 @@ jobs:
CONFIG=${{ steps.strings.outputs.build-type }}
VCPKG_MANIFEST_DIR=${{ steps.strings.outputs.vcpkg-manifest-dir }}
TOOLCHAIN_FILE=${{ steps.strings.outputs.cmake-toolchain-file }}
SHARED=${{ matrix.build_shared_libs }}
SHARED=${{ steps.strings.outputs.build-shared-libs }}
PDB=${{ steps.strings.outputs.pdb }}
SOURCE_DIR=${{ github.workspace }}

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: >
make build
CONFIG=${{ steps.strings.outputs.build-type }}
Expand All @@ -84,12 +74,10 @@ jobs:

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ steps.strings.outputs.build-type }}

- name: Move Build Output
if: matrix.os == 'windows-2025'
if: runner.os == 'Windows'
run: |
mv ${{ steps.strings.outputs.build-output-dir }}/out/${{ steps.strings.outputs.build-type }}/* ${{ steps.strings.outputs.build-output-dir }}/out/
rm ${{ steps.strings.outputs.build-output-dir }}/out/${{ steps.strings.outputs.build-type }}/
Expand All @@ -101,23 +89,28 @@ jobs:
- name: Upload Artifacts with Symbols
uses: actions/upload-artifact@v4
with:
name: libdavec-${{ matrix.os }}-${{ matrix.cpp_compiler }}-shared${{ matrix.build_shared_libs }}-symbolsON
name: libdavec-${{ runner.os }}-${{ runner.arch }}-symbols
path: |
${{ steps.strings.outputs.build-output-dir }}/out/

- name: Strip Symbols
if: matrix.os == 'ubuntu-24.04' || matrix.os == 'ubuntu-24.04-arm'
if: runner.os == 'Linux'
run: |
strip ${{ steps.strings.outputs.build-output-dir }}/out/libdavec.so

- name: Strip Symbols
if: matrix.os == 'windows-2025'
if: runner.os == 'Windows'
run: |
rm ${{ steps.strings.outputs.build-output-dir }}/out/libdavec.pdb

- name: Strip Symbols
if: runner.os == 'macOS'
run: |
strip -x ${{ steps.strings.outputs.build-output-dir }}/out/libdavec.dylib

- name: Upload Artifacts without Symbols
uses: actions/upload-artifact@v4
with:
name: libdavec-${{ matrix.os }}-${{ matrix.cpp_compiler }}-shared${{ matrix.build_shared_libs }}-symbolsOFF
name: libdavec-${{ runner.os }}-${{ runner.arch }}
path: |
${{ steps.strings.outputs.build-output-dir }}/out/
Loading