From 9547fac7efdf000a8396e0acf560896f3318b196 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Sun, 5 Jan 2025 12:57:48 +0300 Subject: [PATCH] modified the yml github actions fiile to be windows pswh friendly --- .github/workflows/cmake-multi-platform.yml | 69 +++++----------------- 1 file changed, 16 insertions(+), 53 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index eb25681..83bf8f1 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -10,71 +10,34 @@ jobs: build: runs-on: ${{ matrix.os }} - permissions: write-all - 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@v4 + # Step 1: Checkout the repository + - name: Checkout repository + uses: actions/checkout@v4 with: - submodules: 'recursive' # Ensure submodules are updated + submodules: 'recursive' - - name: Set reusable strings - id: strings - shell: bash - run: | - echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - - - name: Install dependencies for Ubuntu + # Step 2: Install dependencies + - name: Install dependencies on Ubuntu if: ${{ matrix.os == 'ubuntu-latest' }} run: | sudo apt-get update && sudo apt-get install -y build-essential libgtk-3-dev cmake apt-utils git wget - - name: Create build directory - run: | - mkdir -p ${{ github.workspace }}/build - - - name: Configure CMake - run: | - cmake -DCMAKE_BUILD_TYPE=Release -DwxBUILD_SHARED=OFF \ - -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ - -B ${{ github.workspace }}/build -S ${{ github.workspace }} - - - name: Build the project + - name: Install dependencies on Windows + if: ${{ matrix.os == 'windows-latest' }} run: | - cmake --build ${{ github.workspace }}/build --config ${{ matrix.build_type }} --clean-first + choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y + choco install visualstudio2019buildtools -y --ignore-checksums + choco install git -y - - name: Test - working-directory: ${{ github.workspace }}/build + # Step 3: Call cmake for build and testing + - name: Build and test using CMake run: | - ctest --build-config ${{ matrix.build_type }} - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: minesweeper - path: ${{ github.workspace }}/build - overwrite: true + mkdir build && cd build + cmake .. && cmake --build . --config Release + ctest --output-on-failure