Skip to content

Disable msvc test need to test it first on a real machine #33

Disable msvc test need to test it first on a real machine

Disable msvc test need to test it first on a real machine #33

Workflow file for this run

name: CI
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
compiler: gcc
cc: gcc
cxx: g++
- os: ubuntu-latest
compiler: clang
cc: clang
cxx: clang++
# For now disable msvc test
# - os: windows-latest
# compiler: msvc
# cc: cl
# cxx: cl
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install prerequisites & build SDL2 v2.0.20 (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential cmake ccache git \
libgl1-mesa-dev libglu1-mesa-dev \
libx11-dev libxrandr-dev libxi-dev libxinerama-dev libxcursor-dev libxss-dev libxxf86vm-dev \
libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev \
libglew-dev libfreetype6-dev
# sudo apt-get install -y \
# build-essential cmake ccache git \
# libgl1-mesa-dev libglu1-mesa-dev \
# libx11-dev libxrandr-dev libxi-dev libxinerama-dev libxcursor-dev libxss-dev libxxf86vm-dev \
# libglew-dev libfreetype6-dev libasound2-dev libpulse-dev libudev-dev libdbus-1-dev \
# libmpg123-dev libvorbis-dev libflac-dev libxmp-dev \
# libopusfile-dev libfluidsynth-dev libogg-dev libwavpack-dev
# # SDL2 v2.0.20
# git clone https://github.com/libsdl-org/SDL.git SDL2
# cd SDL2
# git fetch --tags # ← make sure tags are present locally
# git checkout release-2.0.20 # ← the correct release tag
# mkdir build && cd build
# cmake .. -DCMAKE_BUILD_TYPE=Release \
# -DSDL_INSTALL_INCLUDEDIR=include/SDL2
# make -j$(nproc)
# sudo make install
# sudo ldconfig
# cd ../..
# # repeat the same pattern (fetch tags + checkout) for ttf & mixer
# git clone https://github.com/libsdl-org/SDL_ttf.git SDL_ttf
# cd SDL_ttf
# git fetch --tags
# git checkout release-2.0.15
# mkdir build && cd build
# cmake .. -DCMAKE_BUILD_TYPE=Release
# make -j$(nproc)
# sudo make install
# sudo ldconfig
# cd ../..
# git clone https://github.com/libsdl-org/SDL_mixer.git SDL_mixer
# cd SDL_mixer
# git fetch --tags
# git checkout release-2.0.4
# mkdir build && cd build
# cmake .. -DCMAKE_BUILD_TYPE=Release
# make -j$(nproc)
# sudo make install
# sudo ldconfig
# cd ../..
- name: Cache ccache
uses: actions/cache@v3
with:
path: ~/.ccache
key: ${{ runner.os }}-ccache-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-ccache-${{ matrix.compiler }}-
- name: Cache CMake build
uses: actions/cache@v3
with:
path: build
key: ${{ runner.os }}-cmake-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-cmake-${{ matrix.compiler }}-
- name: Configure with CMake
run: |
mkdir -p build
cd build
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
cmake \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="/usr/local" \
..
else
cmake \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
-DCMAKE_BUILD_TYPE=Release \
..
fi
- name: Verify SDL2 installation (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
echo "Includes:"
ls /usr/local/include/
echo "sdl2-config:"
sdl2-config --version
- name: Build tests only
run: cmake --build build --config Release --target t1 -- -j$(nproc || echo 2)
- name: Run unit tests
run: |
cd build
ctest --output-on-failure --parallel $(nproc || echo 2)