build-artifacts #20
Workflow file for this run
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-artifacts | |
on: | |
workflow_dispatch: | |
inputs: | |
draftRelease: | |
description: 'Create a draft release for the built artifacts' | |
required: true | |
default: false | |
type: boolean | |
releaseTag: | |
description: 'Tag to create for release' | |
required: false | |
default: 'v0.2' | |
type: string | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [windows-2022, ubuntu-20.04, macOS-12] | |
sdkTag: ['vulkan-sdk-1.3.283.0', 'vulkan-sdk-1.3.280.0', 'vulkan-sdk-1.3.275.0'] | |
include: | |
- os: windows-2022 | |
swiftshaderLibName: vk_swiftshader.dll | |
- os: ubuntu-20.04 | |
swiftshaderLibName: libvk_swiftshader.so | |
- os: macOS-12 | |
swiftshaderLibName: libvk_swiftshader.dylib | |
name: 'build ${{ matrix.os }} | ${{ matrix.sdkTag }}' | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Print Inputs | |
shell: bash | |
run: echo "Requested VulkanSDK ${{ matrix.sdkTag }}" | |
- name: Set up MSVC | |
if: ${{ runner.os == 'Windows' }} | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Install dependencies | |
if: ${{ runner.os == 'Linux' }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y xorg-dev libwayland-dev | |
- name: Set up environment variables | |
shell: bash | |
run: | | |
SDK_VERSION=$(echo "${{ matrix.sdkTag }}" | sed -E 's/[^0-9]*([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*/\1/') | |
echo "ARTIFACT_NAME=vulkanCI-$SDK_VERSION-${{ matrix.os }}-x64" >> $GITHUB_ENV | |
ROOT_PATH='${{ github.workspace }}' | |
echo "SDK_PATH=${ROOT_PATH//\\//}/VulkanSDK/$SDK_VERSION" >> $GITHUB_ENV | |
- name: Checkout Vulkan-Headers | |
uses: actions/checkout@v4 | |
with: | |
repository: KhronosGroup/Vulkan-Headers | |
ref: '${{ matrix.sdkTag }}' | |
path: 'Vulkan-Headers' | |
- name: Build Vulkan-Headers | |
shell: bash | |
run: | | |
cmake -S Vulkan-Headers -B Vulkan-Headers/build | |
cmake --install Vulkan-Headers/build --prefix ${{ env.SDK_PATH }} | |
- name: Checkout Vulkan-Loader | |
uses: actions/checkout@v4 | |
with: | |
repository: KhronosGroup/Vulkan-Loader | |
ref: '${{ matrix.sdkTag }}' | |
path: 'Vulkan-Loader' | |
- name: Build Vulkan-Loader | |
shell: bash | |
run: | | |
cmake -S Vulkan-Loader -B Vulkan-Loader/build -DVULKAN_HEADERS_INSTALL_DIR=${{ env.SDK_PATH }} -DLOADER_USE_UNSAFE_FILE_SEARCH=ON -DCMAKE_BUILD_TYPE=Release | |
cmake --build Vulkan-Loader/build --config Release --parallel 4 | |
cmake --install Vulkan-Loader/build --prefix ${{ env.SDK_PATH }} | |
- name: Checkout Vulkan-ValidationLayers | |
uses: actions/checkout@v4 | |
with: | |
repository: KhronosGroup/Vulkan-ValidationLayers | |
ref: '${{ matrix.sdkTag }}' | |
path: 'Vulkan-ValidationLayers' | |
- name: Build Vulkan-ValidationLayers | |
shell: bash | |
run: | | |
cmake -S Vulkan-ValidationLayers -B Vulkan-ValidationLayers/build -DUPDATE_DEPS=ON -DCMAKE_BUILD_TYPE=Release | |
cmake --build Vulkan-ValidationLayers/build --config Release --parallel 4 | |
cmake --install Vulkan-ValidationLayers/build --prefix ${{ env.SDK_PATH }} | |
cp Vulkan-ValidationLayers/LICENSE.txt ${{ env.SDK_PATH }} | |
- name: Checkout Swiftshader | |
uses: actions/checkout@v4 | |
with: | |
repository: NcStudios/swiftshader | |
ref: 'release' | |
path: 'Swiftshader' | |
submodules: 'recursive' | |
- name: Build Swiftshader | |
shell: bash | |
run: | | |
cmake -S Swiftshader -B Swiftshader/build_out -DCMAKE_BUILD_TYPE=Release | |
cmake --build Swiftshader/build_out --target vk_swiftshader --config Release --parallel 4 | |
if [[ "${{ runner.os }}" == "Windows" ]]; then | |
OUT_DIR=Windows | |
elif [[ "${{ runner.os }}" == "Linux" ]]; then | |
OUT_DIR=Linux | |
elif [[ "${{ runner.os }}" == "macOS" ]]; then | |
OUT_DIR=Darwin | |
fi | |
mkdir ${{ env.SDK_PATH }}/swiftshader | |
cp Swiftshader/build_out/$OUT_DIR/${{ matrix.swiftshaderLibName }} ${{ env.SDK_PATH }}/swiftshader | |
cp Swiftshader/LICENSE.txt ${{ env.SDK_PATH }}/swiftshader | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: VulkanSDK | |
publish: | |
name: Draft Release | |
if: ${{ inputs.draftRelease }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: vulkanCI-*-.zip | |
path: artifacts | |
merge-multiple: true | |
- name: Create Release | |
env: | |
GH_TOKEN: ${{ github.token }} | |
GH_REPO: NcStudios/VulkanCI | |
run: | | |
ls -R artifacts | |
gh release create ${{ inputs.releaseTag }} \ | |
--draft \ | |
--title "VulkanCI ${{ inputs.releaseTag }}" \ | |
--generate-notes \ | |
for file in artifacts/*; do | |
gh release upload ${{ inputs.releaseTag }} $file | |
done |