-
Notifications
You must be signed in to change notification settings - Fork 29
54 lines (54 loc) · 2.33 KB
/
pester.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Pester tests
on: push
jobs:
test:
name: Run Pester tests
runs-on: windows-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Get changes
id: changes
uses: jitterbit/get-changed-files@v1
with:
format: csv
- name: Pester test
shell: pwsh -noninteractive -command ". '{0}'"
run: |
Install-Module Pester -Force
Write-Information "PSC $($PSVersionTable.PSVersion) running on CLR v$([Environment]::Version) on $($PSVersionTable.OS)" -infa Continue
'${{ steps.changes.outputs.added_modified }}' -split ',' |Out-File .changes utf8
Invoke-Pester -Output Diagnostic -Path test -PassThru |Export-NUnitReport -Path TestResults.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
id: test-results
if: always()
with:
nunit_files: "TestResults.xml"
- name: Set badge color
shell: pwsh
run: |
switch('${{ fromJSON( steps.test-results.outputs.json ).conclusion }}')
{
success {'BADGE_COLOR=31C653' |Add-Content $env:GITHUB_ENV}
failure {'BADGE_COLOR=800000' |Add-Content $env:GITHUB_ENV}
neutral {'BADGE_COLOR=696969' |Add-Content $env:GITHUB_ENV}
}
- name: Create badge
uses: emibcn/badge-action@d6f51ff11b5c3382b3b88689ae2d6db22d9737d1
with:
label: Tests
status: '${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests }} tests, ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.runs }} runs: ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}'
color: ${{ env.BADGE_COLOR }}
path: badge.svg
- name: Upload badge to Gist
# Upload only for original fork and main branch
if: >
github.repository == 'brianary/scripts' &&
((github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main') ||
(github.event_name != 'workflow_run' && github.ref == 'refs/heads/main'))
uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d
with:
token: ${{ secrets.GIST_TOKEN }}
gistURL: https://gist.githubusercontent.com/brianary/4642e5c804aa1b40738def5a7c03607a
file: badge.svg