Skip to content

Fix CI/CD Release Skipping and Multi-Platform Packages #192

Fix CI/CD Release Skipping and Multi-Platform Packages

Fix CI/CD Release Skipping and Multi-Platform Packages #192

Workflow file for this run

name: Build and Release
on:
push:
branches: [ master, main ]
tags:
- '**'
pull_request:
branches: [ master, main ]
jobs:
build-windows:
runs-on: windows-latest
env:
VULKAN_SDK: C:\VulkanSDK\1.3.290.0
steps:
- uses: actions/checkout@v4
- name: Cache Vulkan SDK
id: cache-vulkan
uses: actions/cache@v4
with:
path: C:\VulkanSDK
key: vulkan-sdk-1.3.290.0-windows
- name: Install Vulkan SDK
if: steps.cache-vulkan.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.3.290.0/windows/VulkanSDK-1.3.290.0-Installer.exe" -OutFile VulkanSDK.exe
Start-Process -FilePath .\VulkanSDK.exe -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait
shell: pwsh
- name: Clone dependencies
run: |
if (!(Test-Path "external/glfw")) { git clone --depth 1 https://github.com/glfw/glfw.git external/glfw }
if (!(Test-Path "external/glm")) { git clone --depth 1 https://github.com/g-truc/glm.git external/glm }
if (!(Test-Path "external/imgui")) { git clone --depth 1 https://github.com/ocornut/imgui.git external/imgui }
shell: pwsh
- name: Configure CMake
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
env:
VULKAN_SDK: ${{ env.VULKAN_SDK }}
- name: Build
run: cmake --build build --config Release
- name: Compile Shaders
run: |
$env:PATH = "$env:VULKAN_SDK\Bin;$env:PATH"
if (Test-Path "compile_shaders.bat") {
cmd /c compile_shaders.bat
}
shell: pwsh
- name: Package
run: |
mkdir release
copy build\Release\RacingEngine.exe release\
mkdir release\shaders\compiled
copy shaders\compiled\*.spv release\shaders\compiled\
if (Test-Path "assets") {
xcopy /E /I assets release\assets
}
Compress-Archive -Path release\* -DestinationPath RacingEngine-Windows.zip
shell: pwsh
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: windows-bin
path: RacingEngine-Windows.zip
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libvulkan-dev libglfw3-dev libglm-dev build-essential cmake libxkbcommon-dev libxcursor-dev libxi-dev libxinerama-dev vulkan-tools glslang-tools
- name: Clone dependencies
run: |
mkdir -p external
git clone --depth 1 https://github.com/glfw/glfw.git external/glfw
git clone --depth 1 https://github.com/g-truc/glm.git external/glm
- name: Compile Shaders
run: |
mkdir -p shaders/compiled
glslangValidator -V shaders/raygen.rgen -o shaders/compiled/raygen.rgen.spv --target-env vulkan1.3
glslangValidator -V shaders/miss.rmiss -o shaders/compiled/miss.rmiss.spv --target-env vulkan1.3
glslangValidator -V shaders/closesthit.rchit -o shaders/compiled/closesthit.rchit.spv --target-env vulkan1.3
glslangValidator -V shaders/shadow.rmiss -o shaders/compiled/shadow.rmiss.spv --target-env vulkan1.3
glslangValidator -V shaders/tonemap.comp -o shaders/compiled/tonemap.comp.spv --target-env vulkan1.3
- name: Configure CMake
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build
- name: Package
run: |
mkdir release
cp build/RacingEngine release/
mkdir -p release/shaders/compiled
cp shaders/compiled/*.spv release/shaders/compiled/
if [ -d "assets" ]; then
cp -r assets release/
fi
tar -czvf RacingEngine-Linux.tar.gz -C release .
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: linux-bin
path: RacingEngine-Linux.tar.gz
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up NDK
run: echo "Using pre-installed NDK at $ANDROID_NDK_LATEST_HOME"
- name: Clone dependencies
run: |
mkdir -p external
git clone --depth 1 https://github.com/g-truc/glm.git external/glm
- name: Configure and Build
run: |
cmake -B build-android -S . \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a \
-DANDROID_PLATFORM=android-26 \
-DCMAKE_BUILD_TYPE=Release
cmake --build build-android
- name: Package
run: cp build-android/libRacingEngine.so .
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: android-bin
path: libRacingEngine.so
release:
needs: [build-windows, build-linux, build-android]
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: List artifacts
run: ls -R artifacts
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}
files: |
artifacts/windows-bin/RacingEngine-Windows.zip
artifacts/linux-bin/RacingEngine-Linux.tar.gz
artifacts/android-bin/libRacingEngine.so
generate_release_notes: true
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}