Skip to content

[ci] Reorganize artifact names and sort in nightly release #4008

[ci] Reorganize artifact names and sort in nightly release

[ci] Reorganize artifact names and sort in nightly release #4008

Workflow file for this run

name: Build Code
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
env:
INEXOR_VULKAN_SDK_VERSION: "1.3.283.0"
INEXOR_VULKAN_SDK_PATH: "${{ github.workspace }}/vulkan_sdk"
# Cancel CI workflows which are still running from previous pushes
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
linux:
name: ${{ matrix.config.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config:
- name: "Ubuntu Clang (Debug)"
compiler: "clang"
cc: "clang-18"
cxx: "clang++-18"
build_type: "Debug"
- name: "Ubuntu Clang (Release)"
compiler: "clang"
cc: "clang-18"
cxx: "clang++-18"
build_type: "Release"
- name: "Ubuntu GCC (Debug)"
compiler: "gcc"
cc: "gcc-14"
cxx: "g++-14"
build_type: "Debug"
- name: "Ubuntu GCC (Release)"
compiler: "gcc"
cc: "gcc-14"
cxx: "g++-14"
build_type: "Release"
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set build date
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
BUILD_DATE=$(date +'%Y-%b-%d_%H-%M-%S')
BUILD_VERSION="${SHORT_SHA}_${BUILD_DATE}"
echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_ENV
- name: Install Dependencies
run: |
sudo apt update -qq
sudo apt-get install -y \
gcc-14 \
g++-14 \
clang-18 \
cmake \
curl \
git \
libgl1-mesa-dev \
libwayland-dev \
libx11-dev \
libx11-xcb-dev \
libxkbcommon-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: Check Cache for Vulkan SDK
id: cache-vulkan-sdk
uses: actions/cache@v4
with:
path: ${{ env.INEXOR_VULKAN_SDK_PATH }}
key: vulkan-sdk-${{ env.INEXOR_VULKAN_SDK_VERSION }}-${{ runner.os }}
- name: Download Vulkan SDK
if: steps.cache-vulkan-sdk.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.INEXOR_VULKAN_SDK_PATH }}
wget -O vulkansdk.tar.xz https://sdk.lunarg.com/sdk/download/${{ env.INEXOR_VULKAN_SDK_VERSION }}/linux/vulkan-sdk.tar.xz
tar -xJf vulkansdk.tar.xz -C ${{ env.INEXOR_VULKAN_SDK_PATH }}
- name: Check Cache for CMake files
id: cache-cmake
uses: actions/cache@v4
with:
path: build
key: cmake-${{ runner.os }}-${{ matrix.config.compiler }}-${{ matrix.config.build_type }}-${{ hashFiles('CMakeLists.txt', '**/CMakeLists.txt', '**/*.cmake') }}
- name: Configure CMake
if: steps.cache-cmake.outputs.cache-hit != 'true'
run: |
rm -rf ${{ env.INEXOR_VULKAN_SDK_PATH }}/${{ env.INEXOR_VULKAN_SDK_VERSION }}/x86_64/lib/cmake/volk/
export CC=${{ matrix.config.cc }}
export CXX=${{ matrix.config.cxx }}
export VULKAN_SDK="${{ env.INEXOR_VULKAN_SDK_PATH }}/${{ env.INEXOR_VULKAN_SDK_VERSION }}/x86_64"
export PATH=$VULKAN_SDK/bin:$PATH
export LD_LIBRARY_PATH=$VULKAN_SDK/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export VK_LAYER_PATH=$VULKAN_SDK/share/vulkan/explicit_layer.d
cmake . \
-Bbuild \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-DVULKAN_SDK=$VULKAN_SDK \
-DINEXOR_BUILD_BENCHMARKS=ON \
-DINEXOR_BUILD_TESTS=ON \
-DCMAKE_CXX_FLAGS="-Wall -Wextra" \
-GNinja \
${{ matrix.config.cmake_configure_options }}
- name: Build Main Code
run: cmake --build build --target inexor-vulkan-renderer-example
- name: Build Tests
run: cmake --build build --target inexor-vulkan-renderer-tests
- name: Build Benchmarks
run: cmake --build build --target inexor-vulkan-renderer-benchmarks
- name: Run Tests
run: |
cd build
# Run all Google Test executables
for test_exec in $(find . -type f -executable -name '*-tests'); do
echo "Running $test_exec"
$test_exec --gtest_output=xml:"$test_exec.xml"
done
- name: Run Benchmarks
run: |
cd build
mkdir -p benchmark
for bench_exec in $(find . -type f -executable -name '*-benchmarks'); do
echo "Running $bench_exec"
$bench_exec > "benchmark/$(basename $bench_exec).txt"
done
- name: Prepare Nightly Artifacts
run: |
mkdir -p artifacts
cp ./build/example/inexor-vulkan-renderer-example artifacts/
mkdir -p artifacts/tests
find ./build -maxdepth 1 -type f -name '*-tests' -exec cp {} artifacts/tests/ \;
find ./build -maxdepth 1 -type f -name '*.xml' -exec cp {} artifacts/tests/ \;
mkdir -p artifacts/benchmarks
find ./build -maxdepth 1 -type f -name '*-benchmarks' -exec cp {} artifacts/benchmarks/ \;
mkdir -p artifacts/benchmarks/benchmark
find ./build/benchmark -maxdepth 1 -type f -name '*.txt' -exec cp {} artifacts/benchmarks/benchmark/ \;
cp -r ./configuration/ artifacts/
cp -r ./assets/ artifacts/
mkdir -p artifacts/shaders
cp ./shaders/*.spv artifacts/shaders/
cd artifacts
tar -zcvf "../Nightly_Linux_${{ matrix.config.compiler }}_${{ matrix.config.build_type }}_${{ env.BUILD_VERSION}}.tar.xz" *
- name: Upload Nightly Artifacts
uses: actions/upload-artifact@v4
with:
name: Nightly_Linux_${{ matrix.config.compiler }}_${{ matrix.config.build_type }}_${{ env.BUILD_VERSION}}
path: Nightly_Linux_${{ matrix.config.compiler }}_${{ matrix.config.build_type }}_${{ env.BUILD_VERSION}}.tar.xz
retention-days: 60
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 "Ninja" -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_LINKER=lld-link',
build_type: "Debug",
cmake_build_options: "--config Debug"
}
- {
name: "Windows Clang (Release)",
compiler: "clang",
cc: "clang-cl",
cxx: "clang-cl",
cmake_configure_options: '-G "Ninja" -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_LINKER=lld-link',
build_type: "Release",
cmake_build_options: "--config Release"
}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Update Environment
run: pip3 install wheel setuptools
- name: Set Build Date
run: |
$shortSha = git rev-parse --short HEAD
$buildDate = Get-Date -Format 'yyyy-MMM-dd_HH-mm-ss'
$buildVersion = "${shortSha}_$buildDate"
echo "BUILD_VERSION=$buildVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Check Cache for Vulkan SDK
id: cache-vulkan
uses: actions/cache@v4
with:
path: ${{ env.INEXOR_VULKAN_SDK_PATH }}
key: vulkan-sdk-${{ env.INEXOR_VULKAN_SDK_VERSION }}-${{ runner.os }}
- name: Download Vulkan SDK
if: steps.cache-vulkan.outputs.cache-hit != 'true'
run: |
curl -LS -o vulkansdk.exe https://sdk.lunarg.com/sdk/download/${{ env.INEXOR_VULKAN_SDK_VERSION }}/windows/VulkanSDK-${{ env.INEXOR_VULKAN_SDK_VERSION }}-Installer.exe
7z x -y vulkansdk.exe -o"${{ env.INEXOR_VULKAN_SDK_PATH }}"
- name: Check Cache for CMake Files (Build)
id: cache-cmake
uses: actions/cache@v4
with:
path: build
key: cmake-${{ runner.os }}-${{ matrix.config.compiler }}-${{ matrix.config.build_type }}-${{ hashFiles('CMakeLists.txt', '**/CMakeLists.txt', '**/*.cmake') }}
- name: Configure CMake (Build)
if: steps.cache-cmake.outputs.cache-hit != 'true'
run: |
$env:CC="${{ matrix.config.cc }}"
$env:CXX="${{ matrix.config.cxx }}"
$env:Path += ";${{ env.INEXOR_VULKAN_SDK_PATH }}\;${{ env.INEXOR_VULKAN_SDK_PATH }}\Bin\"
$env:VULKAN_SDK="${{ env.INEXOR_VULKAN_SDK_PATH }}"
cmake . `
-Bbuild `
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} `
-DINEXOR_BUILD_BENCHMARKS=ON `
-DINEXOR_BUILD_TESTS=ON `
${{ matrix.config.cmake_configure_options }}
- name: Build Main Code
run: cmake --build build --target inexor-vulkan-renderer-example
- name: Build Tests
run: cmake --build build --target inexor-vulkan-renderer-tests
- name: Build Benchmarks
run: cmake --build build --target inexor-vulkan-renderer-benchmarks
- name: Run Tests
run: |
cd build
# Run all Google Test executables
Get-ChildItem -Recurse -Filter '*-tests.exe' | ForEach-Object {
Write-Host "Running $($_.FullName)"
& $_.FullName --gtest_output=xml:"$($_.FullName).xml"
}
- name: Run Benchmarks
run: |
cd build
if (Test-Path benchmark) { Remove-Item benchmark -Recurse -Force }
mkdir benchmark
Get-ChildItem -Recurse -Filter '*-benchmarks.exe' | ForEach-Object {
Write-Host "Running $($_.FullName)"
& $_.FullName > "benchmark/$($_.BaseName).txt"
}
- name: Prepare Nightly Artifacts
shell: pwsh
run: |
mkdir artifacts
# Copy main executable
Get-ChildItem -Path ./build -Recurse -Filter "inexor-vulkan-renderer-example.exe" | ForEach-Object {
Copy-Item -Path $_.FullName -Destination artifacts
}
# Copy test executables and results
Get-ChildItem -Path ./build -Recurse -Filter "*-tests.exe" | ForEach-Object {
Copy-Item -Path $_.FullName -Destination artifacts
}
Get-ChildItem -Path ./build -Filter "*.xml" | ForEach-Object {
Copy-Item -Path $_.FullName -Destination artifacts
}
# Copy benchmark executables and results
Get-ChildItem -Path ./build -Recurse -Filter "*-benchmarks.exe" | ForEach-Object {
Copy-Item -Path $_.FullName -Destination artifacts
}
mkdir artifacts/benchmark
Get-ChildItem -Path ./build/benchmark -Filter "*.txt" | ForEach-Object {
Copy-Item -Path $_.FullName -Destination artifacts/benchmark
}
# Copy configuration, assets, and shaders
Copy-Item -Path ./configuration/. -Destination artifacts -Recurse
Copy-Item -Path ./assets/. -Destination artifacts -Recurse
mkdir artifacts/shaders
Copy-Item -Path ./shaders/*.spv -Destination artifacts/shaders
# Create nightly archive
7z a -tzip "Nightly_Windows_${{ matrix.config.compiler }}_${{ matrix.config.build_type }}_${{ env.BUILD_VERSION}}.zip" ./artifacts/*
- name: Upload Nightly Artifacts
uses: actions/upload-artifact@v4
with:
name: Nightly_Windows_${{ matrix.config.compiler }}_${{ matrix.config.build_type }}_${{ env.BUILD_VERSION}}
path: Nightly_Windows_${{ matrix.config.compiler }}_${{ matrix.config.build_type }}_${{ env.BUILD_VERSION}}.zip
retention-days: 60