From 219b6661d602c5d410cb333875b3f47a0546d82c Mon Sep 17 00:00:00 2001 From: Troy Schrapel Date: Sun, 3 Sep 2023 13:12:21 +0930 Subject: [PATCH] build actions --- .github/workflows/build-win64.yml | 30 ----------- .github/workflows/cmake-multi-platform.yml | 61 ++++++++++++++++++++++ 2 files changed, 61 insertions(+), 30 deletions(-) delete mode 100644 .github/workflows/build-win64.yml create mode 100644 .github/workflows/cmake-multi-platform.yml diff --git a/.github/workflows/build-win64.yml b/.github/workflows/build-win64.yml deleted file mode 100644 index a31ee40..0000000 --- a/.github/workflows/build-win64.yml +++ /dev/null @@ -1,30 +0,0 @@ - -name: build-win64 - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -env: - SOLUTION_FILE_PATH: msvc - - BUILD_CONFIGURATION: Release - -permissions: - contents: read - -jobs: - build: - runs-on: windows-latest - - steps: - - uses: actions/checkout@v3 - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 - - - name: Build - working-directory: ${{env.GITHUB_WORKSPACE}} - run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml new file mode 100644 index 0000000..d879d4a --- /dev/null +++ b/.github/workflows/cmake-multi-platform.yml @@ -0,0 +1,61 @@ + +name: multi-platform-build-and-test + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + + matrix: + os: [ubuntu-latest, windows-latest] + build_type: [Release] + c_compiler: [gcc, clang, cl] + include: + - os: windows-latest + c_compiler: cl + cpp_compiler: cl + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + exclude: + - os: windows-latest + c_compiler: gcc + - os: windows-latest + c_compiler: clang + - os: ubuntu-latest + c_compiler: cl + + steps: + - uses: actions/checkout@v3 + + - name: Set reusable strings + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Configure CMake + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Build + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + + - name: Test + working-directory: ${{ steps.strings.outputs.build-output-dir }} + run: ctest --build-config ${{ matrix.build_type }}