Skip to content

Commit 0aec06c

Browse files
committed
Update sync standards and workflows
1 parent 510c679 commit 0aec06c

File tree

7 files changed

+126
-25
lines changed

7 files changed

+126
-25
lines changed

.github/workflows/CD.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@ name: CD
77

88
on:
99
workflow_dispatch:
10+
inputs:
11+
skip-assets-publishing:
12+
description: 'Skip assets publishing'
13+
required: false
14+
type: boolean
15+
default: false
1016

1117
jobs:
1218
cd:
1319
if: github.event_name != 'schedule' || github.ref == 'refs/heads/master'
14-
uses: EvergineTeam/evergine-standards/.github/workflows/binding-simple-cd.yml@main
20+
uses: EvergineTeam/evergine-standards/.github/workflows/binding-simple-cd.yml@v2
1521
with:
1622
generator-project: "RenderDocGen/RenderDocGen/RenderDocGen.csproj" # Path to your generator .csproj
1723
generator-name: "RenderDoc" # Name of your generator executable
@@ -22,7 +28,7 @@ jobs:
2228
runtime-identifier: "win-x64" # Runtime identifier (win-x64, linux-x64, etc.)
2329
build-configuration: "Release" # Build configuration (Release, Debug, etc.)
2430
revision: ${{ github.run_number }} # Revision for date-based version (bindings style). Use with bindings.
25-
publish-enabled: true # Publish NuGets to Nuget.org
31+
publish-enabled: ${{ !inputs.skip-assets-publishing }} # Publish NuGets to Nuget.org
2632
enable-email-notifications: true # Enable email notifications on failure
2733
secrets:
2834
NUGET_UPLOAD_TOKEN: ${{ secrets.EVERGINE_NUGETORG_TOKEN }}

.github/workflows/CI.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,28 @@ name: CI
77

88
on:
99
workflow_dispatch:
10+
inputs:
11+
publish-artifacts:
12+
description: 'Publish artifacts'
13+
required: false
14+
type: boolean
15+
default: false
1016
push:
1117
branches: [ "master" ]
1218
pull_request:
1319
branches: [ "master" ]
1420

1521
jobs:
1622
ci:
17-
uses: EvergineTeam/evergine-standards/.github/workflows/binding-common-ci.yml@main
23+
uses: EvergineTeam/evergine-standards/.github/workflows/binding-common-ci.yml@v2
1824
with:
1925
generator-project: "RenderDocGen/RenderDocGen/RenderDocGen.csproj" # Path to your generator .csproj
2026
generator-name: "RenderDoc" # Name of your generator executable
2127
binding-project: "RenderDocGen/Evergine.Bindings.RenderDoc/Evergine.Bindings.RenderDoc.csproj" # Path to your binding .csproj
2228
target-framework: "net8.0" # Target framework for generator/binding
2329
runtime-identifier: "win-x64" # Runtime identifier (win-x64, linux-x64, etc.)
2430
build-configuration: "Release" # Build configuration (Release, Debug, etc.)
25-
nuget-artifacts: false # Upload NuGets as workflow artifacts
31+
nuget-artifacts: ${{ inputs.publish-artifacts || false }} # Upload NuGets as workflow artifacts
2632
revision: ${{ github.run_number }} # Revision for date-based version (bindings style). Use with bindings.
2733

2834
# Tips:

.github/workflows/sync-standards.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
required: false
1414
ref:
1515
description: "Branch/tag/commit of standards"
16-
default: "main"
16+
default: "v2"
1717
required: false
1818
target_branch:
1919
description: "Target branch to apply changes"
@@ -37,15 +37,15 @@ on:
3737
required: false
3838

3939
schedule:
40-
- cron: "0 2 1 * *" # 02:00 UTC on the 1st of every month
40+
- cron: "0 1 1 * *" # 01:00 UTC on the 1st of every month
4141

4242
jobs:
4343
sync:
4444
if: github.event_name != 'schedule' || github.ref == 'refs/heads/master'
4545
permissions:
4646
contents: write # allow push commits
4747
pull-requests: write
48-
uses: EvergineTeam/evergine-standards/.github/workflows/_sync-standards-reusable.yml@main
48+
uses: EvergineTeam/evergine-standards/.github/workflows/_sync-standards-reusable.yml@v2
4949
with:
5050
org: ${{ github.event.inputs.org || 'EvergineTeam' }}
5151
repo: ${{ github.event.inputs.repo || 'evergine-standards' }}

