From ce215d93a4d082c7a102ec5273eba7fa451b0c5b Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 11 Nov 2022 13:54:17 -0500 Subject: [PATCH 1/2] [DevOps] Write comments in the correct repo when we are not in self. --- .../templates/build/api-diff-process-results.yml | 6 +++++- tools/devops/automation/templates/build/build.yml | 7 ++++++- tools/devops/automation/templates/mac/build.yml | 6 +++++- .../sign-and-notarized/artifact-github-comment.yml | 6 +++++- tools/devops/automation/templates/tests/publish-html.yml | 6 +++++- tools/devops/automation/templates/tests/stage.yml | 6 +++++- 6 files changed, 31 insertions(+), 6 deletions(-) diff --git a/tools/devops/automation/templates/build/api-diff-process-results.yml b/tools/devops/automation/templates/build/api-diff-process-results.yml index 4d9fb112b18a..9cf0906443fa 100644 --- a/tools/devops/automation/templates/build/api-diff-process-results.yml +++ b/tools/devops/automation/templates/build/api-diff-process-results.yml @@ -83,7 +83,7 @@ steps: } catch { $converted = $inputContents + "`n`nUnable to convert markdown: $_`n`n" } - $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:GIT_HASH + $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:COMMENT_HASH $result = $githubComments.NewCommentFromMessage("", "", $converted) displayName: 'Publish GitHub comment for change detection' timeoutInMinutes: 10 @@ -91,3 +91,7 @@ steps: condition: always() # We always want to post something on github env: GITHUB_TOKEN: $(GitHub.Token) + ${{ if eq(parameters.repositoryAlias, 'self') }}: + COMMENT_HASH: $(GIT_HASH) + ${{ else }}: + COMMENT_HASH: $(Build.SourceVersion) diff --git a/tools/devops/automation/templates/build/build.yml b/tools/devops/automation/templates/build/build.yml index d96ad822dc6c..971ab36bbca3 100644 --- a/tools/devops/automation/templates/build/build.yml +++ b/tools/devops/automation/templates/build/build.yml @@ -266,10 +266,15 @@ steps: # to write a comment. - pwsh: | Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\MaciosCI.psd1 - $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $(GitHub.Token) -Hash $Env:GIT_HASH + $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $(GitHub.Token) -Hash $Env:COMMENT_HASH $githubComments.NewCommentFromMessage("Build failed", ":fire:", "Build failed for the job '$(System.JobDisplayName)'") condition: failed() displayName: 'Report build failure' + env: + ${{ if eq(parameters.repositoryAlias, 'self') }}: + COMMENT_HASH: $(GIT_HASH) + ${{ else }}: + COMMENT_HASH: $(Build.SourceVersion) # Upload any crash reports that occurred during the build. This is helpful if we want to file issues about dotnet/csc crashing during the build. - bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/collect-and-upload-crash-reports.sh diff --git a/tools/devops/automation/templates/mac/build.yml b/tools/devops/automation/templates/mac/build.yml index cfabc962eacb..76f6c18e060c 100644 --- a/tools/devops/automation/templates/mac/build.yml +++ b/tools/devops/automation/templates/mac/build.yml @@ -269,7 +269,7 @@ steps: # Make sure to report any errors - pwsh: | Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\MaciosCI.psd1 - $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $(GitHub.Token) -Hash $Env:GIT_HASH + $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $(GitHub.Token) -Hash $Env:COMMENT_HASH $statuses = New-GitHubStatusesObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $(GitHub.Token) if (Test-Path -Path "$Env:GITHUB_FAILURE_COMMENT_FILE" -PathType Leaf) { @@ -290,3 +290,7 @@ steps: GITHUB_TOKEN: $(GitHub.Token) SYSTEM_ACCESSTOKEN: $(System.AccessToken) TEST_BOT: $(Agent.Name) + ${{ if eq(parameters.repositoryAlias, 'self') }}: + COMMENT_HASH: $(GIT_HASH) + ${{ else }}: + COMMENT_HASH: $(Build.SourceVersion) diff --git a/tools/devops/automation/templates/sign-and-notarized/artifact-github-comment.yml b/tools/devops/automation/templates/sign-and-notarized/artifact-github-comment.yml index b207b0d0f240..edd58d4bdfe7 100644 --- a/tools/devops/automation/templates/sign-and-notarized/artifact-github-comment.yml +++ b/tools/devops/automation/templates/sign-and-notarized/artifact-github-comment.yml @@ -28,13 +28,17 @@ steps: - pwsh: | Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\MaciosCI.psd1 $artifact = New-ArtifactsFromJsonFile -Path "$Env:ARTIFACTS_JSON_PATH" - $gihubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:GIT_HASH + $gihubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:COMMENT_HASH $result = $gihubComments.NewCommentFromObject("Artifacts", ":books:", $artifact) Write-Host $result env: BUILD_REVISION: $(Build.SourceVersion) GITHUB_TOKEN: $(GitHub.Token) ACCESSTOKEN: $(System.AccessToken) + ${{ if eq(parameters.repositoryAlias, 'self') }}: + COMMENT_HASH: $(GIT_HASH) + ${{ else }}: + COMMENT_HASH: $(Build.SourceVersion) displayName: 'Create github comment.' enabled: true timeoutInMinutes: 10 diff --git a/tools/devops/automation/templates/tests/publish-html.yml b/tools/devops/automation/templates/tests/publish-html.yml index 564993b10316..2934fd0367a3 100644 --- a/tools/devops/automation/templates/tests/publish-html.yml +++ b/tools/devops/automation/templates/tests/publish-html.yml @@ -82,7 +82,7 @@ steps: $emoji = ":fire:" } - $gihubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:GIT_HASH -Debug + $gihubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:COMMENT_HASH -Debug $result = $gihubComments.NewCommentFromObject("Test results", $emoji, $parallelResults) } catch { New-GitHubComment -Header "Failed to compute test summaries on $Env:CONTEXT" -Emoji ":fire:" -Description "Failed to compute test summaries: $_." @@ -96,6 +96,10 @@ steps: TESTS_JOBSTATUS: $(TESTS_JOBSTATUS) # set by the runTests step TESTS_SUMMARY: $(TEST_SUMMARY_PATH) ACCESSTOKEN: $(System.AccessToken) + ${{ if eq(parameters.repositoryAlias, 'self') }}: + COMMENT_HASH: $(GIT_HASH) + ${{ else }}: + COMMENT_HASH: $(Build.SourceVersion) displayName: 'Add summaries' condition: always() timeoutInMinutes: 15 diff --git a/tools/devops/automation/templates/tests/stage.yml b/tools/devops/automation/templates/tests/stage.yml index 0b0eb6fb7ca9..daafffce83bb 100644 --- a/tools/devops/automation/templates/tests/stage.yml +++ b/tools/devops/automation/templates/tests/stage.yml @@ -221,7 +221,7 @@ stages: - pwsh: | Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\MaciosCI.psd1 - $gihubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:GIT_HASH -Debug + $gihubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:COMMENT_HASH -Debug $sb = [System.Text.StringBuilder]::new() $sb.AppendLine("All tests have been skipped because the label 'skip-all-tests' was set.") $result = $gihubComments.NewCommentFromMessage("Test results", ":seedling:", $sb.ToString()) @@ -231,3 +231,7 @@ stages: DEVICE_PREFIX: ${{ parameters.testPrefix }} GITHUB_TOKEN: $(GitHub.Token) ACCESSTOKEN: $(System.AccessToken) + ${{ if eq(parameters.repositoryAlias, 'self') }}: + COMMENT_HASH: $(GIT_HASH) + ${{ else }}: + COMMENT_HASH: $(Build.SourceVersion) From 4911457d42ddfb40e13b35acd2c4e4ff9b316ba4 Mon Sep 17 00:00:00 2001 From: GitHub Actions Autoformatter Date: Fri, 11 Nov 2022 19:01:30 +0000 Subject: [PATCH 2/2] Auto-format source code --- tests/monotouch-test/AudioUnit/AudioUnitTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/monotouch-test/AudioUnit/AudioUnitTest.cs b/tests/monotouch-test/AudioUnit/AudioUnitTest.cs index 3471c104e88e..5827f4b50d03 100644 --- a/tests/monotouch-test/AudioUnit/AudioUnitTest.cs +++ b/tests/monotouch-test/AudioUnit/AudioUnitTest.cs @@ -84,7 +84,7 @@ public void CopyIconTest () } [Test] - public unsafe void TestSizeOf() + public unsafe void TestSizeOf () { Assert.AreEqual (sizeof (AudioFormat), Marshal.SizeOf (typeof (AudioFormat))); Assert.AreEqual (sizeof (AudioValueRange), Marshal.SizeOf (typeof (AudioValueRange)));