Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ea02373
Add cross-platform GitHub Actions CI with Vulkan SDK and dependency s…
gpx1000 Jul 1, 2025
b752661
Switch Vulkan SDK installation to tarball method on Linux and refine …
gpx1000 Jul 2, 2025
7ecee14
Refine workflow to improve cross-platform dependency setup and Vulkan…
gpx1000 Jul 2, 2025
c9f7771
Refactor Vulkan SDK installation steps across platforms for better re…
gpx1000 Jul 2, 2025
638a945
Switch Vulkan SDK archive format to `.tar.xz` for improved compatibil…
gpx1000 Jul 2, 2025
46c77c2
Add Ninja build system support and switch Vulkan SDK archive to `.tar…
gpx1000 Jul 2, 2025
6200293
Remove macOS build from CI workflow and enable C++ module scanning in…
gpx1000 Jul 2, 2025
4c35e20
Enable per-target C++ module scanning in CMake configuration
gpx1000 Jul 2, 2025
f235198
Add Clang support and enhance C++20 module configuration in workflow …
gpx1000 Jul 2, 2025
7105e00
Refine dependency caching in CI workflow for improved cross-platform …
gpx1000 Jul 2, 2025
5e7b4f4
Update shader compilation command to use absolute output path
gpx1000 Jul 2, 2025
422555b
Refactor shader compilation functions to use absolute output paths an…
gpx1000 Jul 2, 2025
1dc7b0c
revert back to the simpler method that worked.
gpx1000 Jul 2, 2025
c3d12af
Improve CI script by adding checks for existing directories before cl…
gpx1000 Jul 2, 2025
ccc96cb
Switch Vulkan SDK back to `.tar.gz` format and simplify CI workflows
gpx1000 Jul 2, 2025
99f2944
Switch Vulkan SDK to `.tar.xz` format and enhance CI workflows
gpx1000 Jul 2, 2025
ff03609
Simplify Vulkan SDK installation on Windows
gpx1000 Jul 2, 2025
7da9b41
Add Antora CI workflow for documentation build
gpx1000 Jul 2, 2025
81d94f3
Improve Antora CI workflow by adding cache-dependency-path for npm step
gpx1000 Jul 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/build-antora-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2024 Sascha Willems
# SPDX-License-Identifier: CC-BY-4.0
# This Antora playbook is used by the CI to make sure the Antora build works
name: "Build Antora documentation"
on:
workflow_dispatch:
pull_request:
types: [ opened, synchronize, reopened ]
push:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: "Get Antora UI bundle"
uses: actions/checkout@v4
with:
repository: KhronosGroup/antora-ui-khronos
path: ./antora-ui-khronos
ref: main
- name: "Install npm"
uses: actions/setup-node@v4
with:
node-version: 'latest'
cache: 'npm'
cache-dependency-path: './antora-ui-khronos/package-lock.json'
- name: "Install dependencies"
run: |
sudo apt-get update
sudo apt-get install -y asciidoctor
- name: "Build UI bundle"
working-directory: ./antora-ui-khronos
run: |
npx update-browserslist-db@latest
./node_modules/gulp/bin/gulp.js --version
./node_modules/gulp/bin/gulp.js bundle
- name: "Copy UI bundle"
run: cp ./antora-ui-khronos/build/ui-bundle.zip ./
- name: "Build tutorial"
run: |
cd antora
make
- name: "Build Antora documentation"
working-directory: ./
run: npx antora antora-ci-playbook.yml --stacktrace
292 changes: 292 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
name: CMake CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
vulkan-install: |
# Download and install Vulkan SDK using the tar.gz method
VULKAN_VERSION=$(curl -s https://vulkan.lunarg.com/sdk/latest/linux.txt)
echo "Using Vulkan SDK version: $VULKAN_VERSION"

# Create a temporary directory for the SDK
mkdir -p vulkan-sdk
cd vulkan-sdk

# Download the SDK
curl -O "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz"

# Extract the SDK - use tar with J flag for xz compression
tar -xJf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz

# Set up environment variables
echo "VULKAN_SDK=$PWD/$VULKAN_VERSION/x86_64" >> $GITHUB_ENV
echo "PATH=$PWD/$VULKAN_VERSION/x86_64/bin:$PATH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$PWD/$VULKAN_VERSION/x86_64/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "VK_LAYER_PATH=$PWD/$VULKAN_VERSION/x86_64/etc/vulkan/explicit_layer.d" >> $GITHUB_ENV

# Return to the original directory
cd ..
deps-install: |
# GitHub runners already have cmake, ninja-build, and clang installed
sudo apt-get update
sudo apt-get install -y \
libglfw3-dev \
libglm-dev \
libtinyobjloader-dev \
libstb-dev
test-cmd: |
# Check if some of the expected executables were built
if [ -f "00_base_code/00_base_code" ]; then
echo "00_base_code built successfully"
else
echo "00_base_code build failed"
exit 1
fi

if [ -f "15_hello_triangle/15_hello_triangle" ]; then
echo "15_hello_triangle built successfully"
else
echo "15_hello_triangle build failed"
exit 1
fi

if [ -f "31_compute_shader/31_compute_shader" ]; then
echo "31_compute_shader built successfully"
else
echo "31_compute_shader build failed"
exit 1
fi
- os: windows-latest
vulkan-install: |
# Download the Vulkan SDK installer
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" -OutFile "$env:TEMP\vulkan-sdk.exe"

# Run the installer with silent options
Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait -NoNewWindow

# Find the actual installed SDK version
$vulkanPath = Get-ChildItem "C:\VulkanSDK" | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName

if (-not $vulkanPath) {
$vulkanPath = "C:\VulkanSDK\latest"
}

# Set environment variables with correct Windows-style paths
echo "VULKAN_SDK=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$vulkanPath\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "CMAKE_PREFIX_PATH=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "Vulkan_INCLUDE_DIR=$vulkanPath\Include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "Vulkan_LIBRARY=$vulkanPath\Lib\vulkan-1.lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

# Display debug information
Write-Host "Vulkan SDK path: $vulkanPath"
if (Test-Path "$vulkanPath\Lib") {
Write-Host "Lib directory exists"
} else {
Write-Host "Lib directory does not exist"
}
if (Test-Path "$vulkanPath\Include") {
Write-Host "Include directory exists"
} else {
Write-Host "Include directory does not exist"
}
deps-install: |
vcpkg install glfw3:x64-windows glm:x64-windows tinyobjloader:x64-windows stb:x64-windows
echo "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV
test-cmd: |
# Check if some of the expected executables were built
if (Test-Path "00_base_code/Release/00_base_code.exe") {
echo "00_base_code built successfully"
} else {
echo "00_base_code build failed"
exit 1
}

if (Test-Path "15_hello_triangle/Release/15_hello_triangle.exe") {
echo "15_hello_triangle built successfully"
} else {
echo "15_hello_triangle build failed"
exit 1
}

if (Test-Path "31_compute_shader/Release/31_compute_shader.exe") {
echo "31_compute_shader built successfully"
} else {
echo "31_compute_shader build failed"
exit 1
}

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3

# Cache vcpkg packages for Windows
- name: Cache vcpkg packages (Windows)
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: |
${{ env.VCPKG_INSTALLATION_ROOT }}/installed
${{ env.VCPKG_INSTALLATION_ROOT }}/packages
${{ env.VCPKG_INSTALLATION_ROOT }}/buildtrees
key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}
restore-keys: |
${{ runner.os }}-vcpkg-${{ hashFiles('**/CMakeLists.txt') }}-
${{ runner.os }}-vcpkg-

# Cache Vulkan SDK for Windows
- name: Cache Vulkan SDK (Windows)
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: C:\VulkanSDK
key: ${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-vulkan-sdk-

# Cache apt packages for Ubuntu
- name: Cache apt packages (Ubuntu)
if: runner.os == 'Linux'
uses: actions/cache@v3
with:
path: /var/cache/apt/archives
key: ${{ runner.os }}-apt-${{ hashFiles('**/workflow.yml') }}
restore-keys: |
${{ runner.os }}-apt-

# Cache Vulkan SDK for Ubuntu
- name: Cache Vulkan SDK (Ubuntu)
if: runner.os == 'Linux'
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/vulkan-sdk
key: ${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}
restore-keys: |
${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/CMakeLists.txt') }}-
${{ runner.os }}-vulkan-sdk-

- name: Install dependencies
run: ${{ matrix.deps-install }}

- name: Install Vulkan SDK
run: ${{ matrix.vulkan-install }}

- name: Verify Vulkan Installation (Windows)
if: runner.os == 'Windows'
run: |
if (Test-Path $env:VULKAN_SDK) {
echo "Vulkan SDK found at: $env:VULKAN_SDK"

# Check for critical directories and files
$criticalPaths = @(
"$env:VULKAN_SDK\Include",
"$env:VULKAN_SDK\Lib",
"$env:VULKAN_SDK\Bin",
"$env:VULKAN_SDK\Include\vulkan\vulkan.h",
"$env:VULKAN_SDK\Lib\vulkan-1.lib",
"$env:VULKAN_SDK\Bin\glslangValidator.exe"
)

$allPathsExist = $true
foreach ($path in $criticalPaths) {
if (Test-Path $path) {
echo "✓ Found: $path"
} else {
echo "✗ Missing: $path"
$allPathsExist = $false
}
}

if ($allPathsExist) {
echo "Vulkan SDK installation verified successfully"
} else {
echo "Vulkan SDK installation is incomplete!"
exit 1
}
} else {
echo "Vulkan SDK not found!"
exit 1
}

# Cache CMake build directory for Windows
- name: Cache build artifacts (Windows)
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: ${{github.workspace}}/attachments/build
key: ${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}-${{ hashFiles('**/*.h') }}
restore-keys: |
${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-
${{ runner.os }}-build-

- name: Configure CMake (Windows)
working-directory: ${{github.workspace}}/attachments
if: runner.os == 'Windows'
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release `
-DVulkan_INCLUDE_DIR="$env:Vulkan_INCLUDE_DIR" `
-DVulkan_LIBRARY="$env:Vulkan_LIBRARY" `
-DCMAKE_PREFIX_PATH="$env:VULKAN_SDK" `
-DCMAKE_TOOLCHAIN_FILE="$env:CMAKE_TOOLCHAIN_FILE"

# Display CMake cache to debug Vulkan detection
if (Test-Path "build/CMakeCache.txt") {
Write-Host "CMake cache contents:"
Get-Content "build/CMakeCache.txt" | Select-String -Pattern "Vulkan"
}

# Verify Vulkan Installation for Ubuntu
- name: Verify Vulkan Installation (Ubuntu)
if: runner.os == 'Linux'
run: |
if [ -d "$VULKAN_SDK" ]; then
echo "Vulkan SDK found at: $VULKAN_SDK"
echo "Vulkan SDK installation verified"
else
echo "Vulkan SDK not found!"
exit 1
fi

# Cache CMake build directory for Ubuntu
- name: Cache build artifacts (Ubuntu)
if: runner.os == 'Linux'
uses: actions/cache@v3
with:
path: ${{github.workspace}}/attachments/build
key: ${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}-${{ hashFiles('**/*.h') }}
restore-keys: |
${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-
${{ runner.os }}-build-

- name: Configure CMake (Unix)
working-directory: ${{github.workspace}}/attachments
if: runner.os != 'Windows'
run: |
# Use Clang for better C++20 module support
export CC=clang
export CXX=clang++

cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_SCAN_FOR_MODULES=ON \
-DCMAKE_CXX_FLAGS="-std=c++20"

- name: Build
working-directory: ${{github.workspace}}/attachments
run: cmake --build build --config Release

- name: Test Build Output
working-directory: ${{github.workspace}}/attachments/build
run: ${{ matrix.test-cmd }}
14 changes: 14 additions & 0 deletions antora-ci-playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2024 Sascha Willems
# SPDX-License-Identifier: CC-BY-4.0
# This Antora playbook is used by the CI to make sure the Antora build works
site:
title: Vulkan Tutorial Antora CI Playbook
start_page: tutorial::00_Introduction.adoc
content:
sources:
- url: ./
branches: HEAD
start_path: antora
ui:
bundle:
url: ui-bundle.zip
1 change: 1 addition & 0 deletions attachments/00_base_code.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <memory>
import vulkan_hpp;
#include <GLFW/glfw3.h>

Expand Down
9 changes: 9 additions & 0 deletions attachments/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
cmake_minimum_required (VERSION 3.29)

# Enable C++ module dependency scanning
set(CMAKE_CXX_SCAN_FOR_MODULES ON)

project (VulkanTutorial)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
Expand Down Expand Up @@ -35,6 +38,12 @@ target_sources(VulkanCppModule
"${Vulkan_INCLUDE_DIR}/vulkan/vulkan.cppm"
)

# Add the vulkan.cppm file directly as a source file
target_sources(VulkanCppModule
PRIVATE
"${Vulkan_INCLUDE_DIR}/vulkan/vulkan.cppm"
)

find_package (tinyobjloader REQUIRED)

find_package (PkgConfig)
Expand Down
Loading