Skip to content

Commit

Permalink
Implement basic workflow to run pester tests
Browse files Browse the repository at this point in the history
  • Loading branch information
guicaulada committed Oct 15, 2024
1 parent 7a6d3a7 commit 37c60ce
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/actions/image-tests/action.yml
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
'

0 comments on commit 37c60ce

Please sign in to comment.