| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- name: Multi-Platform Build
- on:
- push:
- branches: [ "master" ]
- paths:
- - 'src/**'
- - 'include/**'
- - 'scripts/**'
- - 'shaders/**'
- - 'CMakeLists.txt'
- - '**/CMakeLists.txt'
- - '.github/workflows/**'
- pull_request:
- branches: [ "master" ]
- paths:
- - 'src/**'
- - 'include/**'
- - 'scripts/**'
- - 'shaders/**'
- - 'CMakeLists.txt'
- - '**/CMakeLists.txt'
- - '.github/workflows/**'
- workflow_dispatch:
- jobs:
- build:
- runs-on: ${{ matrix.os }}
- strategy:
- fail-fast: false
- matrix:
- os: [ubuntu-latest, windows-latest]
- build_type: [Release]
- c_compiler: [gcc, clang, cl]
- include:
- - os: windows-latest
- c_compiler: cl
- cpp_compiler: cl
- - os: windows-latest
- c_compiler: gcc
- cpp_compiler: g++
- - os: ubuntu-latest
- c_compiler: gcc
- cpp_compiler: g++
- - os: ubuntu-latest
- c_compiler: clang
- cpp_compiler: clang++
- exclude:
- - os: windows-latest
- c_compiler: clang
- - os: ubuntu-latest
- c_compiler: cl
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- with:
- submodules: recursive
- - name: Setup ccache
- uses: hendrikmuhs/[email protected]
- with:
- key: ${{ matrix.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}
- max-size: 500M
- - name: Install Ninja (Windows MSVC)
- if: runner.os == 'Windows' && matrix.c_compiler == 'cl'
- run: choco install ninja
- - name: Setup MinGW-w64
- if: runner.os == 'Windows' && matrix.c_compiler == 'gcc'
- uses: msys2/setup-msys2@v2
- with:
- msystem: MINGW64
- update: true
- install: >-
- mingw-w64-x86_64-gcc
- mingw-w64-x86_64-cmake
- mingw-w64-x86_64-ninja
- mingw-w64-x86_64-python
- mingw-w64-x86_64-ccache
- - name: Install Linux dependencies
- if: runner.os == 'Linux'
- run: |
- sudo apt-get update
- sudo apt-get install -y --no-install-recommends \
- ninja-build \
- libglfw3 libglfw3-dev \
- libx11-dev libxcursor-dev libxrandr-dev \
- libxinerama-dev libxi-dev libxext-dev libxfixes-dev \
- libwayland-dev libwayland-bin libxkbcommon-dev
- - name: Configure CMake (MinGW)
- if: runner.os == 'Windows' && matrix.c_compiler == 'gcc'
- shell: msys2 {0}
- run: |
- cmake -B build -G "Ninja" \
- -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
- -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
- -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
- -DCMAKE_C_COMPILER_LAUNCHER=ccache \
- -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
- -DBUILD_SHARED_LIBS=OFF \
- -DR3D_RAYLIB_VENDORED=ON \
- -DR3D_ASSIMP_VENDORED=ON \
- -DR3D_BUILD_EXAMPLES=ON \
- -DR3D_BUILD_DOCS=OFF
- - name: Configure CMake (Windows MSVC)
- if: runner.os == 'Windows' && matrix.c_compiler == 'cl'
- shell: cmd
- run: |
- call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
- cmake -B build -G "Ninja" ^
- -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} ^
- -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} ^
- -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ^
- -DCMAKE_C_COMPILER_LAUNCHER=ccache ^
- -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ^
- -DBUILD_SHARED_LIBS=OFF ^
- -DR3D_RAYLIB_VENDORED=ON ^
- -DR3D_ASSIMP_VENDORED=ON ^
- -DR3D_BUILD_EXAMPLES=ON ^
- -DR3D_BUILD_DOCS=OFF
- - name: Configure CMake (Linux)
- if: runner.os == 'Linux'
- run: |
- cmake -B build -G "Ninja" \
- -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
- -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
- -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
- -DCMAKE_C_COMPILER_LAUNCHER=ccache \
- -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
- -DBUILD_SHARED_LIBS=OFF \
- -DR3D_RAYLIB_VENDORED=ON \
- -DR3D_ASSIMP_VENDORED=ON \
- -DR3D_BUILD_EXAMPLES=ON \
- -DR3D_BUILD_DOCS=OFF
- - name: Build (MinGW)
- if: runner.os == 'Windows' && matrix.c_compiler == 'gcc'
- shell: msys2 {0}
- run: cmake --build build --config ${{ matrix.build_type }} --parallel
- - name: Build (Windows MSVC)
- if: runner.os == 'Windows' && matrix.c_compiler == 'cl'
- shell: cmd
- run: |
- call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
- cmake --build build --config ${{ matrix.build_type }} --parallel
- - name: Build (Linux)
- if: runner.os == 'Linux'
- run: cmake --build build --config ${{ matrix.build_type }} --parallel
- - name: Print ccache statistics
- run: ccache -s
- - name: Run tests (MinGW)
- if: runner.os == 'Windows' && matrix.c_compiler == 'gcc'
- shell: msys2 {0}
- run: |
- cd build
- ctest --build-config ${{ matrix.build_type }}
- - name: Run tests (Windows MSVC)
- if: runner.os == 'Windows' && matrix.c_compiler == 'cl'
- shell: cmd
- working-directory: build
- run: ctest --build-config ${{ matrix.build_type }}
- - name: Run tests (Linux)
- if: runner.os == 'Linux'
- working-directory: build
- run: ctest --build-config ${{ matrix.build_type }}
- - name: Upload artifacts
- uses: actions/upload-artifact@v4
- with:
- name: r3d-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.c_compiler }}
- path: |
- build/**/*.dll
- build/**/*.so
- build/**/*.a
- build/**/*.lib
- build/**/*.dylib
- retention-days: 14
- trigger-bindings:
- needs: build
- runs-on: ubuntu-latest
- if: github.event_name == 'push' && github.ref == 'refs/heads/master'
- steps:
- - name: Trigger binding generation
- uses: peter-evans/repository-dispatch@v3
- with:
- token: ${{ secrets.BINDGEN_PAT }}
- repository: Bigfoot71/r3d-odin-bindgen
- event-type: r3d-updated
- client-payload: |
- {
- "ref": "${{ github.ref }}",
- "sha": "${{ github.sha }}",
- "repository": "${{ github.repository }}",
- "commit_message": ${{ toJSON(github.event.head_commit.message) }},
- "run_id": "${{ github.run_id }}"
- }
|