Skip to content

Commit

Permalink
build imgui and extensions in same pipelines with same versions (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcaceresm authored Oct 6, 2024
1 parent 04fa7ae commit 9e655de
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 190 deletions.
10 changes: 3 additions & 7 deletions .github/actions/generate-bindings-nugets/action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Binding Nugets
description: Generate and build bindings
inputs:
ImX:
description: "Values: 'Imgui', 'Imguizmo', 'Imnodes' or 'Implot'. Default 'Imgui'"
required: false
default: Imgui
NugetsPath:
description: "Local path to deliver the nugets"
required: false
Expand All @@ -22,15 +18,15 @@ runs:
shell: pwsh
id: build_bindings
run: |
.\scripts\generate-bindings.ps1 -ImX ${{ inputs.ImX }}
.\scripts\generate-bindings.ps1
- name: Generate NuGet packages
shell: pwsh
id: build_nugets
run: |
.\scripts\generate-nugets.ps1 -ImX ${{ inputs.ImX }} -outputfolder ${{ inputs.NugetsPath }}
.\scripts\generate-nugets.ps1 -outputfolder ${{ inputs.NugetsPath }}
- name: Save nugets
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.ImX }}-nugets
name: Imgui-nugets
path: ${{ inputs.NugetsPath }}
retention-days: 5
83 changes: 0 additions & 83 deletions .github/workflows/cd-extensions.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .github/workflows/cd-imgui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ jobs:
- uses: ./.github/actions/build-native-win
with:
Target: Imgui
- uses: ./.github/actions/build-native-win
with:
Target: Extensions
- uses: ./.github/actions/generate-bindings-nugets
id: nugets
with:
ImX: Imgui
NugetsPath: ${{ env.nugetsPath }}
- name: Verify changes
id: verify-changed-files
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/ci-extensions.yml

This file was deleted.

9 changes: 7 additions & 2 deletions .github/workflows/ci-imgui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ on:
push:
paths:
- "Generator/ImguiGen/**"
- "Generator/ImguizmoGen/**"
- "Generator/ImnodesGen/**"
- "Generator/ImplotGen/**"
- "NativeLibraries/cimgui/**"
- "NativeLibraries/extensions/**"
- "scripts/deploy-win-native.ps1"
- "scripts/generate-bindings.ps1"
- "scripts/generate-nugets.ps1"
Expand All @@ -20,6 +24,7 @@ jobs:
- uses: ./.github/actions/build-native-win
with:
Target: Imgui
- uses: ./.github/actions/generate-bindings-nugets
- uses: ./.github/actions/build-native-win
with:
ImX: Imgui
Target: Extensions
- uses: ./.github/actions/generate-bindings-nugets
85 changes: 44 additions & 41 deletions scripts/generate-bindings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,57 +11,60 @@
#>

param (
[ValidateSet('Imgui', 'Imguizmo', 'Imnodes', 'Implot')][string]$ImX = "Imgui",
[string[]]$ImX = @('Imgui', 'Imguizmo', 'Imnodes', 'Implot'),
[string]$buildVerbosity = "normal",
[string]$buildConfiguration = "Release"
)

$ErrorActionPreference = "Stop"
. "$PSScriptRoot\ps_support.ps1"

