ci: fail PowerShell job when the runtime cannot be installed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f254a1ca40
commit
30257e72cd
1 file changed
+11
-11
+11
-11
@@ -64,23 +64,23 @@ jobs:
|
|||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- name: Check PowerShell runtime
|
- name: Install PowerShell runtime
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if command -v pwsh >/dev/null 2>&1; then
|
set -euo pipefail
|
||||||
echo 'POWERSHELL_AVAILABLE=true' >> "$GITHUB_ENV"
|
if ! command -v pwsh >/dev/null 2>&1; then
|
||||||
exit 0
|
# Microsoft's signed apt repository; the job fails when PowerShell cannot be installed.
|
||||||
fi
|
. /etc/os-release
|
||||||
if sudo apt-get update && sudo apt-get install --yes --no-install-recommends powershell; then
|
wget -q -O "$RUNNER_TEMP/packages-microsoft-prod.deb" "https://packages.microsoft.com/config/$ID/$VERSION_ID/packages-microsoft-prod.deb"
|
||||||
echo 'POWERSHELL_AVAILABLE=true' >> "$GITHUB_ENV"
|
sudo dpkg -i "$RUNNER_TEMP/packages-microsoft-prod.deb"
|
||||||
else
|
sudo apt-get update
|
||||||
echo 'POWERSHELL_AVAILABLE=false' >> "$GITHUB_ENV"
|
sudo apt-get install --yes --no-install-recommends powershell
|
||||||
echo '::warning::PowerShell is unavailable; PowerShell checks skipped for this runner.'
|
|
||||||
fi
|
fi
|
||||||
|
pwsh -NoLogo -NoProfile -NonInteractive -Command '$PSVersionTable.PSVersion.ToString()'
|
||||||
- name: Run PowerShell tests
|
- name: Run PowerShell tests
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [ "${POWERSHELL_AVAILABLE:-false}" != true ]; then exit 0; fi
|
set -euo pipefail
|
||||||
pwsh -NoLogo -NoProfile -NonInteractive -File ./scripts/commands/check-capabilities.ps1
|
pwsh -NoLogo -NoProfile -NonInteractive -File ./scripts/commands/check-capabilities.ps1
|
||||||
pwsh -NoLogo -NoProfile -NonInteractive -File ./scripts/commands/build.ps1 -Summary
|
pwsh -NoLogo -NoProfile -NonInteractive -File ./scripts/commands/build.ps1 -Summary
|
||||||
for file in scripts/tests/test-*.ps1; do
|
for file in scripts/tests/test-*.ps1; do
|
||||||
|
|||||||
Reference in new issue
Block a user