|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: [push] |
| 4 | + |
| 5 | +concurrency: |
| 6 | + group: environment-${{github.ref}} |
| 7 | + cancel-in-progress: true |
| 8 | + |
| 9 | +env: |
| 10 | + DISPLAY: ":99" # Display number to use for the X server |
| 11 | + |
| 12 | +defaults: |
| 13 | + run: |
| 14 | + shell: bash |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + name: ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }} |
| 19 | + runs-on: ${{ matrix.platform.os }} |
| 20 | + |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + platform: |
| 25 | + - { name: Linux Clang, os: ubuntu-24.04, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -GNinja } |
| 26 | + config: |
| 27 | + - { name: Static, flags: -DBUILD_SHARED_LIBS=OFF } |
| 28 | + type: |
| 29 | + - { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug -DSFML_ENABLE_COVERAGE=ON } |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout Code |
| 33 | + uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Get CMake and Ninja |
| 36 | + uses: lukka/get-cmake@latest |
| 37 | + with: |
| 38 | + cmakeVersion: '3.22' |
| 39 | + ninjaVersion: latest |
| 40 | + |
| 41 | + - name: Install Linux Dependencies and Tools |
| 42 | + if: runner.os == 'Linux' |
| 43 | + run: | |
| 44 | + curl -1sLf 'https://dl.cloudsmith.io/public/mull-project/mull-stable/setup.deb.sh' | sudo -E bash |
| 45 | + CLANG_VERSION=$(clang++ --version | sed -n 's/.*version \([0-9]\+\)\..*/\1/p') |
| 46 | + echo "CLANG_VERSION=$CLANG_VERSION" >> $GITHUB_ENV |
| 47 | + sudo apt-get update && sudo apt-get install xorg-dev libxrandr-dev libxcursor-dev libxi-dev libudev-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev x11-utils xvfb fluxbox eterm daemonize lib32stdc++6 llvm-$CLANG_VERSION mull-$CLANG_VERSION |
| 48 | + mull-runner-$CLANG_VERSION --version |
| 49 | +
|
| 50 | + - name: Remove ALSA Library |
| 51 | + if: runner.os == 'Linux' |
| 52 | + run: sudo apt-get remove -y libasound2 |
| 53 | + |
| 54 | + - name: Configure CMake |
| 55 | + run: cmake --preset dev -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.type.flags}} -DCMAKE_CXX_FLAGS="-stdlib=libc++ -O0 -fpass-plugin=/usr/lib/mull-ir-frontend-$CLANG_VERSION -g -grecord-command-line -fprofile-instr-generate -fcoverage-mapping" |
| 56 | + |
| 57 | + - name: Build |
| 58 | + run: cmake --build build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} |
| 59 | + |
| 60 | + - name: Prepare Test |
| 61 | + run: | |
| 62 | + set -e |
| 63 | + set -o pipefail |
| 64 | + # Start up Xvfb and fluxbox to host display tests |
| 65 | + daemonize /usr/bin/Xvfb $DISPLAY -screen 0 1920x1080x24 -ac +extension GLX +extension DPMS +render -noreset -s 1440 +bs -maxclients 256 +xinerama |
| 66 | + sleep 5 |
| 67 | + daemonize /usr/bin/fluxbox |
| 68 | + sleep 5 |
| 69 | + # Test if the X server is working properly by outputting display information |
| 70 | + xdpyinfo -queryExtensions | awk "/^name of display/,/^ significant bits in color specification/" |
| 71 | + # Make sure the build/bin directory exists so that the find command does not fail if no executables are built |
| 72 | + mkdir -p build/bin |
| 73 | + # Make use of a test to print OpenGL vendor/renderer/version info to the console |
| 74 | + find build/bin -name test-sfml-window -or -name test-sfml-window.exe -exec sh -c "{} *sf::Context* --section=\"Version String\" --success | grep OpenGL" \; |
| 75 | +
|
| 76 | + - name: Test |
| 77 | + run: | |
| 78 | + cd test |
| 79 | + mull-runner-$CLANG_VERSION --allow-surviving --reporters SQLite --report-name SFML ../build/bin/test-sfml-system |
| 80 | + mull-runner-$CLANG_VERSION --allow-surviving --reporters SQLite --report-name SFML ../build/bin/test-sfml-network |
| 81 | + mull-runner-$CLANG_VERSION --allow-surviving --reporters SQLite --report-name SFML ../build/bin/test-sfml-audio |
| 82 | + mull-runner-$CLANG_VERSION --allow-surviving --reporters SQLite --report-name SFML ../build/bin/test-sfml-window |
| 83 | + mull-runner-$CLANG_VERSION --allow-surviving --reporters SQLite --report-name SFML ../build/bin/test-sfml-graphics |
| 84 | +
|
| 85 | + - name: Report (IDE) |
| 86 | + run: mull-reporter-$CLANG_VERSION --reporters IDE test/SFML.sqlite |
| 87 | + |
| 88 | + - name: Report (Github Annotations) |
| 89 | + run: mull-reporter-$CLANG_VERSION --reporters GithubAnnotations test/SFML.sqlite |
0 commit comments