Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
204 commits
Select commit Hold shift + click to select a range
5ad8994
Start of feature/openxr-multiplatform-generation
Exanite Oct 14, 2026
73261a3
Replace SkipScrapeIf with ScrapeIf to avoid double negative
Exanite Oct 15, 2026
a94742b
Add CacheKey option to ClangScraper config
Exanite Oct 15, 2026
ae23162
Move ScrapeIf to top of Microsoft job ClangScraper config
Exanite Oct 15, 2026
7d780f6
Lock each job's ClangScraper to Windows to ensure generation consistency
Exanite Oct 15, 2026
4dda833
Sort documents before adding to project to ensure consistent ordering…
Exanite Oct 15, 2026
cdfc838
Initial attempt at multi-platform RSPs
Exanite Oct 15, 2026
4aff5db
Fix Vulkan includes
Exanite Oct 15, 2026
20b6274
Get OpenXR scraping working on Linux
Exanite Oct 15, 2026
deb3a22
Get OpenXR scraping working on Windows
Exanite Oct 15, 2026
ed16348
Fix incorrect Silk.NET.SilkTouch.Jobs path
Exanite Oct 15, 2026
6a9f5e1
Begin working on Bindings Regeneration workflow
Exanite Oct 15, 2026
6d84a0a
Initialize submodules in workflow
Exanite Oct 15, 2026
3c3a9f6
Ensure correct exit code if scraping fails
Exanite Oct 15, 2026
2ca13b1
Try to install PowerShell
Exanite Oct 15, 2026
15ad64d
Add additional error logging
Exanite Oct 15, 2026
a54f909
Try Console.WriteLine instead?
Exanite Oct 15, 2026
4b4a072
Also use a specific number as the exit code (temporary)
Exanite Oct 15, 2026
38bc989
Add more logging
Exanite Oct 15, 2026
af1a27e
Also run on Linux and Mac to see if I get different errors
Exanite Oct 15, 2026
da55c5d
Change the exit code back to 1
Exanite Oct 15, 2026
477aaa5
Ensure scrape step exits with code 0
Exanite Oct 15, 2026
2838786
Upload the .silktouch cache as an artifact
Exanite Oct 15, 2026
bc3dea6
Set include-hidden-files: true since .silktouch is considered hidden
Exanite Oct 15, 2026
c7be4c5
Add Mac OpenXR cache
Exanite Oct 15, 2026
88b9d1d
Csharpier format
Exanite Oct 15, 2026
294b861
Edit doc comment
Exanite Oct 15, 2026
8e1eb35
Cleanup
Exanite Oct 16, 2026
97f97dc
Remove unused field
Exanite Oct 16, 2026
e6c334f
Use discard var for unused return
Exanite Oct 16, 2026
3493379
Edit docs and rename the BakeSourceSets.Rewriter.Visit methods to Report
Exanite Oct 16, 2026
476db3e
Remove unnecessary null check (impossible for SourceSet to be null at…
Exanite Oct 16, 2026
c704306
Work on documenting BakeSourceSets
Exanite Oct 16, 2026
5a0c27c
Move non-null assertion to where the value comes from for clarity/cor…
Exanite Oct 16, 2026
4ae3129
Remove null is returned comments since null is actually not returned
Exanite Oct 16, 2026
5972734
Begin rewriting BakeSourceSets to fully create the BakeSets before me…
Exanite Oct 16, 2026
d27fdf0
Add IBakeStrategy.Cleanup
Exanite Oct 16, 2026
a0d1369
Replace BakeMember with Merge
Exanite Oct 16, 2026
1136063
Remove used of Humanizer in DefaultBakeStrategy
Exanite Oct 16, 2026
e9e433a
Temporarily output the bakesets extracted by BakeSourceSets.Visitor
Exanite Oct 16, 2026
e7978b9
Add initial Bake method
Exanite Oct 16, 2026
64dc107
Add docs about intended usage of IBakeStrategy methods
Exanite Oct 16, 2026
db684c0
Identify which sets need to be merged
Exanite Oct 16, 2026
0297c2f
Attempt to implement bakeset merging
Exanite Oct 17, 2026
f94dcdc
Fix duplicate members
Exanite Oct 17, 2026
9fc1fa9
Update error message to refer to the correct profile
Exanite Oct 17, 2026
edc20f2
Always attempt to merge regardless if there is an existing member
Exanite Oct 17, 2026
5968732
Fix non-deterministic iteration
Exanite Oct 17, 2026
970fc06
Rename variables and add todo comments
Exanite Oct 17, 2026
d072ac8
Fix issue we read the members from the node we just cleared and renam…
Exanite Oct 17, 2026
50086d6
Ignore static fields when checking for struct field ABI
Exanite Oct 17, 2026
256b7f4
Regenerate OpenXR bindings on Linux and rename xr source set to OpenX…
Exanite Oct 17, 2026
4d70f19
Rename output source set back to "xr"
Exanite Oct 17, 2026
42aa308
Regenerate OpenXR on Linux for source set rename
Exanite Oct 17, 2026
ed05cb8
Rename rest of variables for consistency with existing/incoming namin…
Exanite Oct 17, 2026
b57111f
Fix incorrect Concat with self
Exanite Oct 17, 2026
32826aa
Check ClassOrStructKeyword instead of Modifiers for if a record is a …
Exanite Oct 17, 2026
7a91a24
Fix incorrect base list concat
Exanite Oct 17, 2026
9cd0041
Fix possible missing namespace for top level delegate types
Exanite Oct 17, 2026
1d2020a
Add GetTypeDiscrim to reduce code dupe between the BaseType/Delegate …
Exanite Oct 18, 2026
97e4ebe
Fix missing AddApiProfiles attributes
Exanite Oct 18, 2026
fae234b
Add combine caches step
Exanite Oct 18, 2026
191a2f6
Remove setup powershell step (not needed for public runners)
Exanite Oct 18, 2026
e648e44
Regenerate OpenGL on Linux
Exanite Oct 18, 2026
61dc083
Add setup dependencies step
Exanite Oct 18, 2026
75651b6
Also install libgl-dev
Exanite Oct 18, 2026
17ebdf4
Add dependencies corresponding to the other headers required by OpenXR
Exanite Oct 18, 2026
5503649
Change artifact naming convention
Exanite Oct 18, 2026
a7d439b
Add concurrency restriction for bindings-regeneration
Exanite Oct 18, 2026
a553b4a
Add regenerate bindings step
Exanite Oct 18, 2026
624d05a
Fix typo in git status command
Exanite Oct 18, 2026
744f236
Fix ClangScraper not failing when scrape is skipped with no fallback …
Exanite Oct 18, 2026
597f33d
Add IModContext.ContinueGeneration to allow mods to early exit the job
Exanite Oct 18, 2026
38cc621
Work on implementing use/generate cache only runs for ClangScraper
Exanite Oct 18, 2026
320ff0e
Add ClangScraper.ReadBindingsCacheAsync
Exanite Oct 18, 2026
4a2aeb9
Implement ClangScraper support for GenerateCacheOnly runs
Exanite Oct 18, 2026
ee9f73c
Update bindings-regeneration workflow to use --use/generate-cache-onl…
Exanite Oct 18, 2026
3666e6c
Set OpenXR Mac ClangScraper to exit after generation on GenerateCache…
Exanite Oct 18, 2026
7c44fba
Fix missing doc comment error
Exanite Oct 18, 2026
bd61b23
Separate IModContext disposal from bindings output
Exanite Oct 18, 2026
d91307e
Also init submodules for regenerate bindings step since OpenXR still …
Exanite Oct 18, 2026
6322122
Don't commit if no bindings changes
Exanite Oct 18, 2026
3a83499
Remove "I/O not available" error and change WorkingDirectory to be no…
Exanite Oct 18, 2026
8cc7459
Fix compile error
Exanite Oct 18, 2026
6e1fa4c
Add BakeSourceSetsTests.MergeEquivalent
Exanite Oct 25, 2026
fe24d21
Update snapshots to include the doc file path if set
Exanite Oct 25, 2026
bae0add
Add BakeSourceSetsTests.ThrowForStructMismatch
Exanite Oct 25, 2026
4d540a2
Also test for base type handling
Exanite Oct 25, 2026
c788afb
Rework BakeSourceSets to handle (null, non-null) and (non-null, null)…
Exanite Oct 25, 2026
b4b895a
Attempt to validate fields (fail because parent is null)
Exanite Oct 25, 2026
92d934d
Also provide the parent of the merged members since modifying a node …
Exanite Oct 25, 2026
008f795
Fix struct field not being validated
Exanite Oct 25, 2026
2053898
Add BakeSourceSetsTests.ThrowForStructMismatch3
Exanite Oct 25, 2026
9c16fb5
CSharpier format
Exanite Oct 25, 2026
8f4023c
Scope field validation back to only structs
Exanite Oct 25, 2026
0ff7217
Fix incorrect value for GL_ACTIVE_PROGRAM_EXT
Exanite Oct 25, 2026
9fc2d0b
Remove unused property in AddVTables
Exanite Oct 25, 2026
4ada02a
Change SourceProject to be non-nullable
Exanite Oct 25, 2026
ce1c19b
Remove duplicate GetCommittedFileAsync call and add await using to th…
Exanite Oct 25, 2026
f5f8a97
Remove need to new() trivial configs by making the config param nullable
Exanite Oct 25, 2026
c793812
Require field types and initializers to always exactly match
Exanite Oct 26, 2026
46fa873
Commit the OpenGL cache on Linux (didn't want to switch devices)
Exanite Oct 26, 2026
dfae366
Create builds.json
Exanite Oct 26, 2026
9e881fb
Move native workflow sh scripts to new workflows folder
Exanite Oct 26, 2026
a0d0c6b
Add workflows/bindings folder and work on matrix generation
Exanite Oct 26, 2026
ac34ac2
Implement workflow-matrix script
Exanite Oct 26, 2026
eae1833
Attempt to implement matrix dispatch in workflow
Exanite Oct 26, 2026
03b600f
Probably should checkout the repo
Exanite Oct 26, 2026
499806c
Fix incorrect path
Exanite Oct 26, 2026
0e2825c
Use Write-Output instead
Exanite Oct 26, 2026
9c1421a
Use matrix.include instead
Exanite Oct 26, 2026
a708832
Update checkout action version
Exanite Oct 26, 2026
9f94db5
Add regenerateMatrix
Exanite Oct 26, 2026
b0453eb
Use regenerateMatrix in bindings regen workflow
Exanite Oct 26, 2026
57d0928
Add push step
Exanite Oct 26, 2026
bcbe360
Use actions checkout v7 (Rider lied)
Exanite Oct 26, 2026
10a31e1
Pull before push
Exanite Oct 26, 2026
a6d31b0
Update .silktouch cache for 10a31e1405fc94e024a8c2156fbbc3f95377d209
dotnet-bot Oct 26, 2026
cd27f0c
Dedupe inputs passed to workflow-matrix.ps1
Exanite Oct 26, 2026
c920c1c
Work on comment trigger
Exanite Oct 26, 2026
0f6a22a
Go back to workflow dispatch for now since I have to merge to test th…
Exanite Oct 26, 2026
34e387e
Format native.yml
Exanite Oct 26, 2026
d1587da
Use matrix.include instead of flat
Exanite Oct 26, 2026
1f5408b
Add job existence check
Exanite Oct 26, 2026
57d4cac
Remove old native workflow scripts
Exanite Oct 26, 2026
0a95d9a
Add new workflow-parse for native workflow
Exanite Oct 26, 2026
867b311
Prefer env vars instead of cli args
Exanite Oct 26, 2026
03e9215
Move all inputs to the top for clarity
Exanite Oct 26, 2026
6757c80
Update checkout actions in native.yml
Exanite Oct 26, 2026
a59491b
Remove native config env from native.yml
Exanite Oct 27, 2026
31493a6
Rename prerequisites job to dispatch
Exanite Oct 27, 2026
4505aa3
Update dispatch job names
Exanite Oct 27, 2026
9ca8cc7
Add new workflow-matrix.ps1 for native workflow
Exanite Oct 27, 2026
50b25e1
Update native.yml workflow to work with new ps1 scripts
Exanite Oct 27, 2026
1d085bd
Resolve job names to their canonical names
Exanite Oct 27, 2026
20c141b
Fix a few issues
Exanite Oct 27, 2026
666ef7c
Use a header instead for the PR comment
Exanite Oct 27, 2026
d437258
Update action versions
Exanite Oct 27, 2026
acae0e5
Restore the conditional comment behavior in native.yml
Exanite Oct 27, 2026
7d1cc1e
Title case the heading
Exanite Oct 27, 2026
680b487
Update .silktouch cache for 7d1cc1ec04146f234403979e3ef0651084736a28
dotnet-bot Oct 27, 2026
2893790
Add todos
Exanite Oct 27, 2026
cc0b6fe
Check if any matrix jobs are requested and skip if none
Exanite Oct 27, 2026
c487302
Update GuillaumeFalourd/setup-windows10-sdk-action
Exanite Oct 27, 2026
60bc9ae
Fix typo and accidental overwrite of mustComment variable
Exanite Oct 27, 2026
5369db7
Update BakeSourceSets section in generator mods docs
Exanite Oct 28, 2026
a40ba39
Add build definitions for all bindings regeneration jobs
Exanite Oct 28, 2026
678a4ce
Add all jobs to hardcoded bindings regeneration command
Exanite Oct 28, 2026
e9d4b6a
Update .silktouch cache for 678a4ce145a0bad592a879eebb842e0cc1ce75da
dotnet-bot Oct 28, 2026
cd83ade
Regenerate SDL bindings for 678a4ce145a0bad592a879eebb842e0cc1ce75da
dotnet-bot Oct 28, 2026
6d63f81
Rename entrypoint header files for simplicity/clarity
Exanite Oct 28, 2026
d3eebc4
Disable OpenXR DirectX integration for now
Exanite Oct 28, 2026
143b869
Rename bindings output folders for consistency
Exanite Oct 28, 2026
0006098
Update .silktouch cache for 143b86996ad66cbfd48ffc562f692a791c23b902
dotnet-bot Oct 28, 2026
d53ad38
Regenerate OpenCL bindings for 143b86996ad66cbfd48ffc562f692a791c23b902
dotnet-bot Oct 28, 2026
4b99032
Regenerate SDL bindings for 143b86996ad66cbfd48ffc562f692a791c23b902
dotnet-bot Oct 28, 2026
a6883bc
Regenerate Vulkan bindings for 143b86996ad66cbfd48ffc562f692a791c23b902
dotnet-bot Oct 28, 2026
9b07fc2
Ensure cache archives are deterministic
Exanite Oct 28, 2026
679d697
Update .silktouch cache for 9b07fc2f2fe561ac47308f315d381a810703bd9a
dotnet-bot Oct 28, 2026
2e1b9ff
Move OpenXR Windows disable to be in Jobs.OpenXR.cs instead
Exanite Oct 28, 2026
8275aae
Add remaps for Vulkan types in OpenXR bindings and add Vulkan as comp…
Exanite Oct 28, 2026
08e1417
Change the disable to be in the openxr-windows header instead
Exanite Oct 28, 2026
04148b4
Update .silktouch cache for 08e141742f25fb149ba5b453db5383d77ab488e4
dotnet-bot Oct 28, 2026
450ca5d
Regenerate OpenXR bindings for 08e141742f25fb149ba5b453db5383d77ab488e4
dotnet-bot Oct 28, 2026
0918c1a
Use lowercase sdl3 for rsps for consistency
Exanite Oct 28, 2026
20be81d
Limit regeneration to SDL for now
Exanite Oct 28, 2026
98069b7
Remove unnecessary null check
Exanite Oct 28, 2026
54520f2
Revert MSBuildModContext project handling changes for testing
Exanite Oct 28, 2026
3c65e6f
Update .silktouch cache for 54520f2800ee666c71274974d7208b27c1897f22
dotnet-bot Oct 28, 2026
4ca4c23
Regenerate SDL bindings for 54520f2800ee666c71274974d7208b27c1897f22
dotnet-bot Oct 28, 2026
93ace4b
Revert "Revert MSBuildModContext project handling changes for testing"
Exanite Oct 28, 2026
ef12aa4
Try fixing SDL test project bug
Exanite Oct 28, 2026
f4001a4
Revert "Try fixing SDL test project bug"
Exanite Oct 28, 2026
85d6b81
Set modifiedSolution to originalSolution instead for consistency
Exanite Oct 28, 2026
21dc51d
Add sanity check
Exanite Oct 28, 2026
cc0a4c9
Temporary: Disable everything after TransformEnums for SDL
Exanite Oct 28, 2026
788fc0d
Fix commit error when no cache was modified
Exanite Oct 28, 2026
db47978
Revert "Temporary: Disable everything after TransformEnums for SDL"
Exanite Oct 28, 2026
137bed0
Dump test project doc states
Exanite Oct 28, 2026
4d28a14
Temporary: Add more logs
Exanite Oct 28, 2026
c2091e1
Revert "Temporary: Add more logs"
Exanite Oct 28, 2026
b49e17e
Temporary: Add more logs
Exanite Oct 28, 2026
ec92c3e
Remove old logs and add new logs
Exanite Oct 28, 2026
99dae6f
Add dotnet restore step to workflow
Exanite Oct 28, 2026
f2b9de3
Also add dotnet workload restore
Exanite Oct 28, 2026
98979f3
Regenerate SDL bindings for f2b9de3587193bf8ee3330b1e17c23330b87e6e0
dotnet-bot Oct 28, 2026
e1b7ecd
Remove logs added to fix SDL test generation issue
Exanite Oct 28, 2026
9191d8c
Revert "Rename bindings output folders for consistency"
Exanite Oct 28, 2026
0cf21c1
Update .silktouch cache for 9191d8c6fc56e38ae0e70049d7a6cbf4531ce41f
dotnet-bot Oct 28, 2026
6624e21
Regenerate SDL bindings for 9191d8c6fc56e38ae0e70049d7a6cbf4531ce41f
dotnet-bot Oct 28, 2026
f970a6d
Re-enable generation of all bindings
Exanite Oct 28, 2026
7ba5b19
Update .silktouch cache for f970a6dea5f6f39ac63d6a71d1047adf79a07f4d
dotnet-bot Oct 28, 2026
6f329bd
Regenerate OpenCL bindings for f970a6dea5f6f39ac63d6a71d1047adf79a07f4d
dotnet-bot Oct 28, 2026
ce96bac
Regenerate Vulkan bindings for f970a6dea5f6f39ac63d6a71d1047adf79a07f4d
dotnet-bot Oct 28, 2026
57872a9
Map Vulkan types used in OpenXR to their primitives
Exanite Oct 28, 2026
8a0e24b
Temporary: Rename xr folder to OpenXR to avoid diff noise
Exanite Oct 28, 2026
f10177d
Re-enable OpenXR bindings scraping on Windows
Exanite Oct 28, 2026
4cfd356
Update .silktouch cache for f10177d93e80fcb4d7cf7ed2772a00bf9a24737f
dotnet-bot Oct 28, 2026
a18d466
Regenerate OpenXR bindings for f10177d93e80fcb4d7cf7ed2772a00bf9a24737f
dotnet-bot Oct 28, 2026
d52ecdc
Add type mappings for OpenXR Windows types
Exanite Oct 28, 2026
d2791b3
Update .silktouch cache for d52ecdcde64aed5f47844f09a722f079ffe7ccd3
dotnet-bot Oct 28, 2026
a826728
Regenerate OpenXR bindings for d52ecdcde64aed5f47844f09a722f079ffe7ccd3
dotnet-bot Oct 28, 2026
8697a72
Add comment on what the timestamp used by cache file entries means
Exanite Oct 28, 2026
6213412
Remove commit message handling from bindings-regeneration commit message
Exanite Oct 28, 2026
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
326 changes: 326 additions & 0 deletions .github/workflows/bindings-regeneration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,326 @@
name: Bindings Regeneration

on:
workflow_dispatch:
# issue_comment:
# types:
# - created

permissions:
contents: read

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: false

jobs:
dispatch:
name: Dispatch selected jobs
runs-on: ubuntu-latest

# if: github.event.issue.pull_request && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)

steps:

- name: Checkout Repo
uses: actions/checkout@v7
with:
submodules: false

- name: Parse comment as command
id: command
shell: pwsh
working-directory: eng/workflows/bindings
env:
# COMMENT_BODY: ${{ github.event.comment.body }}
COMMENT_BODY: "/bindings OpenAL OpenCL OpenGL OpenXR SDL Vulkan"
run: ./workflow-parse.ps1 >> $env:GITHUB_OUTPUT

- name: Generate matrix
id: matrix
shell: pwsh
working-directory: eng/workflows/bindings
env:
CHOSEN_JOBS: ${{ steps.command.outputs.jobs }}
run: ./workflow-matrix.ps1 >> $env:GITHUB_OUTPUT

outputs:
scrapeMatrix: ${{ steps.matrix.outputs.scrapeMatrix }}
regenerateMatrix: ${{ steps.matrix.outputs.regenerateMatrix }}

scrape:
name: Scrape ${{ matrix.job }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

if: join(fromJSON(needs.dispatch.outputs.scrapeMatrix), ',') != ''
needs: [dispatch]

strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.dispatch.outputs.scrapeMatrix) }}

