Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
25 changes: 24 additions & 1 deletion eng/pipelines/templates/jobs/ci.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
- template: /eng/pipelines/templates/steps/vcpkg.yml

# Validate all the files are formatted correctly according to the
# .clang-format file. This step runs on linux only only and assumes that
# .clang-format file. This step runs on linux only and assumes that
# clang-format-11 is installed.
- bash: |
# Run clang-format recursively on each source and header file within the repo sdk folder.
Expand All @@ -132,6 +132,29 @@ jobs:
displayName: Validate Clang Format
condition: and(succeededOrFailed(), eq(variables['CHECK_CLANG_FORMAT'], 1))

# Validate all the files are saved as ASCII only without a UTF-8 BOM.
- bash: |
# Run grep recursive excluding git folder and known expected files and save a file with results.
grep -I -P -n "[^\x00-\x7F]" -r --exclude-dir ".git" --exclude-dir ".github" --exclude-dir "recordings" --exclude-dir "vcpkg_installed" --exclude-dir "_deps" --exclude-dir "docs" --exclude-dir "tools" --exclude "*CodeCoverage.cmake*" --exclude "grepResults" . > grepResults

# Display results to console.
cat grepResults

# Each result will produce one line, count how many lines were found.
files_with_non_ascii=($(wc -l < grepResults))

# Show info about the total files that needs attention.
echo Files found with non-ASCII characters: $files_with_non_ascii

# Remove the grepResults file.
rm grepResults

# Return the count. When greater than 0, the step will fail.
exit $files_with_non_ascii

displayName: Validate Characters are ASCII
condition: and(succeededOrFailed(), eq(variables['CHECK_ASCII_CHARACTERS'], 1))

- ${{ each artifact in parameters.Artifacts }}:
- template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml
parameters:
Expand Down
3 changes: 2 additions & 1 deletion eng/pipelines/templates/stages/platform-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@
},
"BuildSettings": {
"clang-11": {
"CHECK_CLANG_FORMAT": "1"
"CHECK_CLANG_FORMAT": "1",
"CHECK_ASCII_CHARACTERS": "1"
},
"included_release": {
"CMAKE_BUILD_TYPE": "Release"
Expand Down