From c4ca10258b522db6cf7fe101c95513ed75fa393a Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sun, 20 Sep 2020 13:10:14 -0400 Subject: [PATCH] ci: Validate VS filter files in buiild msbuild does not use the project in it's entirety to build the app. This means problems can slip through, so an easy solution is just to ensure the XML is well-formed. More sophisticated validation could be done with something like `xmllint` but seems overkill. --- .../workflows/scripts/validate-vs-filters.ps1 | 19 +++++++++++++++++++ .github/workflows/windows-workflow.yml | 4 ++++ 2 files changed, 23 insertions(+) create mode 100644 .github/workflows/scripts/validate-vs-filters.ps1 diff --git a/.github/workflows/scripts/validate-vs-filters.ps1 b/.github/workflows/scripts/validate-vs-filters.ps1 new file mode 100644 index 0000000000..09e7b43ba7 --- /dev/null +++ b/.github/workflows/scripts/validate-vs-filters.ps1 @@ -0,0 +1,19 @@ +$filterFiles = Get-ChildItem $PWD -name -recurse *.vcxproj.filters + +$failed = $FALSE +foreach ($file in $filterFiles) { + # Skip 3rdparty files + if ($file -NotMatch "^3rdparty") { + $expression = "python -c `"import sys, xml.dom.minidom as d; d.parse(sys.argv[1])`" $($file)" + $expression += ';$LastExitCode' + $exitCode = Invoke-Expression $expression + if($exitCode -ne 0){ + Write-Host -foregroundColor red "$($file) - Invalid VS filters file. Likely missing tags" + $failed = $TRUE + } + } +} + +if ($failed) { + exit 1 +} \ No newline at end of file diff --git a/.github/workflows/windows-workflow.yml b/.github/workflows/windows-workflow.yml index 8f0f3946e7..b9b8e64191 100644 --- a/.github/workflows/windows-workflow.yml +++ b/.github/workflows/windows-workflow.yml @@ -87,6 +87,10 @@ jobs: echo "##[set-output name=artifact-metadata;]${ARTIFACT_NAME}" id: git-vars + - name: Verify VS Project Files + shell: powershell + run: .\.github\workflows\scripts\validate-vs-filters.ps1 + - name: Setup msbuild uses: microsoft/setup-msbuild@v1.0.1 with: