Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16-7] codeflow from master #716

Merged
merged 7 commits into from Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/localization-pr.yml
@@ -0,0 +1,20 @@
name: Localization-CI

on:
push:
branches:
- loc

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
4 changes: 2 additions & 2 deletions README.md
@@ -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)
@@ -1,4 +1,6 @@
using System;
using System.Diagnostics;

using AppKit;
using Foundation;

Expand All @@ -8,39 +10,37 @@ internal class PopoverFocusRestoreDelegate : NSPopoverDelegate
{
static readonly NSString key = new NSString ("firstResponder");

private bool ignore;
private NSResponder prevFirstResponder;
private NSWindow window;

public PopoverFocusRestoreDelegate ()
{
}

public override void DidShow (NSNotification notification)
{
this.ignore = false;
var window = ((NSPopover)notification.Object).ContentViewController.View.Window;
Debug.Assert (window == null);
this.window = ((NSPopover)notification.Object).ContentViewController.View.Window;

if (this.prevFirstResponder != null) {
if (this.prevFirstResponder != null)
window.MakeFirstResponder (this.prevFirstResponder);
} else {
window.AddObserver (this, key, NSKeyValueObservingOptions.Initial | NSKeyValueObservingOptions.New, IntPtr.Zero);
}

window.AddObserver (this, key, NSKeyValueObservingOptions.Initial | NSKeyValueObservingOptions.New, IntPtr.Zero);
}

public override void WillClose (NSNotification notification)
{
this.ignore = true;
window.RemoveObserver (this, key);
window = null;
}

public override void ObserveValue (NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context)
{
var window = ofObject as NSWindow;
if (window != null && keyPath == key) {
if (!ignore) {
var firstResponder = change [ChangeNewKey] as NSResponder;
if (firstResponder != null && !(firstResponder is NSWindow) && (!(firstResponder is NSView view) || view.Window == window))
this.prevFirstResponder = ResolveResponder (firstResponder);
}
var firstResponder = change [ChangeNewKey] as NSResponder;
if (firstResponder != null && !(firstResponder is NSWindow) && (!(firstResponder is NSView view) || view.Window == window))
this.prevFirstResponder = ResolveResponder (firstResponder);
} else {
base.ObserveValue (keyPath, ofObject, change, context);
}
Expand Down
114 changes: 114 additions & 0 deletions 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)
6 changes: 0 additions & 6 deletions build.proj
Expand Up @@ -3,7 +3,6 @@

<PropertyGroup>
<BuildDir>build\</BuildDir>
<LocalizationSln>$(BuildDir)Localization.targets</LocalizationSln>
</PropertyGroup>

<!-- Set up some basic properties to control the build configuration -->
Expand Down Expand Up @@ -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>
63 changes: 0 additions & 63 deletions build/Localization.targets

This file was deleted.