Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
YuliiaKovalova committed Oct 3, 2024
2 parents 3618188 + ff5cb70 commit 445df62
Show file tree
Hide file tree
Showing 657 changed files with 22,190 additions and 11,985 deletions.
34 changes: 34 additions & 0 deletions .config/git-merge-flow-config.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// IMPORTANT: This file is read by the merge flow from main branch only.
{
"merge-flow-configurations": {
// MSBuild servicing chain from oldest supported through currently-supported to main
// Automate opening PRs to merge msbuild's vs16.11 (VS until 4/2029) into vs17.0 (SDK 6.0.1xx)
"vs16.11": {
"MergeToBranch": "vs17.0"
},
// Automate opening PRs to merge msbuild's vs17.0 (SDK 6.0.1xx) into vs17.3 (SDK 6.0.4xx)
"vs17.0": {
"MergeToBranch": "vs17.3"
},
// Automate opening PRs to merge msbuild's vs17.3 (SDK 6.0.4xx) into vs17.6 (VS until 1/2025)
"vs17.3": {
"MergeToBranch": "vs17.6"
},
// Automate opening PRs to merge msbuild's vs17.6 into vs17.8 (VS until 7/2025)
"vs17.6": {
"MergeToBranch": "vs17.8"
},
// Automate opening PRs to merge msbuild's vs17.8 (SDK 8.0.1xx) into vs17.10 (SDK 8.0.3xx)
"vs17.8": {
"MergeToBranch": "vs17.10"
},
// Automate opening PRs to merge msbuild's vs17.10 (SDK 8.0.3xx) into vs17.11 (SDK 8.0.4xx)
"vs17.10": {
"MergeToBranch": "vs17.11"
},
// MSBuild latest release to main
"vs17.11": {
"MergeToBranch": "main"
}
}
}
42 changes: 0 additions & 42 deletions .config/guardian/.gdnbaselines
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,6 @@
}
},
"results": {
"1757d0179485ad6618415e151de2453f25d5484071f7bae328fa9ca9d4d54688": {
"signature": "1757d0179485ad6618415e151de2453f25d5484071f7bae328fa9ca9d4d54688",
"alternativeSignatures": [],
"target": "src/Tasks.UnitTests/TestResources/mycert.pfx",
"line": 1,
"memberOf": [
"default"
],
"tool": "credscan",
"ruleId": "CSCAN-GENERAL0020",
"createdDate": "2024-03-14 11:30:33Z",
"expirationDate": "2024-08-31 12:48:32Z",
"justification": "This error is baselined with an expiration date of 180 days from 2024-03-14 12:48:32Z"
},
"60d4d52e838e08dc19d3ac2b43b7c809b080db55f9c754b80bd60f30624e9687": {
"signature": "60d4d52e838e08dc19d3ac2b43b7c809b080db55f9c754b80bd60f30624e9687",
"alternativeSignatures": [],
"target": "artifacts/bin/Microsoft.Build.Tasks.UnitTests/Release/net472/TestResources/mycert.pfx",
"line": 1,
"memberOf": [
"default"
],
"tool": "credscan",
"ruleId": "CSCAN-GENERAL0020",
"createdDate": "2024-03-14 12:01:14Z",
"expirationDate": "2024-08-31 12:48:32Z",
"justification": "This error is baselined with an expiration date of 180 days from 2024-03-14 12:48:32Z"
},
"7cb5d42a8744e4a214149aa27d3d8a1b7989914d1a2fee8cea13287368cbafff": {
"signature": "7cb5d42a8744e4a214149aa27d3d8a1b7989914d1a2fee8cea13287368cbafff",
"alternativeSignatures": [],
"target": "artifacts/bin/Microsoft.Build.Tasks.UnitTests/Release/net8.0/TestResources/mycert.pfx",
"line": 1,
"memberOf": [
"default"
],
"tool": "credscan",
"ruleId": "CSCAN-GENERAL0020",
"createdDate": "2024-03-14 12:01:14Z",
"expirationDate": "2024-08-31 12:48:32Z",
"justification": "This error is baselined with an expiration date of 180 days from 2024-03-14 12:48:32Z"
},
"24491acb7bf0f8b072d9fbd2f6efcf1bdf6e9506ff3f7a9f9c803445c55b7bd9": {
"signature": "24491acb7bf0f8b072d9fbd2f6efcf1bdf6e9506ff3f7a9f9c803445c55b7bd9",
"alternativeSignatures": [
Expand Down
31 changes: 31 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,34 @@ dotnet_diagnostic.IDE0305.severity = suggestion

# Temporarily disable SA1010 "Opening square brackets should not be preceded by a space" until https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3687 is fixed
dotnet_diagnostic.SA1010.severity = none

# Remove unnecessary equality operator IDE0100 (https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/style-rules/ide0100)
# Making it a suggestion to have a flexibility for future
dotnet_diagnostic.IDE0100.severity = suggestion

# File header should match the template, making it error since couple of files met in the code base without any header
dotnet_diagnostic.IDE0073.severity = error

# Use 'System.Threading.Lock'
dotnet_diagnostic.IDE0330.severity = suggestion

# Value types are incompatible with null values. https://xunit.net/xunit.analyzers/rules/xUnit1012
dotnet_diagnostic.xUnit1012.severity = warning

# Use Assert.Fail() instead of Assert.True(false) or Assert.False(true)
dotnet_diagnostic.xUnit2020.severity = warning

# Use Assert.DoesNotContain instead of Assert.Empty on filtered collections
dotnet_diagnostic.xUnit2029.severity = warning

# Do not use blocking task operations in test method. https://xunit.net/xunit.analyzers/rules/xUnit1031
# The parallelization is disabled in https://github.com/dotnet/msbuild/blob/371d00f5c10a15b0858c411aafa11aac74596b06/src/Shared/UnitTests/xunit.runner.json#L6-L7
# Issue to consider enabling parallelization: https://github.com/dotnet/msbuild/issues/10640
dotnet_diagnostic.xUnit1031.severity = none

# Do not use equality check to check for collection size. https://xunit.net/xunit.analyzers/rules/xUnit2013
# To fix the warning for empty collection we can use Assert.Empty() instead of Assert.Equal(0, collection.Count)
# However to fix the warning for collections with 1 elements we should use Assert.Single() instead of Assert.Equal(1, collection.Count)
# The latter brings incosistency in the codebase and some times in one test case.
# So we are disabling this rule with respect to the above mentioned reasons.
dotnet_diagnostic.xUnit2013.severity = none
19 changes: 17 additions & 2 deletions .exp-insertions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,21 @@ jobs:
nugetConfigPath: '$(Build.SourcesDirectory)\NuGet.config'
restoreDirectory: '$(Build.SourcesDirectory)\.packages'

# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-security-configuration/configuration-guides/pat-burndown-guidance#authentication-from-pipelines
# Requires Azure client 2.x
- task: AzureCLI@2
displayName: 'Set AzDO.DotnetPerfStarToken'
enabled: true
inputs:
azureSubscription: 'dotnet-perfstar at app.vssps.visualstudio.com' # Azure DevOps service connection
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
# '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps
$token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
Write-Host "Setting AzDO.DotnetPerfStarToken"
Write-Host "##vso[task.setvariable variable=AzDO.DotnetPerfStarToken]${token}"
- powershell: |
mkdir "$(Pipeline.Workspace)/artifacts"
Expand All @@ -166,7 +181,7 @@ jobs:
Write-Host "Detected drop.exe path: $dropExePath"
Write-Host "Downloading VS msbuild"
$patAuthEnvVar = "SYSTEM_ACCESSTOKEN"
$patAuthEnvVar = "patVariable"
& "$dropExePath" get --patAuthEnvVar $patAuthEnvVar -u "$(MSBuildDropPath)\$(VSVersion)" -d "$(System.ArtifactsDirectory)/VSMSBuildDrop"
Write-Host "Download of VS msbuild finished"
Expand All @@ -175,7 +190,7 @@ jobs:
Write-Host "Copy of VS msbuild finished"
displayName: Download msbuild vs drop
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
patVariable: $(AzDO.DotnetPerfStarToken)
- task: DownloadBuildArtifacts@1
inputs:
Expand Down
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ eng/common/** linguist-vendored linguist-generated

# Display XLF files collapsed by default in PR diffs
*.xlf linguist-generated=true

# VerifyTests
*.verified.txt text eol=lf working-tree-encoding=UTF-8
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/07_buildchecksuggestion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 💡 BuildCheck Suggestion
description: Suggesting a diagnostic check (AKA [BuildCheck](https://github.com/dotnet/msbuild/blob/main/documentation/specs/BuildCheck/BuildCheck.md)) that MSBuild could provide.
title: "[BuildCheck Suggestion]: "
labels: ["BuildCheck Suggestion", "Area: BuildCheck"]
body:
- type: textarea
attributes:
label: Summary
description: Brief summary of what this proposal is about.
validations:
required: true
- type: textarea
attributes:
label: Background and Motivation
description: What is the problem MSBuild should be flagging and in what context did you encounter it?
validations:
required: true
- type: textarea
attributes:
label: Sample issue or antipattern that the check should be flagging
description: Please provide as specific as possible sample that you envision to be catched by the check.
validations:
required: true
- type: textarea
attributes:
label: Sample output
description: If you have an idea what and how to report - please try to provide possible sample.
171 changes: 171 additions & 0 deletions .github/workflows/SyncAnalyzerTemplateMSBuildVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: Sync Microsoft.Build version in analyzer template with Version.props
on:
push:
branches:
- main
paths:
- 'eng/Versions.props'

jobs:
Sync-version:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set baseBranch variable
id: vars
run: echo "baseBranch=${{ github.ref_name }}" >> $GITHUB_ENV

- name: Update analyzer template version with version from Versions.props
shell: pwsh
run: |
try {
# Define the paths to your XML and JSON files
$xmlFilePath = "eng/Versions.props"
$jsonFilePath = "template_feed/content/Microsoft.CheckTemplate/.template.config/template.json"
# Check if the XML file exists
if (-Not (Test-Path -Path $xmlFilePath)) {
throw "Versions.props file not found: $xmlFilePath"
}
# Load and parse the XML content
[xml]$xmlContent = Get-Content -Path $xmlFilePath
$versionPrefix = [string]$xmlContent.Project.PropertyGroup.VersionPrefix
$versionPrefix = $versionPrefix.Trim()
# Validate the versionPrefix
if ([string]::IsNullOrWhiteSpace($versionPrefix)) {
throw "VersionPrefix is empty or null in the XML file: $xmlFilePath"
}
# Check if the JSON file exists
if (-Not (Test-Path -Path $jsonFilePath)) {
throw "Analyzer template file not found: $jsonFilePath"
}
# Load the JSON template
$jsonContent = Get-Content -Path $jsonFilePath -Raw | ConvertFrom-Json
# Check if the versionPrefix is different from the current defaultValue
if ($versionPrefix -ne $jsonContent.symbols.MicrosoftBuildVersion.defaultValue) {
# Update the defaultValue of MicrosoftBuildVersion in the JSON template
$jsonContent.symbols.MicrosoftBuildVersion.defaultValue = $versionPrefix
# Convert the JSON content back to a string
$jsonString = $jsonContent | ConvertTo-Json -Depth 10
# Write the updated JSON back to the file
Set-Content -Path $jsonFilePath -Value $jsonString
Write-Output "Updated MicrosoftBuildVersion to $versionPrefix"
# Set the updateNeeded output variable to true
$updateNeeded = "true"
} else {
Write-Output "No update needed. MicrosoftBuildVersion is already $versionPrefix"
# Set the updateNeeded output variable to false
$updateNeeded = "false"
}
# Set the versionPrefix and template filePath as an output
Add-Content -Path $env:GITHUB_ENV -Value "versionPrefix=$versionPrefix"
Add-Content -Path $env:GITHUB_ENV -Value "jsonFilePath=$jsonFilePath"
Add-Content -Path $env:GITHUB_ENV -Value "updateNeeded=$updateNeeded"
Write-Output "Extracted versionPrefix: $versionPrefix"
Write-Output "Extracted jsonFilePath: $jsonFilePath"
Write-Output "Update needed: $updateNeeded"
}
catch {
Write-Error "An error occurred: $_"
}
- name: Create Pull Request
if: env.updateNeeded == 'true'
uses: actions/github-script@v7
with:
script: |
const baseBranch = process.env.baseBranch;
const versionPrefix = process.env.versionPrefix;
const filePath = process.env.jsonFilePath;
const newBranch = `${baseBranch}-update-msbuild-version-for-analyzer-template`;
const commitMessage = `Update MicrosoftBuildVersion to ${versionPrefix}`;
const prBody = '[Automated] Update the MicrosoftBuildVersion defaultValue in the template.json.';
const prTitle = 'Update MicrosoftBuildVersion in analyzer template';
// Main execution
(async () => {
try {
// Configure git
await configureGit();
// Create and switch to the new branch
await createAndSwitchBranch(newBranch);
// Check if the branch PR already exists on the remote
const shouldOpenPullRequest = await checkBranchPRExists(newBranch,baseBranch);
// Stage and commit the changes
await stageAndCommitChanges(filePath, commitMessage);
// Push the new branch to the repository
await pushBranch(newBranch);
// Create the pull request if needed
if (shouldOpenPullRequest) {
await createPullRequest(baseBranch, newBranch, prTitle, prBody);
} else {
console.log("The PR already exists, skipping opening a new PR.");
}
} catch (error) {
core.setFailed(error);
}
})();
async function configureGit() {
await exec.exec(`git config user.name "github-actions"`);
await exec.exec(`git config user.email "[email protected]"`);
}
async function createAndSwitchBranch(branch) {
await exec.exec('git', ['checkout', '-b', branch]);
}
async function checkBranchPRExists(newBranch,baseBranch) {
// Check if a pull request already exists
const { data: pullRequests } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
head: newBranch,
base: baseBranch,
state: 'open',
});
if (pullRequests.length === 0) {
return true;
} else {
return false;
}
}
async function stageAndCommitChanges(filePath, commitMessage) {
await exec.exec(`git add ${filePath}`);
await exec.exec(`git commit -m "${commitMessage}"`);
}
async function pushBranch(branch) {
await exec.exec(`git push --force --set-upstream origin HEAD:${branch}`);
}
async function createPullRequest(baseBranch, newBranch, title, body) {
await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
head: newBranch,
base: baseBranch
});
}
Loading

0 comments on commit 445df62

Please sign in to comment.