Skip to content

modified the yml github actions fiile #130

modified the yml github actions fiile

modified the yml github actions fiile #130

name: CMake on Multiple Platforms
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
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
with:
submodules: 'recursive' # Ensure submodules are updated
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Clone wxWidgets repository
run: |
git clone --recurse-submodules -j5 https://github.com/wxWidgets/wxWidgets.git
- name: Install dependencies for 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: Install dependencies for Windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
choco install wxwidgets
- name: Configure CMake
run: |
# Configure with the provided CMakeLists.txt approach
cmake -B ${{ steps.strings.outputs.build-output-dir }} -DCMAKE_BUILD_TYPE=Release -DwxBUILD_SHARED=OFF \
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
-S ${{ github.workspace }}
- name: Build the project
run: |
cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --clean-first
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
ctest --build-config ${{ matrix.build_type }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: minesweeper
path: ${{ steps.strings.outputs.build-output-dir }}
overwrite: true