mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 10:55:57 -04:00
93 lines
3.8 KiB
YAML
93 lines
3.8 KiB
YAML
name: CI
|
|
on: [ push, pull_request ]
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ubuntu:rolling
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- { cxx: g++, features: "coverage" }
|
|
- { cxx: clang++, features: "nooptlibs" }
|
|
- { cxx: clang++, features: "static" }
|
|
name: ${{ matrix.cxx }} ${{ matrix.features }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up environment
|
|
run: |
|
|
echo 'CXX=${{ matrix.cxx }}' >> $GITHUB_ENV
|
|
echo 'CXXFLAGS=-Wall -Wextra -pedantic' >> $GITHUB_ENV # XXX: Add -Werror
|
|
echo 'LDFLAGS=' >> $GITHUB_ENV
|
|
echo 'SDL_AUDIODRIVER=pulseaudio' >> $GITHUB_ENV
|
|
echo 'SDL_VIDEODRIVER=x11' >> $GITHUB_ENV
|
|
echo 'DISPLAY=:99.0' >> $GITHUB_ENV
|
|
- name: Set up environment (flags)
|
|
if: ${{ matrix.xxx == 'clang++' }}
|
|
# there are explicit self-assignment tests
|
|
run: echo "CXXFLAGS=$CXXFLAGS -Wno-self-assign-overloaded" >> $GITHUB_ENV
|
|
- name: Set up environment (coverage)
|
|
if: ${{ contains(matrix.features, 'coverage') }}
|
|
run: |
|
|
echo "CXXFLAGS=$CXXFLAGS --coverage" >> $GITHUB_ENV
|
|
echo "LDFLAGS=$LDFLAGS --coverage" >> $GITHUB_ENV
|
|
- name: Set up environment (optional libs)
|
|
if: ${{ contains(matrix.features, 'nooptlibs') }}
|
|
run: echo "CMAKE_ARGS=$CMAKE_ARGS -DSDL2PP_WITH_IMAGE=NO -DSDL2PP_WITH_MIXER=NO -DSDL2PP_WITH_TTF=NO" >> $GITHUB_ENV
|
|
- name: Set up environment (static build)
|
|
if: ${{ contains(matrix.features, 'static') }}
|
|
run: echo "CMAKE_ARGS=$CMAKE_ARGS -DSDL2PP_STATIC=YES" >> $GITHUB_ENV
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get update -qq
|
|
apt-get install -yqq --no-install-recommends build-essential clang cmake libsdl2-dev cppcheck doxygen pulseaudio graphviz xvfb
|
|
- name: Install dependencies (optional libs)
|
|
if: ${{ !contains(matrix.features, 'nooptlibs') }}
|
|
run: apt-get install -qq libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev
|
|
- name: Install dependencies (coverage)
|
|
if: ${{ contains(matrix.features, 'coverage') }}
|
|
run: |
|
|
apt-get install -yqq --no-install-recommends python3-pip git curl
|
|
pip install --user pyyaml cpp-coveralls
|
|
|
|
- name: Set up environment for live tests
|
|
run: |
|
|
pulseaudio --daemonize --system || true
|
|
/sbin/start-stop-daemon --start --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 800x600x24 -ac +extension GLX || true
|
|
|
|
- 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 || true # TODO: debug failing live_mixer test
|
|
- 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 .
|
|
|
|
- name: Upload coverage
|
|
if: ${{ contains(matrix.features, 'coverage') }}
|
|
uses: codecov/codecov-action@v1
|
|
with:
|
|
fail_ci_if_error: true
|