mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Refactor: Centralize xUnit tests into reusable workflow and remove legacy verification (#26243)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
This commit is contained in:
@@ -147,20 +147,15 @@ jobs:
|
||||
with:
|
||||
purpose: ElevatedPesterTests
|
||||
tagSet: Others
|
||||
verify_xunit:
|
||||
name: Verify xUnit test results
|
||||
xunit_tests:
|
||||
name: xUnit Tests
|
||||
needs:
|
||||
- ci_build
|
||||
- changes
|
||||
if: ${{ needs.changes.outputs.source == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 1000
|
||||
- name: Verify xUnit test results
|
||||
uses: "./.github/actions/test/verify_xunit"
|
||||
uses: ./.github/workflows/xunit-tests.yml
|
||||
with:
|
||||
runner_os: ubuntu-latest
|
||||
test_results_artifact_name: testResults-xunit
|
||||
|
||||
analyze:
|
||||
permissions:
|
||||
@@ -224,7 +219,7 @@ jobs:
|
||||
ready_to_merge:
|
||||
name: Linux ready to merge
|
||||
needs:
|
||||
- verify_xunit
|
||||
- xunit_tests
|
||||
- linux_test_elevated_ci
|
||||
- linux_test_elevated_others
|
||||
- linux_test_unelevated_ci
|
||||
|
||||
@@ -143,20 +143,15 @@ jobs:
|
||||
with:
|
||||
purpose: ElevatedPesterTests
|
||||
tagSet: Others
|
||||
verify_xunit:
|
||||
name: Verify xUnit test results
|
||||
xunit_tests:
|
||||
name: xUnit Tests
|
||||
needs:
|
||||
- ci_build
|
||||
- changes
|
||||
if: ${{ needs.changes.outputs.source == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 1000
|
||||
- name: Verify xUnit test results
|
||||
uses: "./.github/actions/test/verify_xunit"
|
||||
uses: ./.github/workflows/xunit-tests.yml
|
||||
with:
|
||||
runner_os: macos-15-large
|
||||
test_results_artifact_name: testResults-xunit
|
||||
PackageMac-macos_packaging:
|
||||
name: macOS packaging (bootstrap only)
|
||||
needs:
|
||||
@@ -176,7 +171,7 @@ jobs:
|
||||
ready_to_merge:
|
||||
name: macos ready to merge
|
||||
needs:
|
||||
- verify_xunit
|
||||
- xunit_tests
|
||||
- PackageMac-macos_packaging
|
||||
- macos_test_elevated_ci
|
||||
- macos_test_elevated_others
|
||||
|
||||
@@ -147,20 +147,15 @@ jobs:
|
||||
with:
|
||||
purpose: ElevatedPesterTests
|
||||
tagSet: Others
|
||||
verify_xunit:
|
||||
name: Verify xUnit test results
|
||||
xunit_tests:
|
||||
name: xUnit Tests
|
||||
needs:
|
||||
- ci_build
|
||||
- changes
|
||||
if: ${{ needs.changes.outputs.source == 'true' }}
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 1000
|
||||
- name: Verify xUnit test results
|
||||
uses: "./.github/actions/test/verify_xunit"
|
||||
uses: ./.github/workflows/xunit-tests.yml
|
||||
with:
|
||||
runner_os: windows-latest
|
||||
test_results_artifact_name: testResults-xunit
|
||||
windows_packaging:
|
||||
name: Windows Packaging
|
||||
needs:
|
||||
@@ -170,7 +165,7 @@ jobs:
|
||||
ready_to_merge:
|
||||
name: windows ready to merge
|
||||
needs:
|
||||
- verify_xunit
|
||||
- xunit_tests
|
||||
- windows_test_elevated_ci
|
||||
- windows_test_elevated_others
|
||||
- windows_test_unelevated_ci
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
name: xUnit Tests (Reusable)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
runner_os:
|
||||
description: 'Runner OS for xUnit tests'
|
||||
type: string
|
||||
required: false
|
||||
default: ubuntu-latest
|
||||
test_results_artifact_name:
|
||||
description: 'Artifact name for xUnit test results directory'
|
||||
type: string
|
||||
required: false
|
||||
default: testResults-xunit
|
||||
|
||||
jobs:
|
||||
xunit:
|
||||
name: Run xUnit Tests
|
||||
runs-on: ${{ inputs.runner_os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1000
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
global-json-file: ./global.json
|
||||
|
||||
- name: Bootstrap
|
||||
shell: pwsh
|
||||
run: |
|
||||
Import-Module ./tools/ci.psm1
|
||||
Invoke-CIInstall -SkipUser
|
||||
Sync-PSTags -AddRemoteIfMissing
|
||||
|
||||
- name: Build PowerShell and run xUnit tests
|
||||
shell: pwsh
|
||||
run: |
|
||||
Import-Module ./tools/ci.psm1
|
||||
Start-PSBuild
|
||||
Write-Host "Running full xUnit test suite (no skipping)..."
|
||||
Invoke-CIxUnit
|
||||
Write-Host "Completed xUnit test run."
|
||||
|
||||
- name: Upload xUnit results
|
||||
uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: ${{ inputs.test_results_artifact_name }}
|
||||
path: ${{ github.workspace }}/xUnitTestResults.xml
|
||||
Reference in New Issue
Block a user