Update params.txt #18
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
name: Matrix Test | |
on: | |
push: | |
jobs: | |
build-matrix: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: powershell | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Matrix | |
id: create-matrix | |
run: | | |
$params = Get-Content -Path ./params.txt | |
$aliases = "[" | |
$persons = $params.split("|") | |
foreach ($person in $persons) | |
{ | |
$attributes = $person.split(",") | |
foreach ($attribute in $attributes) | |
{ | |
# Split the key from the value | |
$keyAndValue = $attribute.split("=") | |
$key = $keyAndValue[0] | |
$value = $keyAndValue[1] | |
if($key.ToLower() -eq "alias") | |
{ | |
echo "Testing the following person: $value" | |
$aliases += '"' | |
$aliases += $value.Trim() | |
$aliases += '",' | |
} | |
} | |
} | |
$aliases = $aliases.Substring(0, $aliases.Length-1) | |
$aliases += "]" | |
echo $aliases | |
echo aliases=$aliases >> $env:GITHUB_OUTPUT | |
outputs: | |
aliases: ${{ steps.create-matrix.outputs.aliases }} | |
test: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: powershell | |
needs: | |
- build-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
product: ${{ fromJson(needs.build-matrix.outputs.aliases) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test Product | |
run: | | |
$params = Get-Content -Path ./params.txt | |
$persons = $params.split("|") | |
foreach ($person in $persons) | |
{ | |
print($person) | |
$alias = "" | |
$first = "" | |
$last = "" | |
$attributes = $person.split(",") | |
foreach ($attribute in $attributes) | |
{ | |
# Split the key from the value | |
$keyAndValue = $attribute.split("=") | |
$key = $keyAndValue[0] | |
$value = $keyAndValue[1] | |
if($key.ToLower() -eq "alias") | |
{ | |
$alias = $value | |
} | |
elseif($key.ToLower() -eq "first") | |
{ | |
$first = $value | |
} | |
elseif($key.ToLower() -eq "last") | |
{ | |
$last = $value | |
} | |
} | |
if($alias -eq "${{ matrix.product }}") | |
{ | |
echo "Testing the following person..." | |
echo "Person is: $person" | |
echo "${{ matrix.product }}" | |
echo "Alias is: $alias" | |
echo "First is: $first" | |
echo "Last is: $last" | |
echo "Call the test method here..." | |
} | |
} | |