steps:

# Currently deciding to install all dependencies for all bindings for simplicity
# Reason is that dependencies here are relatively light, unlike for native builds
- name: Setup dependencies
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true
Set-StrictMode -Version Latest

switch ($true) {
$IsWindows {}
$IsLinux {
sudo apt-get update

# Added for OpenXR
sudo apt-get install -y libx11-dev libgl-dev libglx-dev libxcb1-dev libxcb-glx0-dev libegl-dev
}
$IsMacOS {}
}

- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: "10.0.401"

- name: Setup Windows SDK
if: "runner.os == 'Windows'"
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2.5
with:
sdk-version: 22621

- name: Checkout Repo
uses: actions/checkout@v7
with:
submodules: false

- name: Initialize submodules
shell: pwsh
env:
SUBMODULES: ${{ toJSON(matrix.submodules) }}
run: |
$submodules = $env:SUBMODULES | ConvertFrom-Json
git submodule update --init --recursive --depth 0 $submodules

- name: Clear .silktouch folder contents
shell: pwsh
run: Remove-Item -Path .silktouch -Recurse -Force

- name: .NET workload restore
shell: pwsh
run: dotnet workload restore

- name: .NET restore
shell: pwsh
run: dotnet restore

- name: Populate caches
shell: pwsh
env:
JOB: ${{ matrix.job }}
run: dotnet run --project sources/SilkTouch/Jobs/Silk.NET.SilkTouch.Jobs.csproj -c Release -- --generate-cache-only --only $env:JOB

