Skip to content

Commit e80fc6c

Browse files
authored
[ci] Fail build if any untracked files written in git tree (#9939)
Context: #9661 Building on #9661, we also shouldn't be writing build artifacts to the source tree. Any files generated by the build should be placed in `/bin` or `/obj` folders rather than the source tree. Violations fixed by putting the artifact in `.gitignore`. ## Current violations: ### Mac: ``` Untracked files: (use "git add <file>..." to include in what will be committed) src/native/CMakePresets.json ``` ### Linux: ``` Untracked files: (use "git add <file>..." to include in what will be committed) src/native/CMakePresets.json src/native/clr/host/generate-pinvoke-tables src/native/clr/host/pinvoke-tables.include.generated src/native/mono/pinvoke-override/generate-pinvoke-tables src/native/mono/pinvoke-override/pinvoke-tables.include.generated ``` ### Windows ``` Untracked files: (use "git add <file>..." to include in what will be committed) dotnet-install.ps1 src/native/CMakePresets.json ```
1 parent 20cd062 commit e80fc6c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ Novell
3131
*.patch
3232
*.keystore
3333
/omnisharp.json
34+
src/native/CMakePresets.json
35+
src/native/clr/host/generate-pinvoke-tables
36+
src/native/clr/host/pinvoke-tables.include.generated
37+
src/native/mono/pinvoke-override/generate-pinvoke-tables
38+
src/native/mono/pinvoke-override/pinvoke-tables.include.generated
39+
dotnet-install.ps1

build-tools/automation/yaml-templates/fail-on-dirty-tree.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ steps:
99
# Run this to log the output for the user
1010
git status
1111
12-
# Run this to error the build if untracked files
13-
$process= git status --porcelain --untracked-files=no
12+
# Run this to error the build if modified/untracked files exist
13+
$process= git status --porcelain
1414
1515
if ($process)
1616
{
17-
Write-Host "##vso[task.logissue type=error]git tree has modified tracked files."
17+
Write-Host "##vso[task.logissue type=error]git tree has modified or untracked files."
1818
Write-Host "##vso[task.complete result=Failed;]"
1919
}
20-
displayName: Ensure no modified committed files
20+
displayName: Ensure no modified/untracked files
2121
workingDirectory: ${{ parameters.xaSourcePath }}
2222
condition: ${{ parameters.condition }}

0 commit comments

Comments
 (0)