From bff56ddfc9c5083354aaf34c12d70730056f60b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20J=2E=20Saraiva?= Date: Sun, 6 Oct 2024 15:07:05 +0100 Subject: [PATCH] Build and test a macos-amd64 version of dynamips with a github workflow. --- .github/workflows/ci_build.yml | 50 ++++++++++++++++++++++++++++++++++ cmake/dependencies.cmake | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml index 77a460369..d5b25d47c 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci_build.yml @@ -122,3 +122,53 @@ jobs: name: linux-x86-failure path: ${{github.workspace}}/build/ compression-level: 9 # maximum compression + + # ---------------------------------------------------------------------------------------------- + macos-amd64: + name: MacOS (amd64/x86_64) + runs-on: macos-13 # macos-13 is the last runner with an AMD64 cpu, macos-14 has an ARM cpu (Apple M1) + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies with brew + uses: ConorMacBride/install-package@v1 + with: + brew: libelf # libpcap is included in the SDK + + - name: Configure with CMake + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDYNAMIPS_CODE=both -DBUILD_UDP_RECV=ON -DBUILD_UDP_SEND=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install -DCPACK_PACKAGE_FILE_NAME=dynamips-package -DCPACK_GENERATOR=ZIP + + - name: Build + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + run: | + set -x + cd ${{github.workspace}}/build + ctest --verbose --build-config ${{env.BUILD_TYPE}} + ./stable/dynamips -e + ./unstable/dynamips_amd64_unstable -e + + - name: Install + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target install + + - name: Package + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target package + + - name: Upload success + if: ${{ success() }} + uses: actions/upload-artifact@v4 + with: + name: macos-amd64-success + path: | + ${{github.workspace}}/build/install/ + ${{github.workspace}}/build/dynamips-package.zip + compression-level: 9 # maximum compression + + - name: Upload failure + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: macos-amd64-failure + path: ${{github.workspace}}/build/ + compression-level: 9 # maximum compression diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index e5cfe3112..60c7ba31e 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -14,7 +14,7 @@ message ( STATUS "dependencies - BEGIN" ) -if ( "${CMAKE_C_COMPILER}" MATCHES "clang$" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) +if ( "${CMAKE_C_COMPILER}" MATCHES "clang$" OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang$" ) set ( CMAKE_COMPILER_IS_CLANG 1 ) endif()