RenderDocGen/RenderDocGen/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ static void Main(string[] args)
3131
}
3232
else
3333
{
34-
string outputPath = "..\\..\\..\\..\\..\\Evergine.Bindings.RenderDoc\\Generated";
34+
string outputPath = Path.Combine(
35+
"..", "..", "..", "..", "..",
36+
"Evergine.Bindings.RenderDoc", "Generated");
3537
CsCodeGenerator.Instance.Generate(compilation, outputPath);
3638
}
3739
}

build/scripts/Generate-Bindings-DotNet.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,14 @@ $buildPath = Get-BuildOutputPath $generatorDir $BuildConfiguration $TargetFramew
117117

118118
Push-Location $buildPath
119119
try {
120-
& ".\publish\$projectName.exe"
120+
# Detect platform and set executable path
121+
if ($IsWindows) {
122+
$exePath = ".\publish\$projectName.exe"
123+
}
124+
else {
125+
$exePath = "./publish/$projectName"
126+
}
127+
& $exePath
121128
if ($LASTEXITCODE -eq 0) {
122129
LogDebug "END $GeneratorName binding generator process"
123130
}

build/scripts/Generate-NuGets-DotNet.ps1

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99
Direct version string to use for packages (used by add-ons)
1010
.PARAMETER Revision
1111
Revision number to append to date-based version (used by bindings)
12+
.PARAMETER VersionSuffix
13+
Optional suffix to append to the final version (e.g., "nightly" for "2025.11.3.123-nightly")
1214
.PARAMETER Projects
1315
Array of .csproj paths to pack. For single project, can be a string.
16+
.PARAMETER DependencyProjects
17+
Array of .csproj paths that need to be built first (dependencies) but won't generate NuGet packages.
1418
.PARAMETER OutputFolderBase
1519
Base folder for NuGet package output
1620
.PARAMETER BuildVerbosity
@@ -35,14 +39,25 @@
3539
.EXAMPLE
3640
# Using legacy symbol format
3741
.\Generate-NuGets-DotNet.ps1 -Version "1.0.0" -Projects "test.csproj" -SymbolsFormat "symbols.nupkg"
42+
.EXAMPLE
43+
# Using version suffix for nightly builds
44+
.\Generate-NuGets-DotNet.ps1 -Revision 123 -Projects "test.csproj" -VersionSuffix "nightly"
45+
.EXAMPLE
46+
# Using version suffix with direct version
47+
.\Generate-NuGets-DotNet.ps1 -Version "2025.1.0.0-alpha" -Projects "test.csproj" -VersionSuffix "nightly"
48+
.EXAMPLE
49+
# Building dependency projects but only packing main projects
50+
.\Generate-NuGets-DotNet.ps1 -Revision 123 -Projects "Main.csproj" -DependencyProjects "Dependency1.csproj","Dependency2.csproj"
3851
.LINK
3952
https://evergine.com/
4053
#>
4154

4255
param (
4356
[string]$Version,
4457
[string]$Revision,
58+
[string]$VersionSuffix,
4559
[Parameter(Mandatory = $true)]$Projects,
60+
$DependencyProjects = @(),
4661
[string]$OutputFolderBase = "nupkgs",
4762
[string]$BuildVerbosity = "normal",
4863
[string]$BuildConfiguration = "Release",
@@ -61,14 +76,6 @@ else {
6176
}
6277

6378
# Parameter validation
64-
if ([string]::IsNullOrEmpty($Version) -and [string]::IsNullOrEmpty($Revision)) {
65-
throw "Either -Version or -Revision parameter must be provided"
66-
}
67-
68-
if (![string]::IsNullOrEmpty($Version) -and ![string]::IsNullOrEmpty($Revision)) {
69-
throw "Cannot specify both -Version and -Revision parameters"
70-
}
71-
7279
if ($Projects -eq $null -or $Projects.Count -eq 0 -or ($Projects -is [array] -and $Projects.Length -eq 0)) {
7380
throw "Projects parameter cannot be empty"
7481
}
@@ -78,21 +85,23 @@ if ($Projects -is [string]) {
7885
$Projects = @($Projects)
7986
}
8087

81-
# Calculate version
82-
if (![string]::IsNullOrEmpty($Revision)) {
83-
$Version = "$(Get-Date -Format "yyyy.M.d").$Revision"
88+
# Convert DependencyProjects to array if it's a single string or null
89+
if ($null -eq $DependencyProjects) {
90+
$DependencyProjects = @()
8491
}
85-
86-
# Validate version format (NuGet semantic versioning)
87-
# See: https://docs.microsoft.com/en-us/nuget/concepts/package-versioning
88-
if ($Version -notmatch '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?(?:-([a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?)(?:\.([a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?))*)?$') {
89-
throw "Invalid version format: '$Version'. NuGet version must follow semantic versioning (e.g., '1.0.0', '1.0.0-alpha', '1.0.0.123')."
92+
elseif ($DependencyProjects -is [string]) {
93+
$DependencyProjects = @($DependencyProjects)
9094
}
9195

96+
# Resolve version from parameters (including suffix)
97+
$Version = Resolve-Version -version $Version -revision $Revision -versionSuffix $VersionSuffix
98+
9299
# Show variables
93100
$parameters = @{
94101
"Version" = $Version
102+
"VersionSuffix" = if ([string]::IsNullOrWhiteSpace($VersionSuffix)) { "(none)" } else { $VersionSuffix }
95103
"Projects" = ($Projects -join ", ")
104+
"DependencyProjects" = if ($DependencyProjects.Count -eq 0) { "(none)" } else { ($DependencyProjects -join ", ") }
96105
"BuildConfiguration" = $BuildConfiguration
97106
"BuildVerbosity" = $BuildVerbosity
98107
"OutputFolderBase" = $OutputFolderBase
@@ -105,6 +114,24 @@ ShowVariables $parameters
105114
# Create output folder
106115
$absoluteOutputFolder = CreateOutputFolder $OutputFolderBase
107116

117+
# Build all projects (dependencies + main projects) first to resolve dependencies automatically
118+
$allProjectsToBuild = $DependencyProjects + $Projects
119+
LogDebug "START building all projects to resolve dependencies"
120+
foreach ($projectPath in $allProjectsToBuild) {
121+
LogDebug "Building project: $projectPath"
122+
123+
if (!(Test-Path $projectPath)) {
124+
throw "Project file not found: $projectPath"
125+
}
126+
127+
& dotnet build $projectPath --verbosity $BuildVerbosity --configuration $BuildConfiguration
128+
129+
if ($LASTEXITCODE -ne 0) {
130+
throw "dotnet build failed for $projectPath"
131+
}
132+
}
133+
LogDebug "END building all projects"
134+
108135
# Generate packages
109136
LogDebug "START packaging process"
110137

build/scripts/Helpers.ps1

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,57 @@ function ShowVariablesLegacy($version, $buildConfiguration, $buildVerbosity, $ou
4747
LogDebug "Build verbosity.....: $buildVerbosity"
4848
LogDebug "Output folder.......: $outputFolderBase"
4949
LogDebug "#######################################"
50+
}
51+
52+
# Calculate version from revision using date-based format
53+
function Get-VersionFromRevision($revision) {
54+
if ([string]::IsNullOrWhiteSpace($revision)) {
55+
throw "Revision parameter cannot be null or empty"
56+
}
57+
return "$(Get-Date -Format "yyyy.M.d").$revision"
58+
}
59+
60+
# Validate version format using NuGet semantic versioning rules
61+
function Test-VersionFormat($version) {
62+
if ([string]::IsNullOrWhiteSpace($version)) {
63+
return $false
64+
}
65+
# NuGet semantic versioning pattern
66+
# See: https://docs.microsoft.com/en-us/nuget/concepts/package-versioning
67+
return $version -match '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?(?:-([a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?)(?:\.([a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?))*)?$'
68+
}
69+
70+
# Resolve version from Version, Revision, and optional VersionSuffix parameters
71+
function Resolve-Version($version, $revision, $versionSuffix = "") {
72+
# Validate parameters
73+
if ([string]::IsNullOrEmpty($version) -and [string]::IsNullOrEmpty($revision)) {
74+
throw "Either Version or Revision parameter must be provided"
75+
}
76+
77+
if (![string]::IsNullOrEmpty($version) -and ![string]::IsNullOrEmpty($revision)) {
78+
throw "Cannot specify both Version and Revision parameters"
79+
}
80+
81+
# Calculate version if revision is provided
82+
if (![string]::IsNullOrEmpty($revision)) {
83+
$resolvedVersion = Get-VersionFromRevision $revision
84+
}
85+
else {
86+
$resolvedVersion = $version
87+
}
88+
89+
# Validate version format (before applying suffix)
90+
if (-not (Test-VersionFormat $resolvedVersion)) {
91+
throw "Invalid version format: '$resolvedVersion'. Version must follow semantic versioning (e.g., '1.0.0', '1.0.0-alpha', '1.0.0.123')."
92+
}
93+
94+
# Apply version suffix if provided
95+
if (-not [string]::IsNullOrWhiteSpace($versionSuffix)) {
96+
# Remove leading dash from suffix if present to avoid double dashes
97+
$cleanSuffix = $versionSuffix.TrimStart('-')
98+
# Always append with dash separator for clean, consistent versioning
99+
$resolvedVersion = "$resolvedVersion-$cleanSuffix"
100+
}
101+
102+
return $resolvedVersion
50103
}

0 commit comments

Comments
 (0)