Repository navigation
290 lines (258 loc) · 14.3 KB
/
Copy pathbuild_and_release.yml
File metadata and controls
290 lines (258 loc) · 14.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
name: Build and Release Luma Mods
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# A new push to a pull request cancels its previous run. Each push to main gets its own group, so main runs never wait for or cancel each other.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
# Lists the projects each build cell compiles. Pull requests only build the games they touch,
# and the x64 cells are split over a few runners (see ".github/scripts/plan-build.ps1").
plan:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.plan.outputs.matrix }}
count: ${{ steps.plan.outputs.count }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2 # on pull requests, HEAD is GitHub's merge commit and HEAD^1 the base branch
- name: Plan the build cells
id: plan
shell: pwsh
run: ./.github/scripts/plan-build.ps1
build:
needs: plan
if: needs.plan.outputs.count != '0'
name: build (${{ matrix.config }}, ${{ matrix.platform }}, ${{ matrix.shard }})
# runs-on: windows-2022
runs-on: windows-2025-vs2026
strategy:
matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1.2
- name: Integrate vcpkg with MSBuild
shell: pwsh
run: '& "$env:VCPKG_INSTALLATION_ROOT\vcpkg.exe" integrate install'
# Only packaging needs ReShade, and only for this cell's platform
- name: ReShade submodule SHA
id: reshade_sha
if: matrix.config != 'Development-Debug'
shell: pwsh
run: '"sha=$(git rev-parse HEAD:Source/External/reshade)" >> $env:GITHUB_OUTPUT'
- name: Cache ReShade
id: reshade_cache
if: matrix.config != 'Development-Debug'
uses: actions/cache@v6
with:
path: Source/External/reshade/bin/${{ matrix.platform }}/Release/ReShade*.dll
key: reshade-v145-${{ matrix.platform }}-${{ steps.reshade_sha.outputs.sha }}
# This requires the git directory to be added to the PATH Windows environment variables, to properly set up versioning information
# ReShade takes its version from "git describe --tags", so its shallow submodule needs the full history and tags first
- name: Build ReShade.sln Release
if: matrix.config != 'Development-Debug' && steps.reshade_cache.outputs.cache-hit != 'true'
run: |
git -C Source/External/reshade fetch --unshallow --tags --no-recurse-submodules
msbuild "Source\External\reshade\ReShade.sln" /m /p:Configuration="Release" /p:Platform="${{ matrix.platform == 'x64' && '64-bit' || '32-bit' }}" /p:PlatformToolset=v145
continue-on-error: true
- name: Build Luma.sln ${{ matrix.config }}-${{ matrix.platform }} (${{ matrix.shard }})
shell: pwsh
env:
PATHS: ${{ matrix.paths }}
run: |
# A solution filter keeps the solution's configurations and project names. It's called "Luma.slnf" so "$(SolutionName)" stays "Luma".
ConvertTo-Json -Depth 3 @{ solution = @{ path = "Luma.sln"; projects = @($env:PATHS -split ';') } } | Set-Content Luma.slnf
msbuild Luma.slnf /m /p:Configuration=${{ matrix.config }} /p:Platform=${{ matrix.platform }} /p:DefineConstants="REMOTE_BUILD=1"
if ($LASTEXITCODE -ne 0) {
Write-Host "::warning::MSBuild reported errors for ${{ matrix.config }}-${{ matrix.platform }} - the projects that failed to compile will be excluded from packaging/release (see the 'Create ZIP' step for the exact list)."
}
continue-on-error: true # if only one or a few games failed to build, we should still build and package+release the other # TODO: add code to avoid doing an empty release if they all failed to build
- name: Create ZIP per addon with matching shaders
id: create_zip
shell: pwsh
# We only build publishing and test for now, development builds can be built locally by devs (with the exclusion of the Generic and Graphics Analyzer mod, which can also be used to quickly download a dev/debug environment)
if: matrix.config == 'Publishing-Release' || matrix.config == 'Test-Release' || matrix.config == 'Development-Release'
env:
PROJECTS: ${{ matrix.projects }}
PATHS: ${{ matrix.paths }}
run: |
# Scan vcxproj files to find projects that use NGX (DLSS)
$ngxProjects = @()
$coreFastNoiseProjects = @()
$dxpProjects = @()
$vcxprojFiles = Get-ChildItem -Path "Source/Games" -Filter "*.vcxproj" -Recurse
foreach ($vcxproj in $vcxprojFiles) {
$content = Get-Content $vcxproj.FullName -Raw
$projectName = [System.IO.Path]::GetFileNameWithoutExtension($vcxproj.Name)
if ($content -match '<UseLumaNGX>\s*true\s*</UseLumaNGX>') {
$ngxProjects += $projectName
Write-Host "Found NGX feature-enabled project: $projectName"
}
if ($content -match '<UseLumaFastNoise>\s*true\s*</UseLumaFastNoise>') {
$coreFastNoiseProjects += $projectName
Write-Host "Found Core FAST texture opt-in project: $projectName"
}
if ($content -match '<UseLumaDXP>\s*true\s*</UseLumaDXP>') {
$dxpProjects += $projectName
Write-Host "Found DXP project: $projectName"
}
}
Write-Host "NGX projects: $($ngxProjects -join ', ')"
Write-Host "Core FAST texture projects: $($coreFastNoiseProjects -join ', ')"
Write-Host "DXP projects: $($dxpProjects -join ', ')"
# Expected addons for this cell (the projects it built, listed by the plan job) - missing ones failed to build
$cellProjects = $env:PROJECTS -split ';'
$cellPaths = $env:PATHS -split ';'
$expectedAddons = @()
for ($i = 0; $i -lt $cellPaths.Count; $i++) {
$vcxPath = Join-Path (Get-Location) $cellPaths[$i]
if (-not (Test-Path $vcxPath)) { continue }
$vcxContent = Get-Content $vcxPath -Raw
# Core and the tools (SR Bridge Helper) build too, but aren't addons
if ($vcxContent -notmatch '<TargetExt[^>]*>\.addon<') { continue }
$projName = $cellProjects[$i]
if ($vcxContent -match '<ProjectName>([^<]+)</ProjectName>') { $projName = $Matches[1] }
$projName = $projName -replace '&', '&' -replace '<', '<' -replace '>', '>' -replace '"', '"'
$expectedAddons += "Luma-$projName.addon"
}
Write-Host "Projects expected for this configuration: $($expectedAddons.Count)"
# Find the addon file in the build folder (adjust path accordingly)
$addonDir = "Binaries\${{ matrix.platform }}-${{ matrix.config }}"
$addonFiles = Get-ChildItem -Path $addonDir -Filter "Luma-*.addon"
if ($addonFiles.Count -eq 0) {
Write-Host "No addon files found."
"skip_upload=true" >> $env:GITHUB_OUTPUT
exit 0
}
"skip_upload=false" >> $env:GITHUB_OUTPUT
$builtAddons = @($addonFiles | ForEach-Object { $_.Name })
$missingAddons = @($expectedAddons | Where-Object { $builtAddons -notcontains $_ })
if ($missingAddons.Count -gt 0) {
$missingProjects = $missingAddons | ForEach-Object { $_ -replace '^Luma-', '' -replace '\.addon$', '' }
$warningMessage = "Projects that failed to build (excluded from this release): $($missingProjects -join ', ')"
Write-Host ("::warning::" + ($warningMessage -replace '%', '%25' -replace ',', '%2C' -replace ':', '%3A'))
}
$packagedCount = 0
foreach ($addonFile in $addonFiles) {
if (-not $addonFile) {
Write-Host "Addon file not found, it's likely this configuration isn't present for this project. Skipping."
continue
}
# Extract project name by removing prefix 'Luma-' and suffix '.addon'
$fileName = $addonFile.Name
# Replace "Luma-_" with "Luma-" in the filename, given that some projects (e.g. template, generic mod etc) might have an underscore in front of them to appear on top in alphabetical order
$cleanFileName = $fileName -replace '^Luma-_', 'Luma-'
$projectName = $cleanFileName -replace '^Luma-', '' -replace '\.addon$', ''
$zipName = "Luma-$projectName"
# Add "Test" tag for test builds
if ("${{ matrix.config }}" -eq "Test-Release") {
$zipName += "-Test"
}
# Add "Dev" tag for developments builds
if ("${{ matrix.config }}" -eq "Development-Release") {
$zipName += "-Dev"
}
if ("${{ matrix.config }}" -eq "Development-Debug") {
$zipName += "-Dev-Dbg"
}
# Avoid naming conflicts if mods have both x64 and x32 versions
if ("${{ matrix.platform }}" -eq "Win32") {
$zipName += "-x32"
}
# Turn spaces into another nice looking character, given that the github release will replace them with a '.', which is more weird
$zipName = $zipName -replace ' ', '_'
$zipName += ".zip"
Write-Host "Project name extracted: $projectName"
# TODO: remove "_" from "Generic Mod"
# We don't care to publish the template project, it's just there for reference
if ($projectName -like '_Template' -or $projectName -like 'Template') {
Write-Host "Project is a template. Skipping ZIP creation and upload."
continue
}
# Allow the Generic and Graphics Analyzer mods to be downloaded directly
elseif ("${{ matrix.config }}".StartsWith("Development") -and -not (
$projectName -like '_Generic' -or
$projectName -like 'Generic' -or
$projectName -like '_Generic Mod' -or
$projectName -like 'Generic Mod' -or
$projectName -like 'Graphics Analyzer'
)) {
continue
}
#if ($projectName -like '*Prey*') {
# Write-Host "Note that Prey automated packaging isn't the whole Luma mod, that needs manual packaging as it comes with extra files."
#}
# Package with the shared script (single source of truth with local packaging):
# it copies only this game's shaders, Global and Includes, skipping game
# Dump directories before traversal and excluding all .cso files. It bundles the runtime
# DLLs (d3dcompiler_47, ReShade as dxgi.dll, NGX DLSS) and zips next to the
# addon or into -OutDir. dxcompiler.dll is intentionally not shipped (SM5-only).
pwsh -ExecutionPolicy Bypass -File "Scripts/package.ps1" -Project $projectName -Config "${{ matrix.config }}" -Platform "${{ matrix.platform }}" -AddonPath $addonFile.FullName -OutDir "."
if ($LASTEXITCODE -ne 0) {
Write-Host "::warning::Packaging failed for '$projectName' - it will be excluded from this release."
continue
}
$packagedCount++
#"zipfile=$zipName" >> $env:GITHUB_OUTPUT
#"skip_upload=false" >> $env:GITHUB_OUTPUT
}
# Skip the upload if nothing was packaged (last write wins on GITHUB_OUTPUT)
if ($packagedCount -eq 0) {
Write-Host "::warning::No projects were packaged successfully for ${{ matrix.config }}-${{ matrix.platform }} - skipping the upload for this configuration."
"skip_upload=true" >> $env:GITHUB_OUTPUT
}
- name: Upload ZIP
if: (matrix.config == 'Publishing-Release' || matrix.config == 'Test-Release' || matrix.config == 'Development-Release') && steps.create_zip.outputs.skip_upload != 'true'
uses: actions/upload-artifact@v4
with:
name: Package-${{ matrix.config }}-${{ matrix.platform }}-${{ matrix.shard }}
#path: ${{ steps.create_zip.outputs.zipfile }}
path: |
Luma-*.zip
compression-level: 0 # the zips are already compressed
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main' # Don't run this on PRs but only on push, otherwise it will fail to upload release files
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: Package-*
merge-multiple: true # puts all files in a single folder
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: latest-${{ github.run_number }}
name: Release (Build ${{ github.run_number }})
body: |
The current version of all Luma mods (based on latest commit).
Installation instructions:
- Extract all the files directly in the game main executable folder (replace the previous ones if you are updating)
- If you already had a ReShade installation (dxgi.dll) overwrite it unless it's the same version. If you have other mods that used the dxgi.dll file, find a way to proxy them
- Boot the game
- Press home to bring out the ReShade and Luma menus (if they don't appear, ReShade or Luma failed to install or run)
- Customize the settings if you'd like, the defaults are already good and pick up on your display calibration
- **(Linux only)** install msvcrt40 and vcrun2022 using protontricks
Note that not all mods here are playable, some are work in progress. Consult the wiki mod list for their state, or ask in "HDR Den" discord for more information.
Note that some mods here might not be complete, like "Prey", which misses (optional) data for the rest of the mod, these should be downloaded from Nexus.
"Test" mods are made to be tested and have tools to investigate what's going on, and help the developers gather information.
The "Generic" mod will work in many games out of the box, especially if you pair it with a separate Auto HDR upgrade method.
Proton should be fully compatible out of the box.
---
Last commit: ${{ github.event.head_commit.message }}
files: |
Luma-*.zip