diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 3a18ca2..2b905d8 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -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: @@ -45,14 +31,18 @@ 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: | @@ -60,6 +50,7 @@ jobs: 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 @@ -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 }} @@ -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 }}/ @@ -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/