- name: Show .silktouch folder contents
shell: pwsh
run: Get-ChildItem .silktouch

- name: Upload cache as artifact
uses: actions/upload-artifact@v7
with:
name: silktouch-cache-${{ matrix.job }}-${{ matrix.os }}
path: .silktouch
include-hidden-files: true

combine:
name: Combine caches
runs-on: ubuntu-24.04

if: always()
needs: [scrape]

steps:

- name: Download cache
uses: actions/download-artifact@v8
with:
path: .silktouch
pattern: silktouch-cache-*
merge-multiple: true

- name: Show .silktouch folder contents
shell: pwsh
run: Get-ChildItem .silktouch

- name: Upload cache
uses: actions/upload-artifact@v7
with:
name: silktouch-combined-cache
path: .silktouch
include-hidden-files: true

regenerate:
name: Regenerate ${{ matrix.job }}
runs-on: ubuntu-24.04

if: join(fromJSON(needs.dispatch.outputs.regenerateMatrix), ',') != ''
needs: [dispatch, combine]

strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.dispatch.outputs.regenerateMatrix) }}

steps:

- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: "10.0.401"

- name: Checkout Repo
uses: actions/checkout@v7
with:
submodules: false

- name: Initialize submodules
shell: pwsh
env:
SUBMODULES: ${{ toJSON(matrix.submodules) }}
run: |
$submodules = $env:SUBMODULES | ConvertFrom-Json
git submodule update --init --recursive --depth 0 $submodules

