-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Refactor macOS CI so that tests run in parallel #9056
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2bd6add
remove curl for mac in build.psm1
TravisEz13 bf1a6b8
Refactor ci.psm1 to allow mac CI to use existing cmdlets - mac.yml
TravisEz13 600d632
Refactor ci.psm1 to allow mac CI to use existing cmdlets - ci.psm1
TravisEz13 b74985d
Rename Invoke-BootstrapStage - linux.yml
TravisEz13 cdd57f1
Use PowerShell Core - windows-test.yml
TravisEz13 0cb3db4
make generic build, and rename to ci-build.yml
TravisEz13 6a5d700
update windows.yml for ci-build.yml rename
TravisEz13 6229b0f
Refactor non-windows testing into nix-test.yml
TravisEz13 3b766e4
Split out WindowsCI.psm1
TravisEz13 c0d1788
Add copyright header
TravisEz13 cf9fdb7
Change from using alias `dir` to command `Get-ChildItem`
TravisEz13 2bd7399
Remove debug comments
TravisEz13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| parameters: | ||
| pool: 'Hosted macOS' | ||
| parentJobs: [] | ||
| purpose: '' | ||
| tagSet: 'CI' | ||
| name: 'mac' | ||
|
|
||
| jobs: | ||
| - job: ${{ parameters.name }}_test_${{ parameters.purpose }}_${{ parameters.tagSet }} | ||
| dependsOn: | ||
| ${{ parameters.parentJobs }} | ||
| pool: | ||
| name: ${{ parameters.pool }} | ||
|
|
||
| displayName: ${{ parameters.name }} Test - ${{ parameters.purpose }} - ${{ parameters.tagSet }} | ||
|
|
||
| steps: | ||
| - pwsh: | | ||
| Get-ChildItem -Path env: | ||
| displayName: Capture environment | ||
| condition: succeededOrFailed() | ||
|
|
||
| - task: DownloadBuildArtifacts@0 | ||
| displayName: 'Download build artifacts' | ||
| inputs: | ||
| downloadType: specific | ||
| itemPattern: | | ||
| build/**/* | ||
| downloadPath: '$(System.ArtifactsDirectory)' | ||
|
|
||
| - pwsh: | | ||
| Get-ChildItem "$(System.ArtifactsDirectory)\*" -Recurse | ||
| displayName: 'Capture artifacts directory' | ||
| continueOnError: true | ||
|
|
||
| - pwsh: | | ||
| Import-Module .\tools\ci.psm1 | ||
| Invoke-CIInstall -SkipUser | ||
| displayName: Bootstrap | ||
| condition: succeededOrFailed() | ||
|
|
||
| - task: ExtractFiles@1 | ||
| displayName: 'Extract build zip' | ||
| inputs: | ||
| archiveFilePatterns: '$(System.ArtifactsDirectory)/build/build.zip' | ||
| destinationFolder: '$(System.ArtifactsDirectory)/bins' | ||
|
|
||
| - bash: | | ||
| find "$(System.ArtifactsDirectory)/bins" -type d -exec chmod +rwx {} \; | ||
| find "$(System.ArtifactsDirectory)/bins" -type f -exec chmod +rw {} \; | ||
| displayName: 'Fix permissions' | ||
| continueOnError: true | ||
|
|
||
| - pwsh: | | ||
| Get-ChildItem "$(System.ArtifactsDirectory)\bins\*" -Recurse -ErrorAction SilentlyContinue | ||
| displayName: 'Capture extracted build zip' | ||
| continueOnError: true | ||
|
|
||
| - pwsh: | | ||
| Import-Module .\tools\ci.psm1 | ||
| Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json' | ||
| $options = (Get-PSOptions) | ||
| $rootPath = '$(System.ArtifactsDirectory)\bins' | ||
| $originalRootPath = Split-Path -path $options.Output | ||
| $path = Join-Path -path $rootPath -ChildPath (split-path -leaf -path $originalRootPath) | ||
| $pwshPath = Join-Path -path $path -ChildPath 'pwsh' | ||
| chmod a+x $pwshPath | ||
| $options.Output = $pwshPath | ||
| Set-PSOptions $options | ||
| Invoke-CITest -Purpose '${{ parameters.purpose }}' -TagSet '${{ parameters.tagSet }}' | ||
| displayName: Test | ||
| condition: succeeded() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| if($PSVersionTable.PSEdition -ne 'Desktop') | ||
| { | ||
| throw 'Must be run from Windows PowerShell' | ||
| } | ||
|
|
||
| function New-LocalUser | ||
| { | ||
| <# | ||
| .SYNOPSIS | ||
| Creates a local user with the specified username and password | ||
| .DESCRIPTION | ||
| .EXAMPLE | ||
| .PARAMETER | ||
| username Username of the user which will be created | ||
| .PARAMETER | ||
| password Password of the user which will be created | ||
| .OUTPUTS | ||
| .NOTES | ||
| #> | ||
| param( | ||
| [Parameter(Mandatory=$true)] | ||
| [string] $username, | ||
|
|
||
| [Parameter(Mandatory=$true)] | ||
| [string] $password | ||
|
|
||
| ) | ||
| $LocalComputer = [ADSI] "WinNT://$env:computername"; | ||
| $user = $LocalComputer.Create('user', $username); | ||
| $user.SetPassword($password) | out-null; | ||
| $user.SetInfo() | out-null; | ||
| } | ||
|
|
||
| <# | ||
| Converts SID to NT Account Name | ||
| #> | ||
| function ConvertTo-NtAccount | ||
| { | ||
| param( | ||
| [Parameter(Mandatory=$true)] | ||
| [string] $sid | ||
| ) | ||
| (new-object System.Security.Principal.SecurityIdentifier($sid)).translate([System.Security.Principal.NTAccount]).Value | ||
| } | ||
|
|
||
| <# | ||
| Add a user to a local security group | ||
| Requires Windows PowerShell | ||
| #> | ||
| function Add-UserToGroup | ||
| { | ||
| param( | ||
| [Parameter(Mandatory=$true)] | ||
| [string] $username, | ||
|
|
||
| [Parameter(Mandatory=$true, ParameterSetName = "SID")] | ||
| [string] $groupSid, | ||
|
|
||
| [Parameter(Mandatory=$true, ParameterSetName = "Name")] | ||
| [string] $group | ||
| ) | ||
|
|
||
| $userAD = [ADSI] "WinNT://$env:computername/${username},user" | ||
|
|
||
| if($PsCmdlet.ParameterSetName -eq "SID") | ||
| { | ||
| $ntAccount=ConvertTo-NtAccount $groupSid | ||
| $group =$ntAccount.Split("\\")[1] | ||
| } | ||
|
|
||
| $groupAD = [ADSI] "WinNT://$env:computername/${group},group" | ||
|
|
||
| $groupAD.Add($userAD.AdsPath); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is code that other that this imperative code to protect against loading in PowerShell core was just moved from CI.psm1