Skip to content

modified the yml github actions fiile #132

modified the yml github actions fiile

modified the yml github actions fiile #132

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: 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: Create build directory
run: |
mkdir -p ${{ github.workspace }}/build
- name: Configure CMake
run: |
# Run cmake in the current directory with the desired flags
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
run: |
cmake --build ${{ github.workspace }}/build --config ${{ matrix.build_type }} --clean-first
- name: Test
working-directory: ${{ github.workspace }}/build
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