[WIP] Work in progress #3629
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: Build Code | |
on: | |
push: | |
pull_request: | |
types: [opened] | |
env: | |
INEXOR_VULKAN_VERSION: "1.3.216.0" | |
INEXOR_VULKAN_SDK_PATH: "$GITHUB_WORKSPACE/../vulkan_sdk/" | |
jobs: | |
linux: | |
name: ${{ matrix.config.name }} | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' && !github.event.pull_request.merged || github.event_name == 'push' }} | |
container: ubuntu:rolling | |
env: | |
DEBIAN_FRONTEND: "noninteractive" | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Ubuntu Clang (Debug)", | |
compiler: "clang", | |
cc: "clang-14", cxx: "clang++-14", | |
build_type: "Debug" | |
} | |
- { | |
name: "Ubuntu Clang (Release)", | |
compiler: "clang", | |
cc: "clang-14", cxx: "clang++-14", | |
build_type: "Release" | |
} | |
- { | |
name: "Ubuntu GCC (Debug)", | |
compiler: "gcc", | |
cc: "gcc-12", cxx: "g++-12", | |
build_type: "Debug" | |
} | |
- { | |
name: "Ubuntu GCC (Release)", | |
compiler: "gcc", | |
cc: "gcc-12", cxx: "g++-12", | |
build_type: "Release" | |
} | |
steps: | |
- name: Update environment | |
shell: bash | |
run: | | |
# Update package lists | |
apt update -qq | |
# Install build tools | |
apt-get install -y \ | |
gcc-12 \ | |
clang-14 \ | |
cmake \ | |
curl \ | |
git \ | |
libgl1-mesa-dev \ | |
libx11-dev \ | |
libx11-xcb-dev \ | |
libxcb-dri3-dev \ | |
libxcb-icccm4-dev \ | |
libxcb-image0-dev \ | |
libxcb-keysyms1-dev \ | |
libxcb-randr0-dev \ | |
libxcb-render-util0-dev \ | |
libxcb-render0-dev \ | |
libxcb-shape0-dev \ | |
libxcb-sync-dev \ | |
libxcb-util-dev \ | |
libxcb-xfixes0-dev \ | |
libxcb-xinerama0-dev \ | |
libxcb-xkb-dev \ | |
lld \ | |
ninja-build \ | |
pkg-config \ | |
python3 \ | |
python3-pip \ | |
xkb-data \ | |
xorg-dev | |
pip3 install --break-system-packages wheel setuptools | |
- name: Install Vulkan SDK | |
shell: bash | |
run: | | |
# Download Vulkan SDK | |
curl -LS -o vulkansdk.tar.gz \ | |
https://sdk.lunarg.com/sdk/download/${{ env.INEXOR_VULKAN_VERSION }}/linux/vulkansdk-linux-x86_64-${{ env.INEXOR_VULKAN_VERSION }}.tar.gz | |
# Create Vulkan SDK directory and extract | |
mkdir "${{ env.INEXOR_VULKAN_SDK_PATH }}" | |
tar xfz vulkansdk.tar.gz -C "${{ env.INEXOR_VULKAN_SDK_PATH }}" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure CMake | |
shell: bash | |
run: | | |
export CC=${{ matrix.config.cc }} | |
export CXX=${{ matrix.config.cxx }} | |
export VULKAN_SDK="${{ env.INEXOR_VULKAN_SDK_PATH }}/${{ env.INEXOR_VULKAN_VERSION }}/x86_64" | |
export PATH=$VULKAN_SDK/bin:$PATH | |
cmake . \ | |
-Bbuild \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ | |
-DINEXOR_BUILD_BENCHMARKS=ON \ | |
-DINEXOR_BUILD_TESTS=ON \ | |
-DCMAKE_CXX_FLAGS="-Wall -Wextra" \ | |
-GNinja \ | |
${{ matrix.config.cmake_configure_options }} | |
- name: Build | |
shell: bash | |
run: | | |
cmake --build build | |
- name: Prepare build artifacts | |
shell: bash | |
run: | | |
cd build | |
tar -zcvf "../build_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz" * | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz | |
path: build_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz | |
- name: Prepare Artifacts | |
shell: bash | |
run: | | |
mkdir artifacts | |
cp ./build/example/inexor-vulkan-renderer-example artifacts/ | |
cp -r ./configuration/ artifacts/ | |
cp -r ./assets/ artifacts | |
mkdir -p ./artifacts/shaders | |
cp ./shaders/*.spv ./artifacts/shaders/ | |
cd artifacts | |
tar -zcvf "../linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz" * | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz | |
path: linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz | |
retention-days: 7 | |
windows: | |
name: ${{ matrix.config.name }} | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows MSVC (Debug)", | |
compiler: "msvc", | |
cc: "cl", cxx: "cl", | |
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64', | |
build_type: "Debug", | |
cmake_build_options: "--config Debug", | |
} | |
- { | |
name: "Windows MSVC (Release)", | |
compiler: "msvc", | |
cc: "cl", cxx: "cl", | |
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64', | |
build_type: "Release", | |
cmake_build_options: "--config Release", | |
} | |
- { | |
name: "Windows Clang (Debug)", | |
compiler: "clang", | |
cc: "clang-cl", cxx: "clang-cl", | |
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64 -T "LLVM_v143" -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_LINKER="lld.exe"', | |
build_type: "Debug", | |
cmake_build_options: "--config Debug", | |
} | |
- { | |
name: "Windows Clang (Release)", | |
compiler: "clang", | |
cc: "clang-cl", cxx: "clang-cl", | |
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64 -T "LLVM_v143" -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_LINKER="lld.exe"', | |
build_type: "Release", | |
cmake_build_options: "--config Release", | |
} | |
steps: | |
- name: Update environment | |
shell: pwsh | |
run: | | |
pip3 install wheel setuptools | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure LLVM | |
if: matrix.config.compiler == 'clang' | |
shell: pwsh | |
run: | | |
choco upgrade --no-progress llvm | |
curl -fsSL -o "LLVM_VS2017.zip" "https://github.com/zufuliu/llvm-utils/releases/download/v23.03/LLVM_VS2017.zip" | |
7z x -y "LLVM_VS2017.zip" >NUL | |
LLVM_VS2017\install.bat | |
- name: Install Vulkan SDK | |
shell: pwsh | |
run: | | |
curl -LS -o vulkansdk.exe ` | |
https://sdk.lunarg.com/sdk/download/${{ env.INEXOR_VULKAN_VERSION }}/windows/VulkanSDK-${{ env.INEXOR_VULKAN_VERSION }}-Installer.exe | |
7z x vulkansdk.exe -o"${{ env.INEXOR_VULKAN_SDK_PATH }}" | |
- name: Configure CMake | |
shell: pwsh | |
run: | | |
$env:CC="${{ matrix.config.cc }}" | |
$env:CXX="${{ matrix.config.cxx }}" | |
$env:Path += ";${{ env.INEXOR_VULKAN_SDK_PATH }}\;${{ env.INEXOR_VULKAN_SDK_PATH }}\Bin\" | |
# TODO: Bring back Google tests and benchmarks in Windows CI | |
cmake . ` | |
-Bbuild ` | |
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} ` | |
-DINEXOR_BUILD_BENCHMARKS=OFF ` | |
-DINEXOR_BUILD_TESTS=OFF ` | |
${{ matrix.config.cmake_configure_options }} | |
- name: Build | |
shell: pwsh | |
run: | | |
cmake --build build ${{ matrix.config.cmake_build_options }} | |
- name: Prepare build artifacts | |
shell: pwsh | |
run: | | |
7z a -tzip "build_windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip" ./build/* | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build_windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip | |
path: build_windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip | |
- name: Prepare release artifacts | |
shell: pwsh | |
run: | | |
mkdir release | |
cp -r ./build/example/${{ matrix.config.build_type }}/. release | |
cp -r ./configuration/. release | |
cp -r ./assets/. release | |
mkdir -P ./release/shaders | |
cp ./shaders/*.spv ./release/shaders/ | |
7z a -tzip "windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip" ./release/* | |
- name: Upload release artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip | |
path: windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip | |
retention-days: 7 |