Skip to content

Rework pipeline shader spec info #871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 373 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
373 commits
Select commit Hold shift + click to select a range
59d02fe
merge master
keptsecret May 15, 2025
507904f
minor fixes
keptsecret May 15, 2025
59fcc93
Implement all computeDependants for IAssets
May 15, 2025
542592f
soome changes to arithmetic config
keptsecret May 15, 2025
a9930a0
removed referencing workgroupID in scans
keptsecret May 15, 2025
8a2ebe3
correct strategy for boost's .gitmodules mini tool which will *not* l…
AnastaZIuk May 15, 2025
892595c
BLAS and TLAS build code reuse and unification
May 15, 2025
4b03383
nuke the old asset converter, nothing useful or not reimplemented the…
May 15, 2025
0ebdda6
proper default initializer for triangle BLAS geometry transforms
May 15, 2025
c32846f
Stream the BLAS build inputs, fix a bug and note another one that has…
May 15, 2025
bc9b5f1
make the default memcpy IUTilities buffer streaming callback public (…
May 15, 2025
ce884ca
update boost submodule
AnastaZIuk May 15, 2025
e5f610a
Resolve issues with private submodule updates, update 3rdparty/boost/…
AnastaZIuk May 15, 2025
bf93900
use fetch.parallel=0 in CMake update
AnastaZIuk May 15, 2025
55d89c5
no need to store locals in reduce
keptsecret May 16, 2025
4e4f26e
added workgroup accessor concepts, refactor accessor usage
keptsecret May 16, 2025
abcbb78
merge master, fix conflicts
keptsecret May 16, 2025
6884d45
Add non const computeDependants to IAsset and its child classes
May 16, 2025
2ac65f6
Refactor anyDependantDiscardedContents and discardDependantsContents
May 16, 2025
56f013e
Merge branch 'master' into improve-workgroup-scan-2
keptsecret May 19, 2025
bba9dab
pull master & resolve conflicts
AnastaZIuk May 19, 2025
209ecf3
correct policy setup, propagate to all 3rdparty projects; silents som…
AnastaZIuk May 19, 2025
ae27b7d
enforce some constraints, stop the double instantiation of `Triangles…
May 19, 2025
bf23ad9
Merge branch 'more_asset_converter_for_tlas' of github.com:Devsh-Grap…
May 19, 2025
292f792
update DXC pointer (to Clang fixes merge commit)
AnastaZIuk May 19, 2025
b3b2b03
post-merge updates, correct IBottomLevelAccelerationStructure::BUILD_…
AnastaZIuk May 19, 2025
6dda1e2
Add a bunch of missing `const` in demote_promote_writer_readers_lock.h
Fletterio May 19, 2025
004c95a
fixed minor bug
keptsecret May 20, 2025
b7fc736
Merge pull request #791 from Devsh-Graphics-Programming/ali_clang
AnastaZIuk May 20, 2025
a666673
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla …
AnastaZIuk May 20, 2025
9bd76f9
add docker/msvc-winsdk submodule
AnastaZIuk May 20, 2025
0abbb21
get stuff to compile again
May 20, 2025
ccacddb
store temporaries with data accessor
keptsecret May 20, 2025
d69cd60
correct the calculation of scratch memory needed, and avoid deadlock …
May 20, 2025
5c13a93
Remove impl_valid and rework SSpecializatioNValidationResult
May 20, 2025
483a788
add docker/msvc-winsdk submodule, update build presets & dxc/CMakeLis…
AnastaZIuk May 20, 2025
fe75f42
update docker/msvc-winsdk submodule, minor .env file change
AnastaZIuk May 20, 2025
6eecd13
update CMakePresets.json, add docker/ninja.env
AnastaZIuk May 20, 2025
9c59677
minor fixes
keptsecret May 21, 2025
eb44262
moved indexing functionality to config struct
keptsecret May 21, 2025
573ce44
reduction returns value instead of saving directly to storage
keptsecret May 21, 2025
487c3de
Create .github/workflows/build-nabla.yml, update CMakePresets.json fo…
AnastaZIuk May 21, 2025
473cdcd
Update build-nabla.yml, adjust CLI escape chars to pwsh
AnastaZIuk May 21, 2025
a1a7b6a
Update build-nabla.yml, add unpack packages step, correct container C…
AnastaZIuk May 21, 2025
23d18b6
Update build-nabla.yml, recurse submodules, use profiling directory
AnastaZIuk May 21, 2025
49ca655
fixes to 2-level scan indexing
keptsecret May 21, 2025
756f90d
Update build-nabla.yml, go unprotected 0x45 to avoid scans slowing do…
AnastaZIuk May 21, 2025
e2ea8d4
Update build-nabla.yml, correct install directory
AnastaZIuk May 21, 2025
66a49ab
Update build-nabla.yml, update shell for prefix setup
AnastaZIuk May 21, 2025
731f077
fix various sync bugs in AS building
May 21, 2025
1181321
make BLAS tracking actually work
May 21, 2025
a639145
fixes to 3-level scan and minor stuff
keptsecret May 22, 2025
7751359
some minor fixes
keptsecret May 22, 2025
9f43c02
Return Subgroup size to IPipelineBase
May 22, 2025
bae94c5
Fix missing bracket for getLayout
May 22, 2025
0d8fe94
Return Subgroup Size to every SShaderSpecInfo
May 22, 2025
4ed04c8
Fix stagePresence typo
May 22, 2025
7e2fd2c
Move clone_impl to private
May 22, 2025
c01392c
Implement getSpecInfoVec for ICPURayTracingPipeline
May 22, 2025
fd6f527
latest example
keptsecret May 22, 2025
9a3cc69
default AS patch constructor default values so patches merge correctly
May 22, 2025
7b3c0ed
Fix getSpecInfoVec
May 22, 2025
96db32b
Implement ICPURayTracingPIpeline valid
May 22, 2025
02c0d94
forgot to overwrite staging cache XD
May 22, 2025
98f3153
Fix ICPUSkeleton.h computeDependants
May 23, 2025
30f35af
Small fixes
May 23, 2025
2983ff0
Remove redundant final specifier
May 23, 2025
e218e77
Remove const so it can be cast to IAsset*
May 23, 2025
b58e486
Fix RenderpassIndependentPipeline
May 23, 2025
1f3a477
Fix SpirvIntrospector
May 23, 2025
5b6e20e
keep a pending TLAS build BLAS tracking set linked list
May 23, 2025
0f42726
implemented BLAS tracking for TLAS device-side copies
May 23, 2025
302710f
clean up a bit and implement BLAS tracking info for Host Copies
May 23, 2025
657d116
Merge pull request #880 from Devsh-Graphics-Programming/master
devshgraphicsprogramming May 23, 2025
5813d10
finish const correctness of Descriptor Set Layouts in Pipelines
May 23, 2025
e4487ba
small lifetime issue fix
May 23, 2025
5dab089
fix device_jit_traits generation
May 23, 2025
ad96f8a
pre merge submodule update
May 23, 2025
b7e1139
Merge pull request #878 from Devsh-Graphics-Programming/more_asset_co…
devshgraphicsprogramming May 23, 2025
d042f42
Add some utility function to IGPURayTracingPipeline SShaderGroup
May 23, 2025
c4de7c2
Fix debloat logic in logical device
May 23, 2025
f1fe089
Remove unused funciton in ILogicalDevice.cpp
May 23, 2025
89f499d
get the explicitly instantiated templated methods
May 25, 2025
27d84c8
merge master, fix conflicts
keptsecret May 26, 2025
499c10d
make asset converter work properly in absence of transfer SIntendedSu…
May 26, 2025
31e4e08
update examples_tests
May 26, 2025
0e9d932
save work
AnastaZIuk May 26, 2025
f7a7ce9
Merge branch 'nano-pipelines' of github.com:Devsh-Graphics-Programmin…
AnastaZIuk May 26, 2025
862d92f
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla …
AnastaZIuk May 26, 2025
2eea2b0
Fix layout constness on IComputePipeline
May 26, 2025
969bcb8
Fix ICPUAcclerationStructure to use computeDependantsImpl
May 26, 2025
3e96339
Fix ICPUAnimationLibrary to use computeDependantsImpl
May 26, 2025
6de189d
Remove layout constness from ICPUComputePipeline
May 26, 2025
b0fe090
Move ICPUDescriptorSet computeDependantsImpl to header
May 26, 2025
1d764ec
Remove layout constness from cpu graphics pipeline
May 26, 2025
377f25d
Remove layout constness from cpu pipeline
May 26, 2025
8809bda
Use computeDependantsImpl in cpu pipeline layout
May 26, 2025
3c0b3ba
Fix argument pack passing on IGPUPipeline
May 26, 2025
53b45ec
Remove layout constness from cpu ray tracing pipeline
May 26, 2025
e249931
Add cached parameter to SCreationParams for gpu compute pipeline
May 26, 2025
006dd7d
Remove layout constness on IPipeline
May 26, 2025
389c358
Fix IGPURayTracingPipeline construction
May 26, 2025
81df19b
Fix debloatedHitSpecData error in ILogicalDevice
May 26, 2025
2d97ce8
Fix CComputeBlit
May 26, 2025
7917918
finalize NSC image production from CMake, leave a few comments regard…
AnastaZIuk May 26, 2025
27c50d7
compression!
AnastaZIuk May 26, 2025
e3848ce
Make docker in docker build, adjust tools/nsc/CMakeLists.txt, update …
AnastaZIuk May 26, 2025
350c6a3
more util funcs in config, fix some calculations
keptsecret May 27, 2025
14e5d15
added generic data/shared mem accessors
keptsecret May 27, 2025
f07329e
fix include guard
keptsecret May 27, 2025
48a7d16
changes to arithmetic accessor concepts
keptsecret May 27, 2025
20a54be
concept macro for checking types
keptsecret May 27, 2025
d83ac5c
revert concept macro addition
keptsecret May 27, 2025
00787bf
added generic read/write accessors
keptsecret May 27, 2025
c0dfc1e
more refactor for accessor concept changes
keptsecret May 27, 2025
55840a3
don't pass scalar_t as index type
keptsecret May 27, 2025
d758ff7
refactor accessor to match accessor template
keptsecret May 27, 2025
b062ede
simplified indexing functions
keptsecret May 27, 2025
add176b
update NSC image creation to not violate Microsoft EULA, update .gith…
AnastaZIuk May 27, 2025
c6d23bd
mount named pipeline and use as docker host, update .github/workflows…
AnastaZIuk May 27, 2025
68095da
Fix error in ILogicalDevice.cpp due to removed getShaders method
May 27, 2025
98e1759
Fix all errors in CVulkanLogicalDevice
May 27, 2025
59ccb22
Add get shader count for creationParams
May 27, 2025
9bd8682
update validation of kernel version & promote to process logic
AnastaZIuk May 27, 2025
bc9befb
Move shader stage validation out of commonCreatePipelines
May 27, 2025
3f5708e
let override publish CE port & control its URL depending on NBL_DOCKE…
AnastaZIuk May 27, 2025
b81fb12
and specify network for builder, update .github/workflows/build-nabla…
AnastaZIuk May 27, 2025
fcbfa5c
add "create default network" step to actions
AnastaZIuk May 27, 2025
472aa0b
more fixes to indexing
keptsecret May 28, 2025
c483941
share level 0 scan between 2-level and 3-level scans (and reduce)
keptsecret May 28, 2025
951ff99
reduce duplicate vars in config
keptsecret May 28, 2025
1f64763
add labeling to image creation steps, update actions to upload image …
AnastaZIuk May 28, 2025
d531851
correct passing vars in shell
AnastaZIuk May 28, 2025
2074c13
post fixes to actions, use ${} to delimit var name
AnastaZIuk May 28, 2025
353c467
ahh typo!
AnastaZIuk May 28, 2025
b8d53cc
Fix vulkan ray tracing creation
May 28, 2025
f26201e
Another fix to CCOmputeBlit
May 28, 2025
b18c834
pass NSC_IMAGE_NAME with ENV as it glitches when using CMake CLI due …
AnastaZIuk May 28, 2025
7e6af24
upload NSC image to Github Container Registry on master push, create …
AnastaZIuk May 28, 2025
e5b229a
lock on push, update .github/workflows/build-nabla.yml
AnastaZIuk May 28, 2025
9328fd4
update shouldPushImage logic
AnastaZIuk May 28, 2025
127c6d9
some fixes to indexing
keptsecret May 29, 2025
52c7db9
Update tools/nsc/docker/README.md
AnastaZIuk May 29, 2025
531784f
post tools/nsc/docker/README.md updates
AnastaZIuk May 29, 2025
edac59f
Fix AssetConvert to use the current SpecInfo
May 29, 2025
a31cc66
Small fixes to asset and video
May 29, 2025
08ece5d
Fix CComputeBlit
May 29, 2025
75530d4
Create run-nsc.yml workflow
AnastaZIuk May 29, 2025
4ec5bac
Delete .github/workflows directory
AnastaZIuk May 29, 2025
104422f
Create run-nsc.yml
AnastaZIuk May 29, 2025
90d3579
fix scans for level 1+
keptsecret May 30, 2025
203c03a
some indexing fixes for 3-level reduce/scan
keptsecret May 30, 2025
0b16307
fix 3-level scan downsweep step
keptsecret May 30, 2025
aab868b
Update run-nsc.yml, add reverse proxy, require authentication to conn…
AnastaZIuk May 30, 2025
068fc26
Update run-nsc.yml, typo I did
AnastaZIuk May 30, 2025
5bf7336
Update run-nsc.yml, some updates to dc logs
AnastaZIuk May 30, 2025
83991b9
added tuple.hlsl
keptsecret Jun 2, 2025
209adb4
added some comments to config funcs for future debugging
keptsecret Jun 2, 2025
0a5dc30
merge master, fix example conflict
keptsecret Jun 2, 2025
9cdaa9f
change NSC package name, add badges creation & deploy
AnastaZIuk Jun 2, 2025
67a9a07
Update build-nabla.yml, typo
AnastaZIuk Jun 2, 2025
9178ec3
update badge labels, discord links and tools/nsc/docker/README.md
AnastaZIuk Jun 2, 2025
f82b405
Merge branch 'master' into improve-workgroup-scan-2
keptsecret Jun 3, 2025
7d77d30
change indexing to uint16_t
keptsecret Jun 3, 2025
7b15a54
do inclusive scan on upsweep and shift left on downsweep
keptsecret Jun 3, 2025
37aa99b
some adjustments to config and func usages
keptsecret Jun 3, 2025
eaffe98
Update compose.yml
AnastaZIuk Jun 3, 2025
d514007
Update compose.yml, restart: always to boot after host wakes up
AnastaZIuk Jun 3, 2025
f09ca19
Update build-nabla.yml, add deploy-production job
AnastaZIuk Jun 3, 2025
3b3d45c
always set the callback back, because even if it were empty it needs …
Jun 3, 2025
da6c313
split out level 0 scans into its own struct
keptsecret Jun 4, 2025
0784b45
Merge branch 'master' into stagesless_shaders
Jun 4, 2025
e230d06
fixes to 3 level scan
keptsecret Jun 4, 2025
3da175d
padding to shared mem indexing to avoid bank conflict
keptsecret Jun 5, 2025
32732e7
fix padding bugs
keptsecret Jun 5, 2025
1fc684d
Fix AssetConverter after merge
Jun 6, 2025
0112f0f
Merge branch 'stagesless_shaders' into rework_pipeline_shader_spec_info
Jun 6, 2025
7a2065a
update to latest example
keptsecret Jun 9, 2025
3a90fa8
Merge branch 'master' into improve-workgroup-scan-2
keptsecret Jun 9, 2025
5c2f55b
Fix pipeline creation in full screen triangle pass
Jun 9, 2025
03f7bc7
Fix descriptor set casting for const counterpart
Jun 9, 2025
aeebe36
Fix entries traversal in gpu pipeline
Jun 9, 2025
b65f14f
move SHitGroup to outside SCreationParams
Jun 9, 2025
c5f9479
Fix ray tracing pipeline creation
Jun 9, 2025
edefa67
Fix imgui pass
Jun 9, 2025
67c4d8d
Add assert shader stage
Jun 9, 2025
bc9aed6
use core::bitflag::hasFlags instead of &
Jun 9, 2025
294a399
Add whether shader is null when cloning SShaderSpecInfo
Jun 9, 2025
35815d2
Small improvement on ILogicalDevice
Jun 9, 2025
66c87a0
Small improvement on SShaderSpecInfo::create
Jun 9, 2025
01dced9
Skip null node
Jun 9, 2025
ce77b46
uncomment some concept requires
keptsecret Jun 9, 2025
2440dec
Add renderpass to constructor parameter of cpu graphics pipeline
Jun 11, 2025
ccecd47
Fix overload error
Jun 11, 2025
99f2d49
Optimize SpirvDebloaterTask to use only one map
Jun 11, 2025
efecb7e
Add inline to method in IGPUPipeline
Jun 11, 2025
1707b84
Move required subgroups size stages checking to commonCreatePipelines
Jun 11, 2025
165eebc
Implement visitDependents
Jun 11, 2025
d0a0245
Check shader availability in getRequiredSubgroupStages
Jun 11, 2025
2ad3e73
Use visitDependents for discardDependantContents and anyDependantDisc…
Jun 11, 2025
542bd06
Fix debloat task
Jun 11, 2025
c9597ff
Initialize stages to zero.
Jun 11, 2025
046a334
More descriptive error
Jun 11, 2025
fc1bc51
removed redundant stuff, make config more readable
keptsecret Jun 13, 2025
10b7f50
fix some bugs, readability fix
keptsecret Jun 13, 2025
50281c6
Remove computeDependants interface
Jun 14, 2025
6a84bd7
Rename visitDependentsImpl to visitDependents_impl
Jun 14, 2025
d58554e
Fix visitDependents_impl on some asset
Jun 14, 2025
4fcd6e2
Implement ICPUBuffer valid()
Jun 14, 2025
c3c50b4
Implement ICPUBufferView::valid()
Jun 14, 2025
51e408b
Implement ICPUDescriptorSet::valid()
Jun 14, 2025
345dbd8
Implement ICPUDescriptorSetLayout::valid()
Jun 14, 2025
4a4b51d
Implement ICPUImage::valid()
Jun 14, 2025
c5d1d85
Implement ICPUImageView::valid()
Jun 14, 2025
7087099
Implement ICPUPipelineCache::valid()
Jun 14, 2025
73a17a0
Implement ICPUSampler::valid()
Jun 14, 2025
c7cff1d
Remove valid implementation on IAsset and implement valid for all der…
Jun 16, 2025
437c194
use x-macros for config compat between hlsl and cpp
keptsecret Jun 16, 2025
ae3946e
Add comment to some valid logic of top acceleration structure
Jun 16, 2025
ef2ed3a
Rename getSpecInfoVec to getSpecInfoVector
Jun 16, 2025
9c87925
Fix indentation
Jun 16, 2025
697589c
Remove virtual from final classes
Jun 16, 2025
469bf04
Fix indentation
Jun 16, 2025
6e23e6e
Fix indentation
Jun 16, 2025
9c138b7
Fix indentation
Jun 16, 2025
026d494
Fix indentation
Jun 16, 2025
2578abe
Check raygen shader existence for raytracing pipeline
Jun 16, 2025
0608e9d
Check vertex shader existence for graphics pipeline
Jun 16, 2025
6080475
Remove comment on IShader::valid()
Jun 16, 2025
e2f7b8f
Remove virtual on IShader::valid and IShader::visitDependents_impl
Jun 16, 2025
47900b1
Add final to IShader
Jun 16, 2025
029cfeb
improved readability for config, include all new files
keptsecret Jun 16, 2025
2324f45
Merge pull request #876 from Devsh-Graphics-Programming/improve-workg…
devshgraphicsprogramming Jun 16, 2025
9b340a4
set the `examples_tests` submodule back to `master` HEAD as workgroup…
Jun 16, 2025
5d990a3
Rename ISPIRVDebloater to ISPIRVEntryPointTrimmer
Jun 17, 2025
6505cde
Fix indentation to use tabs
Jun 17, 2025
11df7a6
Initial refinement for IDescriptorSet::valid()
Jun 17, 2025
033c7cf
Remove unnecessary final specifier
Jun 17, 2025
3cf4554
Add const to hlsl::ShaderStage
Jun 17, 2025
9eab2f8
Remove unnecessary final specifier
Jun 17, 2025
74241f3
Add comment on why we need multiple dead branch elimination and multi…
Jun 17, 2025
04bcf0d
Remove unused variable
Jun 17, 2025
fc1983f
Small fixes on SpirvTrimTask
Jun 17, 2025
3767ede
Fix shader indexing logic in ray tracing pipeline creation
Jun 17, 2025
061d49c
Fix maxShaderStages calculation when creating ray tracing pipeline
Jun 17, 2025
e6d8727
update submodule pointer
AnastaZIuk Jun 17, 2025
4a374b0
Merge branch 'master' into rework_pipeline_shader_spec_info
Jun 17, 2025
6fea3e5
Add agrressive dce pass to remove type and remove multiple round of b…
Jun 17, 2025
0aa03c7
Remove comment
Jun 17, 2025
f74d78b
Merge branch 'rework_pipeline_shader_spec_info' of github.com:Devsh-G…
Jun 17, 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
269 changes: 269 additions & 0 deletions .github/workflows/build-nabla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
name: Build Nabla Workflow

on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: push-lock-${{ github.ref }}
cancel-in-progress: true

jobs:
build-windows:
runs-on: windows-2022

env:
image: ghcr.io/devsh-graphics-programming/docker-nanoserver-msvc-winsdk
entry: pwsh.exe
cmd: -NoLogo -NoProfile -ExecutionPolicy Bypass
mount: C:\mount\nabla
binary: C:\mount\nabla\build-ct
install: build-ct\install

strategy:
fail-fast: false
matrix:
# vendor: [msvc, clangcl]
# TODO: Yas please fix ClangCL, we have a few new compile errors
# if we build MSVC then build "run-compiler-explorer" target, for ClangCL build just "nsc"
vendor: [msvc]
config: [Release, Debug, RelWithDebInfo]
tag: ['17.13.6']

steps:
- name: Environment Setup
run: |
Add-MpPreference -ExclusionPath "${{ github.workspace }}"
Add-MpPreference -ExclusionExtension "*.*"
Add-MpPreference -ExclusionProcess "docker.exe"
Add-MpPreference -ExclusionProcess "dockerd.exe"
Set-MpPreference -RemediationScheduleDay 8
Set-MpPreference -DisableRealtimeMonitoring $true
Set-MpPreference -DisableRemovableDriveScanning $true
Set-MpPreference -DisableArchiveScanning $true
Set-MpPreference -DisableScanningMappedNetworkDrivesForFullScan $true

if (-not (docker network ls --format '{{.Name}}' | Where-Object { $_ -eq 'docker_default' })) {
docker network create --driver nat docker_default
if ($LASTEXITCODE -ne 0) { exit 1 }
}

- name: Set prefix
id: set-prefix
shell: pwsh
run: |
$prefix = "run-windows-${{ matrix.tag }}-${{ matrix.vendor }}-${{ matrix.config }}"
$owner = "${{ github.repository_owner }}"
$package = "nabla-shader-compiler-godbolt"
$tag = "build-${{ matrix.vendor }}-${{ matrix.config }}-${{ matrix.tag }}"
$nscTargetTaggedImage = "ghcr.io/${owner}/${package}:${tag}".ToLower()
$nscTargetTaggedImageLatest = "ghcr.io/${owner}/${package}:latest".ToLower()

$shouldPushImage = (
"${{ github.ref }}" -eq "refs/heads/master" -and
"${{ matrix.vendor }}" -eq "msvc" -and
"${{ matrix.config }}" -eq "Release"
)

Write-Host "::notice::Should push image? $shouldPushImage"

"prefix=$prefix" >> $env:GITHUB_OUTPUT
"nscTargetTaggedImage=$nscTargetTaggedImage" >> $env:GITHUB_OUTPUT
"nscTargetTaggedImageLatest=$nscTargetTaggedImageLatest" >> $env:GITHUB_OUTPUT
"shouldPushImage=$shouldPushImage" >> $env:GITHUB_OUTPUT

- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Pull Image
run: |
docker pull "${{ env.image }}:${{ matrix.tag }}"

- name: Run Container
run: |
$ctx = docker context show
$dockerHost = (docker context inspect $ctx | ConvertFrom-Json).Endpoints.docker.Host
$pipeName = [regex]::Match($dockerHost, '/pipe/(?<n>.+)$').Groups['n'].Value
$pipeHost = "\\.\pipe\$pipeName"

docker run `
--entrypoint ${{ env.entry }} -di --isolation process `
--env-file .\docker\ci-windows.env `
--env-file .\docker\ninja.env `
--env "NSC_IMAGE_NAME=${{ steps.set-prefix.outputs.nscTargetTaggedImage }}" `
--name orphan --network docker_default `
-v "${{ github.workspace }}:${{ env.mount }}" `
-v "${pipeHost}:\\.\pipe\dockerd" -e "DOCKER_HOST=npipe:////./pipe/dockerd" `
-w "${{ env.mount }}" `
"${{ env.image }}:${{ matrix.tag }}" `
${{ env.cmd }}

- name: Inspect Container
run: |
docker inspect orphan

- name: Container – Unpack Packages
run: |
docker exec orphan `
${{ env.entry }} ${{ env.cmd }} C:\unpack.ps1

- name: Container – Configure Project with CMake
run: |
mkdir profiling
docker exec orphan `
${{ env.entry }} ${{ env.cmd }} -Command cmake `
--preset ci-configure-dynamic-${{ matrix.vendor }} `
--profiling-output=profiling/cmake-profiling.json `
--profiling-format=google-trace

- name: Container – Build NSC
run: |
docker exec orphan `
${{ env.entry }} ${{ env.cmd }} -Command cmake --build `
--preset ci-build-dynamic-${{ matrix.vendor }} `
-t run-compiler-explorer --config ${{ matrix.config }}

- name: Container – Install NSC
run: |
docker exec orphan `
${{ env.entry }} ${{ env.cmd }} -Command cmake --install `
${{ env.binary }} --config ${{ matrix.config }} `
--component Runtimes --prefix ${{ env.install }}
docker exec orphan `
${{ env.entry }} ${{ env.cmd }} -Command cmake --install `
${{ env.binary }} --config ${{ matrix.config }} `
--component Executables --prefix ${{ env.install }}

- name: Container – Save NSC Image
run: |
docker exec orphan `
${{ env.entry }} ${{ env.cmd }} -Command docker `
save ${{ steps.set-prefix.outputs.nscTargetTaggedImage }} | zstd -T0 -3 -f -o ${{ steps.set-prefix.outputs.prefix }}-nsc-godbolt-image.tar.zst

- name: Package left workflow artifacts
run: |
tar -cvf "${{ steps.set-prefix.outputs.prefix }}-profiling.tar" profiling
tar -cvf "${{ steps.set-prefix.outputs.prefix }}-install.tar" ${{ env.install }}

- name: Upload NSC Godbolt Image artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set-prefix.outputs.prefix }}-nsc-godbolt-image
path: ${{ steps.set-prefix.outputs.prefix }}-nsc-godbolt-image.tar.zst
compression-level: 0

- name: Upload profiling artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set-prefix.outputs.prefix }}-profiling
path: ${{ steps.set-prefix.outputs.prefix }}-profiling.tar

- name: Upload install artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set-prefix.outputs.prefix }}-install
path: ${{ steps.set-prefix.outputs.prefix }}-install.tar

- name: Login to GHCR
if: steps.set-prefix.outputs.shouldPushImage == 'True'
run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u $env:GITHUB_ACTOR --password-stdin

- name: Tag Latest image
if: steps.set-prefix.outputs.shouldPushImage == 'True'
run: |
docker tag ${{ steps.set-prefix.outputs.nscTargetTaggedImage }} ${{ steps.set-prefix.outputs.nscTargetTaggedImageLatest }}

- name: Push images to GHCR
if: steps.set-prefix.outputs.shouldPushImage == 'True'
run: |
docker push ${{ steps.set-prefix.outputs.nscTargetTaggedImageLatest }}

update-badges:
name: Update Build & Image Badges
if: ${{ always() && github.ref == 'refs/heads/master' }}
needs: build-windows
runs-on: windows-2022
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Create Build Badge
run: |
$jobStatus = "${{ needs.build-windows.result }}"
$buildMsg = if ($jobStatus -eq "success") { "passing" } else { "failing" }
$buildColor = if ($jobStatus -eq "success") { "brightgreen" } else { "red" }

$buildBadge = @{
schemaVersion = 1
label = "build"
message = $buildMsg
color = $buildColor
} | ConvertTo-Json -Depth 2

$buildPath = ".badge-public/nabla"
New-Item -ItemType Directory -Path $buildPath -Force | Out-Null
$buildBadge | Set-Content -Path "$buildPath/build.json" -Encoding utf8

- name: Create Image Size Badge
run: |
$owner = "${{ github.repository_owner }}"
$package = "nabla-shader-compiler-godbolt"
$image = "ghcr.io/${owner}/${package}:latest".ToLower()
$manifest = docker manifest inspect $image | ConvertFrom-Json

if ($manifest.manifests) {
$totalSize = ($manifest.manifests | Measure-Object -Property size -Sum).Sum
} elseif ($manifest.layers) {
$totalSize = ($manifest.layers | Measure-Object -Property size -Sum).Sum
} else {
Write-Error "No valid size information found in manifest."
exit 1
}

$sizeMB = [Math]::Round($totalSize / 1MB, 2)
$size = "$sizeMB MB"

$imageBadge = @{
schemaVersion = 1
label = $image
message = $size
color = "blue"
} | ConvertTo-Json -Depth 2

$imagePath = ".badge-public/packages/nabla-shader-compiler-nsc"
New-Item -ItemType Directory -Path $imagePath -Force | Out-Null
$imageBadge | Set-Content -Path "$imagePath/image-badge.json" -Encoding utf8

- name: Deploy Badges
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: badges
publish_dir: .badge-public
keep_files: true
commit_message: "[CI] badges update"

deploy-production:
name: Deploy to production host
if: ${{ always() && github.ref == 'refs/heads/master' }}
needs: build-windows
runs-on: ubuntu-latest

steps:
- name: Pull latest images, re-run containers
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.CE_HOST }}
username: ${{ secrets.CE_USER }}
key: ${{ secrets.CE_KEY }}
script: |
powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -NoExit -File C:\Scripts\startup-docker.ps1
Loading
Loading