mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
263 lines
7.9 KiB
YAML
263 lines
7.9 KiB
YAML
name: Linux-CI
|
|
|
|
run-name: "${{ github.ref_name }} - ${{ github.run_number }}"
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
branches:
|
|
- master
|
|
- release/**
|
|
- github-mirror
|
|
paths:
|
|
- "**"
|
|
- "*"
|
|
- ".globalconfig"
|
|
- "!.github/ISSUE_TEMPLATE/**"
|
|
- "!.dependabot/config.yml"
|
|
- "!.pipelines/**"
|
|
- "!test/perf/**"
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- release/**
|
|
- github-mirror
|
|
- "*-feature"
|
|
# Path filters for PRs need to go into the changes job
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ contains(github.ref, 'merge')}}
|
|
|
|
env:
|
|
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
|
DOTNET_NOLOGO: 1
|
|
FORCE_FEATURE: 'False'
|
|
FORCE_PACKAGE: 'False'
|
|
NUGET_KEY: none
|
|
POWERSHELL_TELEMETRY_OPTOUT: 1
|
|
__SuppressAnsiEscapeSequences: 1
|
|
nugetMultiFeedWarnLevel: none
|
|
system_debug: 'false'
|
|
jobs:
|
|
changes:
|
|
if: startsWith(github.repository_owner, 'azure') || github.repository_owner == 'PowerShell'
|
|
name: Change Detection
|
|
runs-on: ubuntu-latest
|
|
# Required permissions
|
|
permissions:
|
|
pull-requests: read
|
|
contents: read
|
|
|
|
# Set job outputs to values from filter step
|
|
outputs:
|
|
source: ${{ steps.filter.outputs.source }}
|
|
buildModuleChanged: ${{ steps.filter.outputs.buildModuleChanged }}
|
|
packagingChanged: ${{ steps.filter.outputs.packagingChanged }}
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Change Detection
|
|
id: filter
|
|
uses: "./.github/actions/infrastructure/path-filters"
|
|
with:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
merge_conflict_check:
|
|
name: Check for Merge Conflict Markers
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'pull_request' && (startsWith(github.repository_owner, 'azure') || github.repository_owner == 'PowerShell')
|
|
permissions:
|
|
pull-requests: read
|
|
contents: read
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Check for merge conflict markers
|
|
uses: "./.github/actions/infrastructure/merge-conflict-checker"
|
|
|
|
ci_build:
|
|
name: Build PowerShell
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.source == 'true' || needs.changes.outputs.buildModuleChanged == 'true' }}
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 1000
|
|
|
|
- name: Build
|
|
uses: "./.github/actions/build/ci"
|
|
linux_test_unelevated_ci:
|
|
name: Linux Unelevated CI
|
|
needs:
|
|
- ci_build
|
|
- changes
|
|
if: ${{ needs.changes.outputs.source == 'true' || needs.changes.outputs.buildModuleChanged == 'true' }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 1000
|
|
- name: Linux Unelevated CI
|
|
uses: "./.github/actions/test/nix"
|
|
with:
|
|
purpose: UnelevatedPesterTests
|
|
tagSet: CI
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
linux_test_elevated_ci:
|
|
name: Linux Elevated CI
|
|
needs:
|
|
- ci_build
|
|
- changes
|
|
if: ${{ needs.changes.outputs.source == 'true' || needs.changes.outputs.buildModuleChanged == 'true' }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 1000
|
|
- name: Linux Elevated CI
|
|
uses: "./.github/actions/test/nix"
|
|
with:
|
|
purpose: ElevatedPesterTests
|
|
tagSet: CI
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
linux_test_unelevated_others:
|
|
name: Linux Unelevated Others
|
|
needs:
|
|
- ci_build
|
|
- changes
|
|
if: ${{ needs.changes.outputs.source == 'true' || needs.changes.outputs.buildModuleChanged == 'true' }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 1000
|
|
- name: Linux Unelevated Others
|
|
uses: "./.github/actions/test/nix"
|
|
with:
|
|
purpose: UnelevatedPesterTests
|
|
tagSet: Others
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
linux_test_elevated_others:
|
|
name: Linux Elevated Others
|
|
needs:
|
|
- ci_build
|
|
- changes
|
|
if: ${{ needs.changes.outputs.source == 'true' || needs.changes.outputs.buildModuleChanged == 'true' }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 1000
|
|
- name: Linux Elevated Others
|
|
uses: "./.github/actions/test/nix"
|
|
with:
|
|
purpose: ElevatedPesterTests
|
|
tagSet: Others
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
xunit_tests:
|
|
name: xUnit Tests
|
|
needs:
|
|
- changes
|
|
if: ${{ needs.changes.outputs.source == 'true' || needs.changes.outputs.buildModuleChanged == 'true' }}
|
|
uses: ./.github/workflows/xunit-tests.yml
|
|
with:
|
|
runner_os: ubuntu-latest
|
|
test_results_artifact_name: testResults-xunit
|
|
|
|
infrastructure_tests:
|
|
name: Infrastructure Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Install Pester
|
|
shell: pwsh
|
|
run: |
|
|
Import-Module ./tools/ci.psm1
|
|
Install-CIPester
|
|
|
|
- name: Run Infrastructure Tests
|
|
shell: pwsh
|
|
run: |
|
|
$testResultsFolder = Join-Path $PWD "testResults"
|
|
New-Item -ItemType Directory -Path $testResultsFolder -Force | Out-Null
|
|
|
|
$config = New-PesterConfiguration
|
|
$config.Run.Path = './test/infrastructure/'
|
|
$config.Run.PassThru = $true
|
|
$config.TestResult.Enabled = $true
|
|
$config.TestResult.OutputFormat = 'NUnitXml'
|
|
$config.TestResult.OutputPath = "$testResultsFolder/InfrastructureTests.xml"
|
|
$config.Output.Verbosity = 'Detailed'
|
|
|
|
$result = Invoke-Pester -Configuration $config
|
|
|
|
if ($result.FailedCount -gt 0 -or $result.Result -eq 'Failed') {
|
|
throw "Infrastructure tests failed"
|
|
}
|
|
|
|
- name: Publish Test Results
|
|
uses: "./.github/actions/test/process-pester-results"
|
|
if: always()
|
|
with:
|
|
name: "InfrastructureTests"
|
|
testResultsFolder: "${{ github.workspace }}/testResults"
|
|
|
|
## Temporarily disable the CodeQL analysis on Linux as it doesn't work for .NET SDK 10-rc.2.
|
|
# analyze:
|
|
# name: CodeQL Analysis
|
|
# needs: changes
|
|
# if: ${{ needs.changes.outputs.source == 'true' }}
|
|
# uses: ./.github/workflows/analyze-reusable.yml
|
|
# permissions:
|
|
# actions: read
|
|
# contents: read
|
|
# security-events: write
|
|
# with:
|
|
linux_packaging:
|
|
name: Linux Packaging
|
|
needs:
|
|
- ci_build
|
|
- changes
|
|
if: ${{ needs.changes.outputs.packagingChanged == 'true' }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Linux Packaging
|
|
uses: "./.github/actions/test/linux-packaging"
|
|
|
|
ready_to_merge:
|
|
name: Linux ready to merge
|
|
needs:
|
|
- xunit_tests
|
|
- linux_test_elevated_ci
|
|
- linux_test_elevated_others
|
|
- linux_test_unelevated_ci
|
|
- linux_test_unelevated_others
|
|
- linux_packaging
|
|
- merge_conflict_check
|
|
- infrastructure_tests
|
|
# - analyze
|
|
if: always()
|
|
uses: PowerShell/compliance/.github/workflows/ready-to-merge.yml@c8b3ad5819ad7078f3e375519b4f8c6232d1cbdf # v1.0.0
|
|
with:
|
|
needs_context: ${{ toJson(needs) }}
|