Skip to content

Commit fd95c50

Browse files
committed
Speed up source artifact packaging
1 parent 16bfd50 commit fd95c50

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

.github/workflows/build-nabla.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,27 @@ jobs:
297297
run: |
298298
tar -cvf "${{ steps.set-prefix.outputs.prefix }}-profiling.tar" profiling
299299
tar -cvf "${{ steps.set-prefix.outputs.prefix }}-install.tar" ${{ env.install }}
300-
tar -cvf "${{ steps.set-prefix.outputs.prefix }}-source.tar" --exclude=.git --exclude=build-ct --exclude=examples_tests/media .
300+
$sourceTar = "${{ steps.set-prefix.outputs.prefix }}-source.tar"
301+
$sourceList = "${{ steps.set-prefix.outputs.prefix }}-source-files.txt"
302+
$sourcePatterns = @('*.c', '*.cc', '*.cpp', '*.cxx', '*.h', '*.hh', '*.hpp', '*.hxx', '*.inc', '*.inl', '*.ipp', '*.tpp', '*.ixx')
303+
$trackedSourceFiles = @(
304+
git ls-files --recurse-submodules -- $sourcePatterns |
305+
Where-Object { $_ -and $_ -notlike 'examples_tests/media/*' }
306+
)
307+
$generatedSourceFiles = @(
308+
rg --files build-ct `
309+
-g '*.c' -g '*.cc' -g '*.cpp' -g '*.cxx' `
310+
-g '*.h' -g '*.hh' -g '*.hpp' -g '*.hxx' `
311+
-g '*.inc' -g '*.inl' -g '*.ipp' -g '*.tpp' -g '*.ixx'
312+
)
313+
$sourceFiles = @($trackedSourceFiles + $generatedSourceFiles | Sort-Object -Unique)
314+
315+
if ($sourceFiles.Count -eq 0) {
316+
throw "No source-like files found for source artifact packaging."
317+
}
318+
319+
$sourceFiles | Set-Content -Path $sourceList -Encoding utf8
320+
tar -cvf $sourceTar -T $sourceList
301321
302322
- name: Upload NSC Godbolt Image artifact
303323
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)