-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Convert powershell/PowerShell-Windows-CI to GitHub Actions #24899
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
TravisEz13
merged 64 commits into
master
from
convert-powershell-convert-forconversion-windows-ci-to-actions-20250129-195141
Jan 31, 2025
Merged
Changes from all commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
7e83718
Add workflow powershell/Convert/ForConversion-Windows-CI
TravisEz13 306cfa1
Add composite action tools_releaseBuild_azureDevOps_templates_insert_…
TravisEz13 c3991de
Add composite action pipelines_templates_insert_nuget_config_azfeed
TravisEz13 1b1c38c
Add reusable workflow vsts_ci_templates_ci_build
TravisEz13 d42ffd4
Add reusable workflow vsts_ci_templates_windows_test
TravisEz13 ed2bd8b
Add reusable workflow vsts_ci_templates_verify_xunit
TravisEz13 4fef408
Rename and update Windows CI workflow
TravisEz13 11dae80
Update .github/workflows/windows-ci.yml
TravisEz13 a0acfb8
Update .github/workflows/windows-ci.yml
TravisEz13 05158fc
Update .github/actions/tools_releasebuild_azuredevops_templates_inser…
TravisEz13 fd3fc29
Update .github/actions/pipelines_templates_insert_nuget_config_azfeed…
TravisEz13 e900566
Update .github/workflows/vsts_ci_templates_verify_xunit.yml
TravisEz13 7464980
Update .github/workflows/vsts_ci_templates_windows_test.yml
TravisEz13 912f9cd
update templates
TravisEz13 b317017
Cleanup workflow
TravisEz13 8463238
translate workflows to composite actions
TravisEz13 1986b3a
move checkout before using composite actions
TravisEz13 d489c6e
Use upload action
TravisEz13 2e9d794
make the first line of each task indicate what the task does
TravisEz13 a747f40
fix the job name
TravisEz13 858da9f
create the artifact folder
TravisEz13 f27efac
remove use of github token
TravisEz13 041707e
add runname
TravisEz13 52b2b76
fix copy
TravisEz13 7b45615
switch to the github download action
TravisEz13 12a5686
reduce verbose writes
TravisEz13 ccfd7fb
remove dead code
TravisEz13 f2aa59b
fix capitalization
TravisEz13 eb0123c
publish the test results
TravisEz13 b24e5f5
Only publish test results as an artifact
TravisEz13 bf8d948
Add test reporter
TravisEz13 5360a8c
filter captures
TravisEz13 a452a80
delete rebase workflow
TravisEz13 54b785c
assign prs
TravisEz13 9f5a3b6
use the version of test-reporter from main
TravisEz13 34df279
revert this: comment out long test runs
TravisEz13 aeecb6b
skip test tools build for experimental feature testing
TravisEz13 c402163
add ignores
TravisEz13 cae902c
switch to junit
TravisEz13 1a32921
use junit
TravisEz13 e6895c0
Add logging
TravisEz13 784636d
Produce crtf json
TravisEz13 da5e07b
fix elevated path
TravisEz13 95fe4a9
fix path
TravisEz13 739cc78
correct ctrf path
TravisEz13 cbf89ef
fix path separators
TravisEz13 d586ea2
make sure all refs to the .ctrf folder are actually the same
TravisEz13 819edc4
fix variable
TravisEz13 bf34b56
try to fix paths
TravisEz13 d1d214c
github-test-reporter only takes / as directory separators
TravisEz13 5d8dcca
remove unused workflow
TravisEz13 74a42dc
make it fail on failure
TravisEz13 5d179da
run unelevated tests too
TravisEz13 06b838a
update report format
TravisEz13 a96a570
try ai report
TravisEz13 96fb1e5
update report format
TravisEz13 1cd3922
Update .github/actions/build/ci/action.yml
TravisEz13 4907db0
Delete .github/actions/tools_releasebuild_azuredevops_templates_inser…
TravisEz13 d4fe4d4
Delete .github/actions/pipelines_templates_insert_nuget_config_azfeed…
TravisEz13 45d4f78
Delete results2.xml
TravisEz13 34d52c9
Delete results.xml
TravisEz13 f2e9acc
Update .gitignore
TravisEz13 056b194
Update .gitignore
TravisEz13 6e0678a
Merge branch 'master' into convert-powershell-convert-forconversion-w…
TravisEz13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: CI Build | ||
| description: 'Builds PowerShell' | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Capture Environment | ||
| if: success() || failure() | ||
| run: 'Get-ChildItem -Path env: | Out-String -width 9999 -Stream | write-Verbose -Verbose' | ||
| shell: pwsh | ||
| - name: Set Build Name for Non-PR | ||
| if: github.event_name != 'PullRequest' | ||
| run: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))" | ||
| shell: pwsh | ||
| - name: Bootstrap | ||
| if: success() | ||
| run: |- | ||
| Write-Verbose -Verbose "Running Bootstrap..." | ||
| Import-Module .\tools\ci.psm1 | ||
| Invoke-CIInstall -SkipUser | ||
| Write-Verbose -Verbose "Start Sync-PSTags" | ||
| Sync-PSTags -AddRemoteIfMissing | ||
| Write-Verbose -Verbose "End Sync-PSTags" | ||
| shell: pwsh | ||
| - name: Build | ||
| if: success() | ||
| run: |- | ||
| Write-Verbose -Verbose "Running Build..." | ||
| Import-Module .\tools\ci.psm1 | ||
| Invoke-CIBuild | ||
| shell: pwsh | ||
| - name: xUnit Tests | ||
| if: success() | ||
| continue-on-error: true | ||
| run: |- | ||
| Write-Verbose -Verbose "Running xUnit tests..." | ||
| Import-Module .\tools\ci.psm1 | ||
| Restore-PSOptions | ||
| Invoke-CIxUnit -SkipFailing | ||
| shell: pwsh | ||
| - name: Upload build artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: build | ||
| path: ${{ runner.workspace }}/build | ||
| - name: Upload xunit artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: testResults-xunit | ||
| path: ${{ runner.workspace }}/xunit |
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,21 @@ | ||
| name: verify_xunit | ||
| description: 'Verify xUnit Results' | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Download build artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: "${{ github.workspace }}" | ||
| - name: Capture artifacts directory | ||
| continue-on-error: true | ||
| run: dir "${{ github.workspace }}\testResults-xunit\*" -Recurse | ||
| shell: pwsh | ||
| - name: Test | ||
| if: success() | ||
| run: |- | ||
| Import-Module .\tools\ci.psm1 | ||
| $xUnitTestResultsFile = "${{ github.workspace }}\testResults-xunit\xUnitTestResults.xml" | ||
| Test-XUnitTestResults -TestResultsFile $xUnitTestResultsFile | ||
| shell: pwsh |
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,107 @@ | ||
| name: windows_test | ||
| description: 'Test PowerShell on Windows' | ||
|
|
||
| inputs: | ||
| purpose: | ||
| required: false | ||
| default: '' | ||
| type: string | ||
| tagSet: | ||
| required: false | ||
| default: CI | ||
| type: string | ||
| ctrfFolder: | ||
| required: false | ||
| default: ctrf | ||
| type: string | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Capture Environment | ||
| if: success() || failure() | ||
| run: 'Get-ChildItem -Path env: | Out-String -width 9999 -Stream | write-Verbose -Verbose' | ||
| shell: pwsh | ||
| - name: Download Build Artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: "${{ github.workspace }}" | ||
| - name: Capture Artifacts Directory | ||
| continue-on-error: true | ||
| run: Get-ChildItem "${{ github.workspace }}\build\*" -Recurse | ||
| shell: pwsh | ||
|
|
||
| - name: Bootstrap | ||
| shell: powershell | ||
| run: |- | ||
| # Remove "Program Files\dotnet" from the env variable PATH, so old SDKs won't affect us. | ||
| Write-Host "Old Path:" | ||
| Write-Host $env:Path | ||
| $dotnetPath = Join-Path $env:SystemDrive 'Program Files\dotnet' | ||
| $paths = $env:Path -split ";" | Where-Object { -not $_.StartsWith($dotnetPath) } | ||
| $env:Path = $paths -join ";" | ||
| Write-Host "New Path:" | ||
| Write-Host $env:Path | ||
| # Bootstrap | ||
| Import-Module .\tools\ci.psm1 | ||
| Invoke-CIInstall | ||
|
|
||
| - name: Test | ||
| if: success() | ||
| run: |- | ||
| Import-Module .\build.psm1 -force | ||
| Start-PSBootstrap | ||
| Import-Module .\tools\ci.psm1 | ||
| Restore-PSOptions -PSOptionsPath '${{ github.workspace }}\build\psoptions.json' | ||
| $options = (Get-PSOptions) | ||
| $path = split-path -path $options.Output | ||
| $rootPath = split-Path -path $path | ||
| Expand-Archive -Path '${{ github.workspace }}\build\build.zip' -DestinationPath $rootPath -Force | ||
| Invoke-CITest -Purpose '${{ inputs.purpose }}' -TagSet '${{ inputs.tagSet }}' -OutputFormat JUnitXml | ||
| shell: pwsh | ||
|
|
||
| - name: Convert JUnit to CTRF | ||
| run: |- | ||
| Get-ChildItem -Path "${{ runner.workspace }}/testResults/*.xml" -Recurse | ForEach-Object { | ||
| npx --yes junit-to-ctrf $_.FullName --output .\${{ inputs.ctrfFolder }}\$($_.BaseName).json --tool Pester --env 'Windows ${{ inputs.purpose }} ${{ inputs.tagSet }}' | ||
| } | ||
| shell: powershell | ||
|
|
||
| # this task only takes / as directory separators | ||
| - name: Publish Test Report | ||
| uses: ctrf-io/github-test-reporter@v1 | ||
| with: | ||
| report-path: './${{ inputs.ctrfFolder }}/*.json' | ||
| exit-on-fail: true | ||
| summary-report: true | ||
| test-report: false | ||
| test-list-report: false | ||
| failed-report: false | ||
| fail-rate-report: false | ||
| flaky-report: false | ||
| flaky-rate-report: false | ||
| failed-folded-report: true | ||
| previous-results-report: false | ||
| ai-report: true | ||
| skipped-report: false | ||
| suite-folded-report: false | ||
| suite-list-report: false | ||
| pull-request-report: false | ||
| commit-report: false | ||
| custom-report: false | ||
|
|
||
| if: always() | ||
|
|
||
| - name: Upload testResults artifact | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: junit-pester-${{ inputs.purpose }}-${{ inputs.tagSet }} | ||
| path: ${{ runner.workspace }}\testResults | ||
|
|
||
| - name: Upload ctrf artifact | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ctrf-pester-${{ inputs.purpose }}-${{ inputs.tagSet }} | ||
| path: ${{ inputs.ctrfFolder }} |
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 was deleted.
Oops, something went wrong.
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,124 @@ | ||
| name: Windows-CI | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - master | ||
| - release* | ||
| - feature* | ||
| paths: | ||
| - "*" | ||
| - "!.vsts-ci/misc-analysis.yml" | ||
| - "!.github/ISSUE_TEMPLATE/*" | ||
| - "!.github/workflows/*" | ||
| - "!.dependabot/config.yml" | ||
| - "!test/perf/*" | ||
| - "!.pipelines/*" | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| - release* | ||
| - feature* | ||
| paths: | ||
| - ".vsts-ci/templates/*" | ||
| - ".vsts-ci/windows.yml" | ||
| - "*.props" | ||
| - build.psm1 | ||
| - src/* | ||
| - test/* | ||
| - tools/buildCommon/* | ||
| - tools/ci.psm1 | ||
| - tools/WindowsCI.psm1 | ||
| - "!test/common/markdown/*" | ||
| - "!test/perf/*" | ||
| permissions: | ||
| contents: read | ||
|
|
||
| run-name: "${{ github.ref_name }} - ${{ github.run_number }}" | ||
|
|
||
| env: | ||
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | ||
| GIT_CONFIG_PARAMETERS: "'core.autocrlf=false'" | ||
| NugetSecurityAnalysisWarningLevel: none | ||
| POWERSHELL_TELEMETRY_OPTOUT: 1 | ||
| __SuppressAnsiEscapeSequences: 1 | ||
| nugetMultiFeedWarnLevel: none | ||
| jobs: | ||
| ci_build: | ||
| name: Build PowerShell | ||
| runs-on: windows-latest | ||
| steps: | ||
| - name: checkout | ||
| uses: actions/checkout@v4.1.0 | ||
| with: | ||
| fetch-depth: 1000 | ||
| - name: Build | ||
| uses: "./.github/actions/build/ci" | ||
| windows_test: | ||
| name: Windows Unelevated CI | ||
| needs: ci_build | ||
| runs-on: windows-latest | ||
| steps: | ||
| - name: checkout | ||
| uses: actions/checkout@v4.1.0 | ||
| with: | ||
| fetch-depth: 1000 | ||
| - name: Windows Unelevated CI | ||
| uses: "./.github/actions/test/windows" | ||
| with: | ||
| purpose: UnelevatedPesterTests | ||
| tagSet: CI | ||
| windows_test_2: | ||
| name: Windows Elevated CI | ||
| needs: ci_build | ||
| runs-on: windows-latest | ||
| steps: | ||
| - name: checkout | ||
| uses: actions/checkout@v4.1.0 | ||
| with: | ||
| fetch-depth: 1000 | ||
| - name: Windows Elevated CI | ||
| uses: "./.github/actions/test/windows" | ||
| with: | ||
| purpose: ElevatedPesterTests | ||
| tagSet: CI | ||
| windows_test_3: | ||
| name: Windows Unelevated Others | ||
| needs: ci_build | ||
| runs-on: windows-latest | ||
| steps: | ||
| - name: checkout | ||
| uses: actions/checkout@v4.1.0 | ||
| with: | ||
| fetch-depth: 1000 | ||
| - name: Windows Unelevated Others | ||
| uses: "./.github/actions/test/windows" | ||
| with: | ||
| purpose: UnelevatedPesterTests | ||
| tagSet: Others | ||
| windows_test_4: | ||
| name: Windows Elevated Others | ||
| needs: ci_build | ||
| runs-on: windows-latest | ||
| steps: | ||
| - name: checkout | ||
| uses: actions/checkout@v4.1.0 | ||
| with: | ||
| fetch-depth: 1000 | ||
| - name: Windows Elevated Others | ||
| uses: "./.github/actions/test/windows" | ||
| with: | ||
| purpose: ElevatedPesterTests | ||
| tagSet: Others | ||
| verify_xunit: | ||
| name: Verify xUnit test results | ||
| needs: ci_build | ||
| runs-on: windows-latest | ||
| steps: | ||
| - name: checkout | ||
| uses: actions/checkout@v4.1.0 | ||
| with: | ||
| fetch-depth: 1000 | ||
| - name: Verify xUnit test results | ||
| uses: "./.github/actions/test/verify_xunit" |
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
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.
Uh oh!
There was an error while loading. Please reload this page.