- name: Download cache
uses: actions/download-artifact@v8
with:
path: .silktouch
pattern: silktouch-combined-cache

- name: Show .silktouch folder contents
shell: pwsh
run: Get-ChildItem .silktouch

- name: Show git status
shell: pwsh
run: git status

- name: .NET workload restore
shell: pwsh
run: dotnet workload restore

- name: .NET restore
shell: pwsh
run: dotnet restore

- name: Regenerate bindings
shell: pwsh
env:
JOB: ${{ matrix.job }}
run: dotnet run --project sources/SilkTouch/Jobs/Silk.NET.SilkTouch.Jobs.csproj -c Release -- --use-cache-only --only $env:JOB

- name: Show git status
shell: pwsh
run: git status

- name: Create bindings patch
id: patch
shell: pwsh
env:
JOB: ${{ matrix.job }}
run: |
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true
Set-StrictMode -Version Latest

# Create patch, excluding cache
git add -A
git diff --cached --binary -- . ":(exclude).silktouch" > "bindings-$env:JOB.patch"

if ((Get-Item "bindings-$env:JOB.patch").Length -eq 0) {
Write-Host "Bindings already up to date"
"changed=false" >> $env:GITHUB_OUTPUT
exit 0
}

"changed=true" >> $env:GITHUB_OUTPUT