# Set working directory
Push-Location (Get-Location).Path
Set-Location $PSScriptRoot\..\Generator
# Iterate over each ImX value and generate packages
foreach ($item in $ImX) {
# Set working directory
Push-Location (Get-Location).Path
Set-Location $PSScriptRoot\..\Generator

$imxGenCsprojPath = "$($ImX)Gen\$($ImX)Gen.csproj"
$imxGenCsprojPath = "$($item)Gen\$($item)Gen.csproj"

# Utility functions
function LogDebug($line)
{ Write-Host "##[debug] $line" -Foreground Blue -Background Black
}
# Utility functions
function LogDebug($line)
{ Write-Host "##[debug] $line" -Foreground Blue -Background Black
}

# Show variables
LogDebug "############## VARIABLES ##############"
LogDebug "Build configuration.: $buildConfiguration"
LogDebug "Build verbosity.....: $buildVerbosity"
LogDebug "#######################################"
# Show variables
LogDebug "############## VARIABLES ##############"
LogDebug "Build configuration.: $buildConfiguration"
LogDebug "Build verbosity.....: $buildVerbosity"
LogDebug "#######################################"

# Build generator
LogDebug "START generator build process"
dotnet publish "$imxGenCsprojPath" -v:$buildVerbosity -p:Configuration=$buildConfiguration
if($?)
{
LogDebug "END generator build process"
}
else
{
LogDebug "ERROR; Generator build failed"
exit -1
}
# Build generator
LogDebug "START generator build process"
dotnet publish "$imxGenCsprojPath" -v:$buildVerbosity -p:Configuration=$buildConfiguration
if($?)
{
LogDebug "END generator build process"
}
else
{
LogDebug "ERROR; Generator build failed"
exit -1
}

LogDebug "START bindings generator process"
$cmd = ".\publish\$($ImX)Gen.exe"
Push-Location .\$($ImX)Gen\bin\Release\net8.0
$($cmd)
if($?)
{
LogDebug "END bindings generator process"
}
else
{
LogDebug "ERROR; Bindings generation failed"
exit -1
}
Pop-Location
LogDebug "START bindings generator process"
$cmd = ".\publish\$($item)Gen.exe"
Push-Location .\$($item)Gen\bin\Release\net8.0
$($cmd)
if($?)
{
LogDebug "END bindings generator process"
}
else
{
LogDebug "ERROR; Bindings generation failed"
exit -1
}
Pop-Location

Pop-Location
Pop-Location
}
47 changes: 24 additions & 23 deletions scripts/generate-nugets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,32 @@
#>

param (
[ValidateSet('Imgui', 'Imguizmo', 'Imnodes', 'Implot')][string]$ImX = "Imgui",
[string]$outputFolderBase = "nupkgs",
[string]$buildVerbosity = "normal",
[string]$buildConfiguration = "Release",
[string]$versionSuffix = ""
[string[]]$ImX = @('Imgui', 'Imguizmo', 'Imnodes', 'Implot'),
[string]$outputFolderBase = "nupkgs",
[string]$buildVerbosity = "normal",
[string]$buildConfiguration = "Release",
[string]$versionSuffix = ""
)

$ErrorActionPreference = "Stop"
. "$PSScriptRoot\ps_support.ps1"

# calculate version
$version = "$(Get-Date -Format "yyyy.M.d").$([string]([int]$(Get-Date -Format "HH")*60+[int]$(Get-Date -Format "mm")))"

if ($versionSuffix -ne "") {
$version = "$version-$versionSuffix"
}

# Set working directory
Push-Location (Get-Location).Path
Set-Location $PSScriptRoot\..

$csprojPath = "Evergine.Bindings.$($ImX)\Evergine.Bindings.$($ImX).csproj"

# Utility functions
function LogDebug($line) {
Write-Host "##[debug] $line" -Foreground Blue -Background Black
}

# calculate version
$version = "$(Get-Date -Format "yyyy.M.d").$([string]([int]$(Get-Date -Format "HH")*60+[int]$(Get-Date -Format "mm")))"

if ($versionSuffix -ne "") {
$version = "$version-$versionSuffix"
}

# Show variables
LogDebug "############## VARIABLES ##############"
LogDebug "Version.............: $version"
Expand All @@ -59,15 +57,18 @@ if ($buildConfiguration -eq "Debug") {

Set-Location .\Generator

# Generate packages
LogDebug "START packaging process"
dotnet pack "$csprojPath" -v:$buildVerbosity -p:Configuration=$buildConfiguration -p:PackageOutputPath="$absoluteOutputFolder" -p:IncludeSymbols=$symbols -p:Version=$version
if ($?) {
LogDebug "END packaging process"
}
else {
LogDebug "ERROR; packaging failed"
exit -1
# Iterate over each ImX value and generate packages
foreach ($item in $ImX) {
LogDebug "START packaging process for $item"
$csprojPath = "Evergine.Bindings.$($item)\Evergine.Bindings.$($item).csproj"
dotnet pack "$csprojPath" -v:$buildVerbosity -p:Configuration=$buildConfiguration -p:PackageOutputPath="$absoluteOutputFolder" -p:IncludeSymbols=$symbols -p:Version=$version
if ($?) {
LogDebug "END packaging process for $item"
}
else {
LogDebug "ERROR; packaging failed for $item"
exit -1
}
}

Pop-Location

0 comments on commit 9e655de

Please sign in to comment.