[NOX-76] add GLShader unit tests #100
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "dev" ] | |
env: | |
DISPLAY: ":99" | |
MESA_GL_VERSION_OVERRIDE: "4.6" | |
MESA_GLSL_VERSION_OVERRIDE: "460" | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }} | |
runs-on: ${{ matrix.platform.os }} | |
strategy: | |
matrix: | |
platform: | |
- { name: Windows VS2022, os: windows-latest, flags: -G"Visual Studio 17 2022" } | |
- { name: Windows Clang, os: windows-latest, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ } | |
- { name: Windows GCC, os: windows-latest, flags: -GNinja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ } | |
- { name: Linux Clang, os: ubuntu-latest, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ } | |
- { name: Linux GCC, os: ubuntu-latest, flags: -GNinja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ } | |
config: | |
- { name: Static, flags: -DBUILD_SHARED_LIBS=OFF } | |
- { name: Shared, flags: -DBUILD_SHARED_LIBS=ON } | |
type: | |
- { name: Release, flags: -DCMAKE_BUILD_TYPE=Release } | |
- { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug } | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install CMake and Ninja | |
uses: lukka/get-cmake@latest | |
with: | |
cmakeVersion: latest | |
ninjaVersion: latest | |
- name: Install dependencies | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt-get update && sudo apt-get install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libgl1-mesa-dev | |
fi | |
- name: Configure | |
run: cmake -S . -B build ${{ matrix.platform.flags }} ${{ matrix.config.flags }} ${{ matrix.type.flags }} | |
- name: Build | |
run: cmake --build build --config ${{ matrix.type.name }} --parallel | |
clang-format: | |
name: clang-format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Format code | |
run: cmake -P cmake/run_clang_format.cmake | |
- name: Check formatting | |
run: git diff --exit-code | |
clang-tidy: | |
name: clang-tidy ${{ matrix.platform.name }} | |
runs-on: ${{ matrix.platform.os }} | |
strategy: | |
matrix: | |
platform: | |
- { name: Windows, os: windows-latest } | |
- { name: Linux, os: ubuntu-latest } | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install CMake and Ninja | |
uses: lukka/get-cmake@latest | |
with: | |
cmakeVersion: latest | |
ninjaVersion: latest | |
- name: Install dependencies | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt-get update && sudo apt-get install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libgl1-mesa-dev | |
fi | |
- name: Configure | |
run: cmake -S . -B build -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | |
- name: Prepare compile_commands.json | |
run: sed -i -E 's|(-I)([^ ]*third_party[^ ]*include\b)|-isystem \2|g' build/compile_commands.json | |
- name: Analyze code | |
run: cmake -DPROJECT_BINARY_DIR=build -P cmake/run_clang_tidy.cmake | |
unit-tests: | |
name: unit-tests ${{ matrix.platform.name }} | |
runs-on: ${{ matrix.platform.os }} | |
strategy: | |
matrix: | |
platform: | |
- { name: Windows, os: windows-latest, flags: -GNinja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DNOX_ENABLE_COVERAGE=ON -DNOX_BUILD_TESTS=ON } | |
- { name: Linux, os: ubuntu-latest, flags: -GNinja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DNOX_ENABLE_COVERAGE=ON -DNOX_BUILD_TESTS=ON } | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install CMake and Ninja | |
uses: lukka/get-cmake@latest | |
with: | |
cmakeVersion: latest | |
ninjaVersion: latest | |
- name: Install dependencies | |
run: | | |
set -e | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt-get update && sudo apt-get install xorg-dev libxrandr-dev libxcursor-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev mesa-utils xvfb fluxbox gcovr | |
fi | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
pip install gcovr | |
fi | |
- name: Create Display Linux | |
if: runner.os == 'Linux' | |
run: | | |
set -e | |
Xvfb $DISPLAY -screen 0 800x600x24 & | |
sleep 5 | |
fluxbox > /dev/null 2>&1 & | |
sleep 5 | |
- name: Install Windows Mesa3D | |
uses: ssciwr/setup-mesa-dist-win@v2 | |
if: runner.os == 'Windows' | |
with: | |
build-type: 'release-msvc' | |
- name: Configure | |
run: cmake -S . -B build ${{ matrix.platform.flags }} | |
- name: Build | |
run: | | |
cmake --build build --config Debug --target run-unit-tests | |
gcovr --root $GITHUB_WORKSPACE -x build/coverage.out -s -f 'src/.*' | |
- name: Upload coverage report to Coveralls | |
uses: coverallsapp/github-action@v2 | |
with: | |
file: ./build/coverage.out | |
base-path: ${{ github.workspace }} |