- name: Upload bindings patch
if: steps.patch.outputs.changed == 'true'
uses: actions/upload-artifact@v7
with:
name: bindings-patch-${{ matrix.job }}
path: bindings-${{ matrix.job }}.patch

push:
name: Commit and push
runs-on: ubuntu-latest

needs: [regenerate]

permissions:
contents: write

steps:

- name: Checkout Repo
uses: actions/checkout@v7
with:
submodules: false
fetch-depth: 0

- name: Download cache
uses: actions/download-artifact@v8
with:
path: .silktouch
pattern: silktouch-combined-cache

- name: Download bindings patches
uses: actions/download-artifact@v8
with:
path: patches
pattern: bindings-patch-*
merge-multiple: true

- name: Commit and push
shell: pwsh
env:
SOURCE_SHA: ${{ github.sha }}
TARGET_BRANCH: ${{ github.ref_name }}
run: |
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true
Set-StrictMode -Version Latest

$sourceContext = $env:SOURCE_SHA

git config --local user.email "9011267+dotnet-bot@users.noreply.github.com"
git config --local user.name "The Silk.NET Automaton"

# Cache
git add .silktouch
if (git status --porcelain --untracked-files=no) {
git commit -m "Update .silktouch cache for $sourceContext"
}

# Bindings, one commit per job
if (Test-Path patches) {
foreach ($patch in Get-ChildItem patches -Filter "bindings-*.patch") {
$job = $patch.BaseName.Substring("bindings-".Length)
git apply --index $patch.FullName
git commit -m "Regenerate $job bindings for $sourceContext"
}
}

git status

if ((git rev-parse HEAD) -eq $env:SOURCE_SHA) {
Write-Host "Nothing to push"
exit 0
}

git pull --rebase origin $env:TARGET_BRANCH
git push origin "HEAD:refs/heads/$env:TARGET_BRANCH"
Loading
Loading