chore: Update cmake-multi-platform.yml #142
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake on Multiple Platforms | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: false # Disable automatic submodule initialization | |
# Step 2: Initialize and update submodules | |
- name: Initialize and update submodules | |
run: | | |
git submodule sync | |
git submodule update --init --recursive | |
if [ ! -d "external/wxWidgets" ]; then | |
echo "wxWidgets submodule is not initialized properly!" | |
exit 1 | |
fi | |
shell: bash | |
# Step 3: 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 git wget libjpeg-dev libpng-dev libtiff-dev libglib2.0-dev zlib1g-dev libexpat1-dev | |
- name: Install dependencies on Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: pwsh | |
run: | | |
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y | |
choco install visualstudio2019buildtools -y --ignore-checksums | |
choco install git -y | |
# Step 4: Build wxWidgets | |
- name: Build wxWidgets on Ubuntu | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
mkdir -p external/wxWidgets/build | |
cd external/wxWidgets/build | |
cmake .. -DCMAKE_BUILD_TYPE=Release -DwxBUILD_SHARED=OFF | |
cmake --build . --config Release | |
shell: bash | |
- name: Build wxWidgets on Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: pwsh | |
run: | | |
mkdir external\wxWidgets\build | |
cd external\wxWidgets\build | |
cmake .. -DCMAKE_BUILD_TYPE=Release -DwxBUILD_SHARED=OFF | |
cmake --build . --config Release | |
# Step 5: Build and test the Minesweeper project | |
- name: Build and test on Ubuntu | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
mkdir -p build | |
cd build | |
cmake .. -DCMAKE_BUILD_TYPE=Release | |
cmake --build . --config Release | |
ctest --output-on-failure | |
shell: bash | |
- name: Build and test on Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: pwsh | |
run: | | |
mkdir build | |
cd build | |
cmake .. -DCMAKE_BUILD_TYPE=Release | |
cmake --build . --config Release | |
ctest --output-on-failure |