Update test.yaml #7
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 }} | |
build-matrix-matrix: | |
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: Matrix | |
id: create-matrix-matrix | |
run: | | |
$params = Get-Content -Path ./params.txt | |
$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($value.ToLower() -eq "${{ matrix.product }}") | |
{ | |
echo "Testing the following person: $value" | |
echo "First name is: $attribute[1]" | |
echo "Last name is: $attribute[2]" | |
} | |
} | |
} |