|
9 | 9 | permissions: read-all
|
10 | 10 |
|
11 | 11 | jobs:
|
| 12 | + run-pester-tests: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + name: Run Pester tests |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 |
| 17 | + |
| 18 | + - name: Execute tests |
| 19 | + shell: pwsh |
| 20 | + env: |
| 21 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 22 | + run: | |
| 23 | + # execute Pester tests |
| 24 | +
|
| 25 | + # install powershell-yaml as it is not on the runners by default |
| 26 | + $moduleName = "powershell-yaml" |
| 27 | + Install-Module -Name $moduleName -Force -Scope CurrentUser -AllowClobber |
| 28 | +
|
| 29 | + # execute tests |
| 30 | + $testResults = Invoke-Pester |
| 31 | + if ($testResults.FailedCount -gt 0) { |
| 32 | + throw "Tests failed" |
| 33 | + } |
| 34 | + else { |
| 35 | + Write-Host "Tests passed" |
| 36 | + } |
| 37 | +
|
12 | 38 | load-all-used-actions:
|
13 | 39 | runs-on: ubuntu-latest
|
14 | 40 | name: Test on current organization
|
|
21 | 47 | PAT: ${{ secrets.GITHUB_TOKEN }}
|
22 | 48 | id: load-actions
|
23 | 49 |
|
24 |
| - - shell: pwsh |
25 |
| - run: | |
26 |
| - Write-Host "Found actions [${{ steps.load-actions.outputs.actions }}]" |
27 |
| - $content = ${{ steps.load-actions.outputs.actions }} |
28 |
| - New-Item -Path 'actions.json' -Value $content -Force | Out-Null |
29 |
| - $actions = $content | ConvertFrom-Json |
30 |
| - if ($actions.Length -le 0) { |
31 |
| - Set-Content -Value "No actions found" -Path $env:GITHUB_STEP_SUMMARY |
32 |
| - throw "No actions found" |
33 |
| - } |
34 |
| - else { |
35 |
| - Write-Host "Found [$($actions.Length)] actions" |
36 |
| - Set-Content -Value "Found [$($actions.Length)] actions" -Path $env:GITHUB_STEP_SUMMARY |
37 |
| - } |
38 |
| -
|
39 | 50 | - shell: pwsh
|
40 |
| - name: check the output file location to contain the expected content |
| 51 | + name: Check the output file location to contain the expected content |
41 | 52 | run: |
|
42 | 53 | # check the output file location to contain the expected content
|
43 | 54 | Write-Host "Got actions file location here [${{ steps.load-actions.outputs.actions-file }}]"
|
|
64 | 75 | runs-on: ubuntu-latest
|
65 | 76 | name: Test on different organization
|
66 | 77 | env:
|
67 |
| - organization: rajbos-actions |
| 78 | + organization: rajbos-actions-demo |
68 | 79 | steps:
|
69 | 80 | - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
70 | 81 |
|
|
75 | 86 | organization: ${{ env.organization }}
|
76 | 87 | id: load-actions
|
77 | 88 |
|
78 |
| - - shell: pwsh |
79 |
| - run: | |
80 |
| - Write-Host "Found actions [${{ steps.load-actions.outputs.actions }}]" |
81 |
| - $content = ${{ steps.load-actions.outputs.actions }} |
82 |
| - New-Item -Path 'actions.json' -Value $content -Force | Out-Null |
83 |
| - $actions = $content | ConvertFrom-Json |
84 |
| - if ($actions.Length -le 0) { |
85 |
| - Set-Content -Value "No actions found" -Path $env:GITHUB_STEP_SUMMARY |
86 |
| - throw "No actions found" |
87 |
| - } |
88 |
| - else { |
89 |
| - Write-Host "Found [$($actions.Length)] actions" |
90 |
| - Set-Content -Value "Found [$($actions.Length)] actions" -Path $env:GITHUB_STEP_SUMMARY |
91 |
| - } |
92 |
| -
|
93 | 89 | - shell: pwsh
|
94 |
| - name: check the output file location to contain the expected content |
| 90 | + name: Check the output file location to contain the expected content |
95 | 91 | run: |
|
96 | 92 | # check the output file location to contain the expected content
|
97 | 93 | Write-Host "Got actions file location here [${{ steps.load-actions.outputs.actions-file }}]"
|
|
0 commit comments