forked from actions/runner-images
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement basic workflow to run pester tests
- Loading branch information
1 parent
7a6d3a7
commit 37c60ce
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: 'Image Tests' | ||
description: 'Runs Pester tests on images' | ||
|
||
inputs: | ||
image_os: | ||
description: 'The operating system of the image' | ||
required: false | ||
default: 'ubuntu' | ||
image_version: | ||
description: 'The version of the operating system of the image' | ||
required: false | ||
default: '2204' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ github.action_repository }} | ||
ref: ${{ github.action_ref }} | ||
|
||
- name: Run Pester Tests | ||
shell: bash | ||
env: | ||
IMAGE_OS: ${{ inputs.image_os }} | ||
TESTS_PATH: images/${{ inputs.image_os }}/scripts/tests | ||
TOOLSET_PATH: images/${{ inputs.image_os }}/toolsets/toolset-${{ inputs.image_version }}.json | ||
REPO_ROOT: ${{ github.action_path }}/../../.. | ||
run: | | ||
sudo -E pwsh -Command ' | ||
$ErrorActionPreference = "Stop" | ||
Import-Module "$env:REPO_ROOT/$env:TESTS_PATH/Helpers.psm1" -DisableNameChecking | ||
function global:Get-ToolsetContentOverride { | ||
$toolsetPath = "$env:REPO_ROOT/$env:TOOLSET_PATH" | ||
$toolsetJson = Get-Content -Path $toolsetPath -Raw | ||
ConvertFrom-Json -InputObject $toolsetJson | ||
} | ||
Set-Alias -Name Get-ToolsetContent -Value Get-ToolsetContentOverride -Scope global | ||
Invoke-Pester -Output Detailed $env:REPO_ROOT/$env:TESTS_PATH | ||
' |