Skip to content

[pull] master from PowerShell:master #73

[pull] master from PowerShell:master

[pull] master from PowerShell:master #73

Workflow file for this run

name: Linux-CI
run-name: "${{ github.ref_name }} - ${{ github.run_number }}"
on:
workflow_dispatch:
push:
branches:
- master
- release/**
paths:
- "**"
- "!.github/ISSUE_TEMPLATE/**"
- "!.dependabot/config.yml"
- "!.pipelines/**"
- "!test/perf/**"
pull_request:
branches:
- master
- release/**
# 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_SKIP_FIRST_TIME_EXPERIENCE: 1
FORCE_FEATURE: 'False'
FORCE_PACKAGE: 'False'
NUGET_KEY: none
POWERSHELL_TELEMETRY_OPTOUT: 1
__SuppressAnsiEscapeSequences: 1
nugetMultiFeedWarnLevel: none
system_debug: 'false'
jobs:
changes:
name: Change Detection
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
source: ${{ steps.filter.outputs.source }}
steps:
- name: checkout
uses: actions/[email protected]
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v3
id: filter
with:
list-files: json
filters: .github/action-filters.yml
- name: Capture outputs
run: |
"source: ${{ steps.filter.outputs.source }}"
"github: ${{ steps.filter.outputs.github }}"
"tools: ${{ steps.filter.outputs.tools }}"
"props: ${{ steps.filter.outputs.props }}"
"tests: ${{ steps.filter.outputs.tests }}"
"mainSource: ${{ steps.filter.outputs.mainSource }}"
"buildModule: ${{ steps.filter.outputs.buildModule }}"
shell: pwsh
ci_build:
name: Build PowerShell
runs-on: ubuntu-20.04
needs: changes
if: ${{ needs.changes.outputs.source == 'true' }}
steps:
- name: checkout
uses: actions/[email protected]
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' }}
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/[email protected]
with:
fetch-depth: 1000
- name: Linux Unelevated CI
uses: "./.github/actions/test/nix"
with:
purpose: UnelevatedPesterTests
tagSet: CI
linux_test_elevated_ci:
name: Linux Elevated CI
needs:
- ci_build
- changes
if: ${{ needs.changes.outputs.source == 'true' }}
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/[email protected]
with:
fetch-depth: 1000
- name: Linux Elevated CI
uses: "./.github/actions/test/nix"
with:
purpose: ElevatedPesterTests
tagSet: CI
linux_test_unelevated_others:
name: Linux Unelevated Others
needs:
- ci_build
- changes
if: ${{ needs.changes.outputs.source == 'true' }}
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/[email protected]
with:
fetch-depth: 1000
- name: Linux Unelevated Others
uses: "./.github/actions/test/nix"
with:
purpose: UnelevatedPesterTests
tagSet: Others
linux_test_elevated_others:
name: Linux Elevated Others
needs:
- ci_build
- changes
if: ${{ needs.changes.outputs.source == 'true' }}
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/[email protected]
with:
fetch-depth: 1000
- name: Linux Elevated Others
uses: "./.github/actions/test/nix"
with:
purpose: ElevatedPesterTests
tagSet: Others
verify_xunit:
name: Verify xUnit test results
needs:
- ci_build
- changes
if: ${{ needs.changes.outputs.source == 'true' }}
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/[email protected]
with:
fetch-depth: 1000
- name: Verify xUnit test results
uses: "./.github/actions/test/verify_xunit"
analyze:
permissions:
actions: read # for github/codeql-action/init to get workflow details
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/analyze to upload SARIF results
name: Analyze
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.source == 'true' }}
strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['csharp']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
- uses: actions/setup-dotnet@v4
with:
global-json-file: ./global.json
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- run: |
Get-ChildItem -Path env: | Out-String -width 9999 -Stream | write-Verbose -Verbose
name: Capture Environment
shell: pwsh
- run: |
Import-Module .\tools\ci.psm1
Invoke-CIInstall -SkipUser
name: Bootstrap
shell: pwsh
- run: |
Import-Module .\tools\ci.psm1
Invoke-CIBuild
name: Build
shell: pwsh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
ready_to_merge:
name: Linux ready to merge
needs:
- verify_xunit
- linux_test_elevated_ci
- linux_test_elevated_others
- linux_test_unelevated_ci
- linux_test_unelevated_others
- analyze
if: always()
uses: PowerShell/compliance/.github/workflows/ready-to-merge.yml@master
with:
needs_context: ${{ toJson(needs) }}
# TODO: Enable this when we have a Linux packaging workflow
# ERROR: While executing gem ... (Gem::FilePermissionError)
# You don't have write permissions for the /var/lib/gems/2.7.0 directory.
# WARNING: Installation of gem dotenv 2.8.1 failed! Must resolve manually.
# linux_packaging:
# name: Attempt Linux Packaging
# needs: ci_build
# runs-on: ubuntu-20.04
# steps:
# - name: checkout
# uses: actions/[email protected]
# with:
# fetch-depth: 1000
# - name: Verify xUnit test results
# uses: "./.github/actions/test/linux-packaging"