mirror of
				https://github.com/actions/setup-dotnet.git
				synced 2025-10-31 16:13:46 +00:00 
			
		
		
		
	Merge 8b04c36b458620a14ffd7e899cb348d5ca28b663 into 5c125af7da1b2700edf7106be3a4f8a60f495f59
This commit is contained in:
		
						commit
						165980e582
					
				
							
								
								
									
										17
									
								
								.github/msbuild.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								.github/msbuild.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| { | ||||
|     "problemMatcher": [ | ||||
|         { | ||||
|             "owner": "msbuild", | ||||
|             "pattern": [ | ||||
|                 { | ||||
|                     "regexp": "^([^\\s].*)\\s+:\\s+(error|warning)\\s+([a-zA-Z]+(?<!MSB)\\d+):\\s*(.*?)\\s+\\[(.*?)\\]$", | ||||
|                     "file": 1, | ||||
|                     "severity": 2, | ||||
|                     "code": 3, | ||||
|                     "message": 4, | ||||
|                     "fromPath": 5 | ||||
|                 } | ||||
|             ] | ||||
|         } | ||||
|     ] | ||||
| } | ||||
							
								
								
									
										46
									
								
								__tests__/msbuild.test.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								__tests__/msbuild.test.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,46 @@ | ||||
| import msbuildFile from '../.github/msbuild.json'; | ||||
| describe('msbuild tests', () => { | ||||
|   test('regular expression in msbuild.json is valid', async () => { | ||||
|     const regexPattern = | ||||
|       msbuildFile['problemMatcher'][0]['pattern'][0]['regexp']; | ||||
|     const regexResultsMap = msbuildFile['problemMatcher'][0]['pattern'][0]; | ||||
| 
 | ||||
|     const regex = new RegExp(regexPattern); | ||||
| 
 | ||||
|     const stringsToMatch = [ | ||||
|       "/Users/zacharyeisinger/Documents/repo/setup-dotnet/__tests__/sample-broken-csproj/sample.csproj : warning NU1904: Package 'System.Text.Encodings.Web' 4.7.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-ghhp-997w-qr28 [/Users/zacharyeisinger/Documents/repo/setup-dotnet/__tests__/sample-broken-csproj/sample.csproj]", | ||||
|       "/Users/zacharyeisinger/Documents/repo/setup-dotnet/__tests__/sample-broken-csproj/sample.csproj : error NU1904: Package 'System.Text.Encodings.Web' 4.7.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-ghhp-997w-qr28 [/Users/zacharyeisinger/Documents/repo/setup-dotnet/__tests__/sample-broken-csproj/sample.csproj]" | ||||
|     ]; | ||||
|     // Expected results are calculated according to the msbuild matcher located in msbuild.json file
 | ||||
|     const expectedResults = [ | ||||
|       { | ||||
|         file: '/Users/zacharyeisinger/Documents/repo/setup-dotnet/__tests__/sample-broken-csproj/sample.csproj', | ||||
|         severity: 'warning', | ||||
|         code: 'NU1904', | ||||
|         message: | ||||
|           "Package 'System.Text.Encodings.Web' 4.7.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-ghhp-997w-qr28", | ||||
|         fromPath: | ||||
|           '/Users/zacharyeisinger/Documents/repo/setup-dotnet/__tests__/sample-broken-csproj/sample.csproj' | ||||
|       }, | ||||
|       { | ||||
|         file: '/Users/zacharyeisinger/Documents/repo/setup-dotnet/__tests__/sample-broken-csproj/sample.csproj', | ||||
|         severity: 'error', | ||||
|         code: 'NU1904', | ||||
|         message: | ||||
|           "Package 'System.Text.Encodings.Web' 4.7.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-ghhp-997w-qr28", | ||||
|         fromPath: | ||||
|           '/Users/zacharyeisinger/Documents/repo/setup-dotnet/__tests__/sample-broken-csproj/sample.csproj' | ||||
|       } | ||||
|     ]; | ||||
| 
 | ||||
|     stringsToMatch.map((string, index) => { | ||||
|       const matchedResultsArray = string.match(regex); | ||||
|       for (const propName in expectedResults[index]) { | ||||
|         const propertyIndex = regexResultsMap[propName]; | ||||
|         const expectedPropValue = expectedResults[index][propName]; | ||||
|         const matchedPropValue = matchedResultsArray![propertyIndex]; | ||||
|         expect(matchedPropValue).toEqual(expectedPropValue); | ||||
|       } | ||||
|     }); | ||||
|   }, 10000); | ||||
| }); | ||||
							
								
								
									
										1
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							| @ -100848,6 +100848,7 @@ function run() { | ||||
|             } | ||||
|             const matchersPath = path_1.default.join(__dirname, '..', '..', '.github'); | ||||
|             core.info(`##[add-matcher]${path_1.default.join(matchersPath, 'csc.json')}`); | ||||
|             core.info(`##[add-matcher]${path_1.default.join(matchersPath, 'msbuild.json')}`); | ||||
|         } | ||||
|         catch (error) { | ||||
|             core.setFailed(error.message); | ||||
|  | ||||
| @ -91,6 +91,7 @@ export async function run() { | ||||
| 
 | ||||
|     const matchersPath = path.join(__dirname, '..', '..', '.github'); | ||||
|     core.info(`##[add-matcher]${path.join(matchersPath, 'csc.json')}`); | ||||
|     core.info(`##[add-matcher]${path.join(matchersPath, 'msbuild.json')}`); | ||||
|   } catch (error) { | ||||
|     core.setFailed(error.message); | ||||
|   } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user