diff options
author | Michael Cummings (MSFT) <mcumming@microsoft.com> | 2020-03-04 21:10:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-04 21:10:04 +0300 |
commit | a0c462272967fdb5e243c7886a79f3c3c581b336 (patch) | |
tree | cc38015a77330bbce1febae1f95d19d226ce415a | |
parent | 0e51c67be41477380e5c9cbc56000b6460cc7383 (diff) | |
parent | 942af609cb8fbc7f00e6cfcbd940b77630dc0afb (diff) |
Merge pull request #710 from xamarin/loc_handoff_automation
Adding Azure DevOps YAML build file
-rw-r--r-- | .github/workflows/localization-pr.yml | 17 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | azure-pipelines.yaml | 114 | ||||
-rw-r--r-- | build.proj | 6 | ||||
-rw-r--r-- | build/Localization.targets | 63 |
5 files changed, 133 insertions, 71 deletions
diff --git a/.github/workflows/localization-pr.yml b/.github/workflows/localization-pr.yml new file mode 100644 index 0000000..7aa9302 --- /dev/null +++ b/.github/workflows/localization-pr.yml @@ -0,0 +1,17 @@ +name: Localization-CI + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Create PR + uses: funivan/github-autopr@0.2.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: .ref refs/heads/loc -vv
\ No newline at end of file @@ -1,2 +1,2 @@ -Build Status -[![Build status](https://devdiv.visualstudio.com/DevDiv/_apis/build/status/Xamarin/Proppy/Xamarin.PropertyEditing.Mac)](https://devdiv.visualstudio.com/DevDiv/_build/latest?definitionId=5330) +### Build Status +[![Build Status](https://dev.azure.com/xamarin/public/_apis/build/status/xamarin/Xamarin.PropertyEditing/Xamarin.PropertyEditing%20(Public)?branchName=master)](https://dev.azure.com/xamarin/public/_build/latest?definitionId=51&branchName=master)
\ No newline at end of file diff --git a/azure-pipelines.yaml b/azure-pipelines.yaml new file mode 100644 index 0000000..9e984ad --- /dev/null +++ b/azure-pipelines.yaml @@ -0,0 +1,114 @@ +name: $(BuildID) + +trigger: + branches: + include: [ master, d16-* ] +pr: + branches: + include: [ master, d16-* ] + +resources: + repositories: + - repository: self + +stages: + - stage: Windows + dependsOn: [] + jobs: + - job: 'Build' + pool: + vmImage: 'windows-latest' + + steps: + - checkout: self + clean: true + persistCredentials: true + + - task: MSBuild@1 + displayName: Build + inputs: + solution: build.proj + msbuildVersion: "15.0" + msbuildArguments: '/restore /p:Release=true /t:Build' + + - task: MSBuild@1 + displayName: 'Run Tests' + inputs: + solution: build.proj + msbuildVersion: "15.0" + msbuildArguments: '/p:Release=true /t:Test' + + - task: PublishTestResults@2 + displayName: 'Publish Test Results' + inputs: + testResultsFormat: NUnit + testResultsFiles: '**/TestResult.xml' + condition: succeededOrFailed() + + - stage: Mac + dependsOn: [] + jobs: + - job: 'Build' + pool: + vmImage: 'macOS-latest' + + steps: + - checkout: self + clean: true + persistCredentials: true + + - task: NuGetAuthenticate@0 + + - task: CmdLine@1 + displayName: 'Set Token' + inputs: + filename: echo + arguments: '##vso[task.setvariable variable=GITHUB_TOKEN]$(GitHub.Token)' + - task: MSBuild@1 + displayName: Build + inputs: + solution: build.proj + msbuildVersion: "15.0" + msbuildArguments: '/restore /p:Release=true /t:Build' + + - task: MSBuild@1 + displayName: 'Run Tests' + inputs: + solution: build.proj + msbuildVersion: "15.0" + msbuildArguments: '/p:Release=true /t:Test' + + - task: PublishTestResults@2 + displayName: 'Publish Test Results' + inputs: + testResultsFormat: NUnit + testResultsFiles: '**/TestResult.xml' + condition: succeededOrFailed() + + - stage: UpdateTranslations + dependsOn: ['Windows', 'Mac'] + condition: and( succeeded(), and( eq(variables['Build.Reason'], 'PullRequest'), eq( variables['System.PullRequest.SourceBranch'], 'loc') ) ) + jobs: + - job : 'ValidateAndMerge' + variables: + pull_request_number: $(System.PullRequest.PullRequestNumber) + steps: + - powershell: | + Write-Host "Validating translations for PR# $(System.PullRequest.PullRequestNumber)" + $matches = Get-ChildItem -recurse -Path $(Build.SourcesDirectory) -Filter *.resx | Select-String -Pattern '\[.*\]\s\(https:.*\)' -AllMatches + $matchCount = ($matches | Measure-Object -Line).Lines + Write-Host "Found $matchCount violations." + $matches | Write-Host + if( ($matches | Measure-Object -Line).Lines -eq 0 ) { + Write-Host "Quality Gate Succeeded." + } else { + throw "Quality Gate Failure : Check the logs for details." + } + displayName: 'Validate Markdown Urls' + - task: github-merge-pr@1 + inputs: + github_token: $(GitHub.Token) + repository: 'xamarin/Xamarin.PropertyEditing' + pr_number: $(pull_request_number) + merge_method: 'merge' + displayName: Merge PR# $(System.PullRequest.PullRequestNumber) @@ -3,7 +3,6 @@ <PropertyGroup> <BuildDir>build\</BuildDir> - <LocalizationSln>$(BuildDir)Localization.targets</LocalizationSln> </PropertyGroup> <!-- Set up some basic properties to control the build configuration --> @@ -76,9 +75,4 @@ <Target Name="TestWindows" Condition=" '$(IsWindows)' "> </Target> - <Target Name="UpdateLocalizations"> - <MSBuild Projects="$(LocalizationSln)" Targets="Restore" Properties="RestoreOnly=true"/> - <MSBuild Projects="$(LocalizationSln)" /> - </Target> - </Project> diff --git a/build/Localization.targets b/build/Localization.targets deleted file mode 100644 index 5d5b8a6..0000000 --- a/build/Localization.targets +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="UpdateTranslations" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - - <Import Project="corebuild.props" /> - - <PropertyGroup> - <RestorePackagesPath>$(MSBuildThisFileDirectory)packages\</RestorePackagesPath> - <TDTeamId>329</TDTeamId> - <TDClientID>443ffc71-4ea5-43d7-bbcc-7ec37758c83b</TDClientID> - <TDAppKey>42664164ca0640e3b1a5fefb68d13f57</TDAppKey> - <TranslatedFilesDirectory>langs\</TranslatedFilesDirectory> - <TDPackageVersion>1.0.1.9</TDPackageVersion> - </PropertyGroup> - - <ItemGroup> - <InputTranslations Include="..\Xamarin.PropertyEditing\Properties\Resources.resx" /> - </ItemGroup> - - <UsingTask TaskName="MS.Internal.Touchdown.Build.Tasks.GetLocResources" AssemblyFile="$(RestorePackagesPath)MS.Internal.Touchdown.Build.Tasks\$(TDPackageVersion)\tools\MS.Internal.Touchdown.Build.Tasks.dll" /> - - <ItemGroup> - <PackageReference Include="MS.Internal.Touchdown.Build.Tasks" Version="$(TDPackageVersion)" /> - </ItemGroup> - - <Target Name="UpdateTranslations"> - <ItemGroup> - <InputTranslationsWithMetadata Include="@(InputTranslations)"> - <ContainingDirectory>$([System.IO.Path]::GetDirectoryName('%(FullPath)'))\</ContainingDirectory> - <!-- Walk up 1 directory *above* the place which contains the csproj - The 'relative path' will now look like 'Xamarin.Designer/Resources/Translations.resx' which - means all our 'relative paths' will be unique when we upload to the translation service --> - <ProjectDir>$([System.IO.Directory]::GetParent('%(FullPath)').Parent.FullName)\</ProjectDir> - </InputTranslationsWithMetadata> - </ItemGroup> - - <MakeDir Directories="%(InputTranslationsWithMetadata.ContainingDirectory)$(TranslatedFilesDirectory)" /> - - <GetLocResources - Files="%(InputTranslationsWithMetadata.FullPath)" - OutputPath="%(InputTranslationsWithMetadata.ContainingDirectory)$(TranslatedFilesDirectory)" - ProjectDir="%(InputTranslationsWithMetadata.ProjectDir)" - TeamId="$(TDTeamId)" - ClientID="$(TDClientID)" - AppKey="$(TDAppKey)" - TraceEnabled="True" /> - <ItemGroup> - <Translations Include="..\**\$(TranslatedFilesDirectory)**\*.resx" /> - <TranslationsWithMetadata Include="@(Translations)"> - <!-- The path looks like 'langs/en-GB/Translations.resx'. We want the 'en-GB' part --> - <Lang>$([System.IO.Path]::GetFileName('$([System.IO.Path]::GetDirectoryName('%(FullPath)'))'))</Lang> - <!-- Walk up three levels in the directory hierarchy so we can place these files beside the original --> - <ContainingDirectory>$([System.IO.Directory]::GetParent('%(FullPath)').Parent.Parent.FullName)\</ContainingDirectory> - </TranslationsWithMetadata> - - </ItemGroup> - - <Copy SourceFiles="@(TranslationsWithMetadata)" DestinationFiles="%(ContainingDirectory)%(FileName).%(Lang)%(Extension)" /> - <RemoveDir Directories="%(InputTranslationsWithMetadata.ContainingDirectory)$(TranslatedFilesDirectory)" /> - - </Target> - - <Import Project="$(BuildDir)corebuild.targets" /> -</Project> |