Skip to content
Merged
Changes from all commits
Commits
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
39 changes: 13 additions & 26 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,29 +120,14 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
submodules: recursive

- name: Check if C++ build needed
id: check-cpp
run: |
if [ "${{ needs.check-changes.outputs.should-build }}" != "true" ]; then
echo "No C++ changes detected, skipping build steps"
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "C++ changes detected, proceeding with build"
echo "skip=false" >> $GITHUB_OUTPUT
fi
shell: bash

- uses: ilammy/msvc-dev-cmd@v1.10.0
if: steps.check-cpp.outputs.skip != 'true'

- name: Setup vcpkg
if: steps.check-cpp.outputs.skip != 'true'
uses: lukka/run-vcpkg@v11.5
with:
vcpkgJsonGlob: vcpkg.json

- name: Cache CMake build output
if: steps.check-cpp.outputs.skip != 'true'
uses: actions/cache@v4
with:
path: build/ALL
Expand All @@ -152,27 +137,29 @@ jobs:
${{ runner.os }}-cmake-

- name: Build using run-cmake
if: steps.check-cpp.outputs.skip != 'true'
uses: lukka/run-cmake@v10
with:
configurePreset: ALL
buildPreset: ALL

- name: Extract version from CMake
id: get_version
shell: bash
shell: pwsh
run: |
if [ "${{ steps.check-cpp.outputs.skip }}" == "true" ]; then
# When skipping build, extract version from CMakeLists.txt
VERSION=$(grep 'project(.*VERSION' CMakeLists.txt | sed -E 's/.*VERSION ([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
else
# When building, extract version from CMakeCache.txt
VERSION=$(grep 'CMAKE_PROJECT_VERSION:STATIC' build/ALL/CMakeCache.txt | cut -d= -f2)
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
$content = Get-Content build/ALL/CMakeCache.txt
$versionLine = $content | Select-String -Pattern 'CMAKE_PROJECT_VERSION:STATIC'
if ($versionLine) {
$version = ($versionLine -replace '.*=([0-9]+\.[0-9]+\.[0-9]+).*', '$1').ToString()
} else {
Write-Error "Version extraction failed: CMAKE_PROJECT_VERSION not found in CMakeCache.txt" -ErrorAction Stop
}
if (-not $version -or $version -eq "") {
Write-Error "Version extraction failed: no version found" -ErrorAction Stop
}
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append

- name: Upload dist artifacts
if: success() && steps.check-cpp.outputs.skip != 'true'
if: success()
uses: actions/upload-artifact@v4
with:
name: dist-artifacts
Expand Down