name: CI on: [ push, pull_request ] jobs: build: runs-on: ubuntu-latest container: image: ubuntu:rolling strategy: matrix: include: - { cxx: g++ } - { cxx: clang++, features: "nooptlibs" } - { cxx: clang++, features: "static" } name: ${{ matrix.cxx }} ${{ matrix.features }} steps: - uses: actions/checkout@v3 - name: Install dependencies env: DEBIAN_FRONTEND: noninteractive run: | apt-get update -qq apt-get install -yqq --no-install-recommends build-essential clang cmake libsdl2-dev cppcheck doxygen graphviz curl ca-certificates if [ ${{ !contains(matrix.features, 'nooptlibs') }} = true ]; then apt-get install -qq --no-install-recommends libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev fi - name: Set up environment run: | curl https://raw.githubusercontent.com/AMDmi3/github_env/c8cc83d/github_env.py > e; chmod 755 e ./e 'CXX=${{ matrix.cxx }}' ./e 'CXXFLAGS=-Wall -Wextra -pedantic' # XXX: Add -Werror ./e 'CMAKE_ARGS=-DSDL2PP_ENABLE_LIVE_TESTS=NO' # no ability to run live tests in CI (SDL_InitSubsystem failed: x11 not available with xvfb) ./e --if ${{ matrix.cxx == 'clang++' }} 'CXXFLAGS+=-Wno-self-assign-overloaded' # explicit self-assignment tests ./e --if ${{ contains(matrix.features, 'nooptlibs') }} 'CMAKE_ARGS+=-DSDL2PP_WITH_IMAGE=NO -DSDL2PP_WITH_MIXER=NO -DSDL2PP_WITH_TTF=NO' ./e --if ${{ contains(matrix.features, 'static') }} 'CMAKE_ARGS+=-DSDL2PP_STATIC=YES' - name: Configure run: cmake . -DCMAKE_VERBOSE_MAKEFILE=yes -DCMAKE_INSTALL_PREFIX=/usr ${CMAKE_ARGS} - name: Build run: cmake --build . - name: Run tests run: ctest -V - name: Install run: cmake --install . - name: Run cppcheck # `style' gives false positive in cppcheck 1.61 which comes with trusty run: cppcheck -I . --enable=performance,portability,information,missingInclude,style --error-exitcode=2 SDL2pp || true - name: Doxygen check run: | make doxygen if git ls-files --others --exclude-standard | grep ''; then echo 'FATAL: incomplete .gitignore'; false; fi - name: Testing client code with pkg-config detection run: | cd $GITHUB_WORKSPACE/exttests/pkg-config make - name: Testing client code with CMake detection run: | cd $GITHUB_WORKSPACE/exttests/cmake cmake . cmake --build .