Skip to content

Build and upload release on multiple platforms #39

Build and upload release on multiple platforms

Build and upload release on multiple platforms #39

name: Build and upload release on multiple platforms
on:
workflow_dispatch:
jobs:
release-windows:
runs-on: windows-latest
name: Build on Windows-latest
steps:
#checkout code
- name: Checkout code
id: checkout_code
uses: actions/checkout@v4
#Setup Vulkan SDK
- name: Install Vulkan SDK
uses: humbletim/[email protected]
with:
version: latest
cache: true
#Locate MSBuild.eze and add to PATH
- name: Add MSBuild to PATH
id: setup_msbuild
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: x64
#Run MSBuild Release
- name: Run MSBuild Release
id: run_msbuild_release
working-directory: .\
run: msbuild.exe .\ -t:VulVoxOptimizationProject -property:Configuration=Release -property:Platform=x64
#Upload release build as artifact
- uses: actions/upload-artifact@v4
with:
name: windows-release-artifact
path: x64/Release
release-macOS:
runs-on: macos-latest
name: Build on MacOS-latest
env:
VULKAN_SDK_VERSION: ""
VULKAN_SDK_INSTALLER: ""
VERSION_URL: "https://vulkan.lunarg.com/sdk/latest/mac.txt"
SDK_URL: ""
steps:
#checkout code
- name: Checkout code
id: checkout_code
uses: actions/checkout@v4
#Setup Vulkan SDK
- name: Check Vulkan SDK Version
shell: bash
run: |
echo "retrieving latest version from url: $VERSION_URL"
VULKAN_SDK_VERSION=$(curl -sL $VERSION_URL)
echo "latest version for MacOS is: $VULKAN_SDK_VERSION"
echo "VULKAN_SDK_VERSION=$VULKAN_SDK_VERSION" >> $GITHUB_ENV
- name: Download and unzip Vulkan SDK
shell: bash
run: |
VULKAN_SDK_VERSION=${{env.VULKAN_SDK_VERSION}}
VERSION_URL=${{env.VERSION_URL}}
VULKAN_SDK_INSTALLER=$PWD/VULKAN_SDK_INSTALLER
echo "VULKAN_SDK_INSTALLER=$VULKAN_SDK_INSTALLER" >> $GITHUB_ENV
SDK_URL="https://sdk.lunarg.com/sdk/download/$VULKAN_SDK_VERSION/mac/vulkan_sdk.dmg?Human=true"
echo "SDK_URL=$SDK_URL" >> $GITHUB_ENV
echo "Downloading Vulkan SDK $VULKAN_SDK_VERSION from $SDK_URL"
curl --fail-with-body -s -L -o vulkan_sdk.zip $SDK_URL || { echo "curl failed with error code: $?" >&2 ; curl -s -L --head $VERSION_URL >&2 ; exit 32 ; }
test -f vulkan_sdk.zip
ls -lh vulkan_sdk.zip >&2
echo "Unzipping Vulkan SDK into $VULKAN_SDK_INSTALLER"
mkdir -p "$VULKAN_SDK_INSTALLER"
unzip -q vulkan_sdk.zip -d "$VULKAN_SDK_INSTALLER"
ls -lh "$VULKAN_SDK_INSTALLER" >&2
du -hs $VULKAN_SDK_INSTALLER
- name: Install Vulkan SDK
shell: bash
run: |
VULKAN_SDK_INSTALLER=${{env.VULKAN_SDK_INSTALLER}}
VULKAN_SDK=$PWD/VULKAN_SDK
echo "Installing from unzipped folder: $VULKAN_SDK_INSTALLER"
sudo $VULKAN_SDK_INSTALLER/InstallVulkan.app/Contents/MacOS/InstallVulkan --root "$VULKAN_SDK" --accept-licenses --default-answer --confirm-command install
echo "Cleaning installer files"
sudo rm -rf "$VULKAN_SDK_INSTALLER"
#Check install
if [ ! -d "$VULKAN_SDK" ]; then
echo "Error: Vulkan SDK installation failed." >&2
exit 1
fi
#ls -h $VULKAN_SDK
cd $VULKAN_SDK
sudo ./install_vulkan.py
- name: Install glfw
run: brew install glfw
- name: Create build directory
run: cmake -S VulVoxOptimizationProject/ -B build/ -D CMAKE_BUILD_TYPE=Release
- name: Build project
run: cmake --build build/ --config Release
#Upload release build as artifact
- uses: actions/upload-artifact@v4
with:
name: mac-release-artifact
path: ./build/libVulVoxOptimizationProject.a