Update cmake-multi-platform.yml #138
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: recursive | |
# 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: Install dependencies on Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y | |
choco install visualstudio2019buildtools -y --ignore-checksums | |
choco install git -y | |
# Step 3: Create build directory for wxWidgets on Ubuntu | |
- name: Create build directory for 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 | |
# Step 3: Create build directory for wxWidgets on Windows | |
- name: Create build directory for wxWidgets on Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: pwsh | |
run: | | |
if (-Not (Test-Path "external/wxWidgets/build")) { | |
New-Item -ItemType Directory -Path external/wxWidgets/build | |
} | |
cd external/wxWidgets/build | |
cmake .. -DCMAKE_BUILD_TYPE=Release -DwxBUILD_SHARED=OFF | |
cmake --build . --config Release | |
# Step 4: Build and test the project on Ubuntu | |
- name: Build and test the project 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 | |
# Step 4: Build and test the project on Windows | |
- name: Build and test the project on Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: pwsh | |
run: | | |
if (-Not (Test-Path "build")) { | |
New-Item -ItemType Directory -Path build | |
} | |
cd build | |
cmake .. -DCMAKE_BUILD_TYPE=Release | |
cmake --build . --config Release | |
ctest --output-on-failure |