MegaBites-AI/Windows-powershell
0372
1name: Linux-CI2 3run-name: "${{ github.ref_name }} - ${{ github.run_number }}"4 5on:6 workflow_dispatch:7 8 push:9 branches:10 - master11 - release/**12 - github-mirror13 paths:14 - "**"15 - "*"16 - ".globalconfig"17 - "!.github/ISSUE_TEMPLATE/**"18 - "!.dependabot/config.yml"19 - "!.pipelines/**"20 - "!test/perf/**"21 pull_request:22 branches:23 - master24 - release/**25 - github-mirror26 - "*-feature"27# Path filters for PRs need to go into the changes job28 29concurrency:30 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}31 cancel-in-progress: ${{ contains(github.ref, 'merge')}}32 33env:34 DOTNET_CLI_TELEMETRY_OPTOUT: 135 DOTNET_NOLOGO: 136 FORCE_FEATURE: 'False'37 FORCE_PACKAGE: 'False'38 NUGET_KEY: none39 POWERSHELL_TELEMETRY_OPTOUT: 140 __SuppressAnsiEscapeSequences: 141 nugetMultiFeedWarnLevel: none42 system_debug: 'false'43jobs:44 changes:45 if: startsWith(github.repository_owner, 'azure') || github.repository_owner == 'PowerShell'46 name: Change Detection47 runs-on: ubuntu-latest48 # Required permissions49 permissions:50 pull-requests: read51 contents: read52 53 # Set job outputs to values from filter step54 outputs:55 source: ${{ steps.filter.outputs.source }}56 buildModuleChanged: ${{ steps.filter.outputs.buildModuleChanged }}57 packagingChanged: ${{ steps.filter.outputs.packagingChanged }}58 steps:59 - name: checkout60 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.261 with:62 persist-credentials: false63 64 - name: Change Detection65 id: filter66 uses: "./.github/actions/infrastructure/path-filters"67 with:68 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}69 70 merge_conflict_check:71 name: Check for Merge Conflict Markers72 runs-on: ubuntu-latest73 if: github.event_name == 'pull_request' && (startsWith(github.repository_owner, 'azure') || github.repository_owner == 'PowerShell')74 permissions:75 pull-requests: read76 contents: read77 steps:78 - name: checkout79 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.280 81 - name: Check for merge conflict markers82 uses: "./.github/actions/infrastructure/merge-conflict-checker"83 84 ci_build:85 name: Build PowerShell86 runs-on: ubuntu-latest87 needs: changes88 if: ${{ needs.changes.outputs.source == 'true' || needs.changes.outputs.buildModuleChanged == 'true' }}89 steps:90 - name: checkout91 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.292 with:93 fetch-depth: 100094 95 - name: Build96 uses: "./.github/actions/build/ci"97 linux_test_unelevated_ci:98 name: Linux Unelevated CI99 needs:100 - ci_build101 - changes102 if: ${{ needs.changes.outputs.source == 'true' || needs.changes.outputs.buildModuleChanged == 'true' }}103 runs-on: ubuntu-latest104 steps:105 - name: checkout106 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2107 with:108 fetch-depth: 1000109 - name: Linux Unelevated CI110 uses: "./.github/actions/test/nix"111 with:112 purpose: UnelevatedPesterTests113 tagSet: CI114 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}115 linux_test_elevated_ci:116 name: Linux Elevated CI117 needs:118 - ci_build119 - changes120 if: ${{ needs.changes.outputs.source == 'true' || needs.changes.outputs.buildModuleChanged == 'true' }}121 runs-on: ubuntu-latest122 steps:123 - name: checkout124 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2125 with:126 fetch-depth: 1000127 - name: Linux Elevated CI128 uses: "./.github/actions/test/nix"129 with:130 purpose: ElevatedPesterTests131 tagSet: CI132 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}133 linux_test_unelevated_others:134 name: Linux Unelevated Others135 needs:136 - ci_build137 - changes138 if: ${{ needs.changes.outputs.source == 'true' || needs.changes.outputs.buildModuleChanged == 'true' }}139 runs-on: ubuntu-latest140 steps:141 - name: checkout142 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2143 with:144 fetch-depth: 1000145 - name: Linux Unelevated Others146 uses: "./.github/actions/test/nix"147 with:148 purpose: UnelevatedPesterTests149 tagSet: Others150 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}151 linux_test_elevated_others:152 name: Linux Elevated Others153 needs:154 - ci_build155 - changes156 if: ${{ needs.changes.outputs.source == 'true' || needs.changes.outputs.buildModuleChanged == 'true' }}157 runs-on: ubuntu-latest158 steps:159 - name: checkout160 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2161 with:162 fetch-depth: 1000163 - name: Linux Elevated Others164 uses: "./.github/actions/test/nix"165 with:166 purpose: ElevatedPesterTests167 tagSet: Others168 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}169 xunit_tests:170 name: xUnit Tests171 needs:172 - changes173 if: ${{ needs.changes.outputs.source == 'true' || needs.changes.outputs.buildModuleChanged == 'true' }}174 uses: ./.github/workflows/xunit-tests.yml175 with:176 runner_os: ubuntu-latest177 test_results_artifact_name: testResults-xunit178 179 infrastructure_tests:180 name: Infrastructure Tests181 runs-on: ubuntu-latest182 steps:183 - name: checkout184 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2185 with:186 fetch-depth: 1187 188 - name: Install Pester189 shell: pwsh190 run: |191 Import-Module ./tools/ci.psm1192 Install-CIPester193 194 - name: Run Infrastructure Tests195 shell: pwsh196 run: |197 $testResultsFolder = Join-Path $PWD "testResults"198 New-Item -ItemType Directory -Path $testResultsFolder -Force | Out-Null199 200 $config = New-PesterConfiguration201 $config.Run.Path = './test/infrastructure/'202 $config.Run.PassThru = $true203 $config.TestResult.Enabled = $true204 $config.TestResult.OutputFormat = 'NUnitXml'205 $config.TestResult.OutputPath = "$testResultsFolder/InfrastructureTests.xml"206 $config.Output.Verbosity = 'Detailed'207 208 $result = Invoke-Pester -Configuration $config209 210 if ($result.FailedCount -gt 0 -or $result.Result -eq 'Failed') {211 throw "Infrastructure tests failed"212 }213 214 - name: Publish Test Results215 uses: "./.github/actions/test/process-pester-results"216 if: always()217 with:218 name: "InfrastructureTests"219 testResultsFolder: "${{ github.workspace }}/testResults"220 221 ## Temporarily disable the CodeQL analysis on Linux as it doesn't work for .NET SDK 10-rc.2.222 # analyze:223 # name: CodeQL Analysis224 # needs: changes225 # if: ${{ needs.changes.outputs.source == 'true' }}226 # uses: ./.github/workflows/analyze-reusable.yml227 # permissions:228 # actions: read229 # contents: read230 # security-events: write231 # with:232 # runner_os: ubuntu-latest233 234 ready_to_merge:235 name: Linux ready to merge236 needs:237 - xunit_tests238 - linux_test_elevated_ci239 - linux_test_elevated_others240 - linux_test_unelevated_ci241 - linux_test_unelevated_others242 - linux_packaging243 - merge_conflict_check244 - infrastructure_tests245 # - analyze246 if: always()247 uses: PowerShell/compliance/.github/workflows/ready-to-merge.yml@c8b3ad5819ad7078f3e375519b4f8c6232d1cbdf # v1.0.0248 with:249 needs_context: ${{ toJson(needs) }}250 linux_packaging:251 name: Linux Packaging252 needs:253 - changes254 if: ${{ needs.changes.outputs.packagingChanged == 'true' }}255 runs-on: ubuntu-latest256 steps:257 - name: checkout258 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2259 with:260 fetch-depth: 0261 - name: Linux Packaging262 uses: "./.github/actions/test/linux-packaging"263 