-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathaction.yml
More file actions
181 lines (167 loc) Β· 6.9 KB
/
action.yml
File metadata and controls
181 lines (167 loc) Β· 6.9 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: "Run Maester"
description: "Monitor your Microsoft 365 tenant's security configuration using Maester, THE PowerShell-based test automation framework."
branding:
icon: "check-circle"
color: "red"
inputs:
tenant_id:
description: "Entra ID Tenant ID"
required: true
client_id:
description: "App Registration Client ID"
required: true
include_public_tests:
description: "Include public test repository 'maester365/maester-tests' as well as private tests in the test run"
required: false
default: "true"
include_private_tests:
description: "Checkout the current repository for private tests. Disable this if you want to run the public tests only."
required: false
default: "true"
include_exchange:
description: "Include Exchange Online tests in the test run."
required: false
default: "false"
include_teams:
description: "Include Teams tests in the test run."
required: false
default: "true"
include_longrunning_tests:
description: "Include long running tests."
required: false
default: "false"
include_preview_tests:
description: "Include preview tests."
required: false
default: "false"
include_tags:
description: "A list of tags to include in the test run. Please separate multiple tags with a comma (without space)."
required: false
default: ""
exclude_tags:
description: "A list of tags to exclude from the test run. Please separate multiple tags with a comma (without space)."
required: false
default: ""
maester_version:
description: "The version of Maester PowerShell to use. latest (default), preview, or a specific version number."
required: false
default: "latest"
pester_verbosity:
description: "Pester verbosity level. Options: 'None', 'Normal', 'Detailed', 'Diagnostic'"
required: false
default: "None"
step_summary:
description: "Define whether a summary is outputted to GitHub Actions."
required: false
default: "true"
artifact_upload:
description: "Define whether the results are uploaded as Artifacts."
required: false
default: "true"
disable_telemetry:
description: "If set, telemetry information will not be logged."
required: false
default: "false"
mail_recipients:
description: "A list of email addresses to send the test results to. Please separate multiple email addresses with a comma."
required: false
default: ""
mail_userid:
description: "The user id of the sender of the mail. This is required since the action is using application permissions."
required: false
default: ""
mail_testresultsuri:
description: "Uri to the detailed test results page."
required: false
default: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
notification_teams_webhook:
description: "Webhook URL for sending test results to Teams."
required: false
default: ""
notification_teams_channel_id:
description: "The ID of the Teams channel to send the test results to."
required: false
default: ""
notification_teams_team_id:
description: "The ID of the Teams team to send the test results to."
required: false
default: ""
outputs:
results_json:
description: "The file location of the JSON output of the test results."
value: ${{ steps.maester.outputs.results_json }}
tests_total:
description: "The total number of tests run."
value: ${{ steps.maester.outputs.tests_total }}
tests_passed:
description: "The number of tests that passed."
value: ${{ steps.maester.outputs.tests_passed }}
tests_failed:
description: "The number of tests that failed."
value: ${{ steps.maester.outputs.tests_failed }}
tests_skipped:
description: "The number of tests that were skipped."
value: ${{ steps.maester.outputs.tests_skipped }}
result:
description: "The result of the test run. 'Failed' if any tests failed, 'Passed' if all tests passed."
value: ${{ steps.maester.outputs.result }}
runs:
using: "composite"
steps:
- name: π Set current date as env variable
shell: bash
run: echo "NOW=$(date +'%Y-%m-%d-T%H%M%S')" >> $GITHUB_ENV
- name: β Log error message
if: ${{ inputs.include_public_tests != 'true' && inputs.include_private_tests != 'true' }}
run: |
echo "::error title=No tests to run::Please set 'include_public_tests' or 'include_private_tests' to 'true'."
exit 1
shell: bash
- name: π§βπ» Checkout latest private tests
if: ${{ inputs.include_private_tests == 'true' }}
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
- name: β Log error message
if: ${{ failure() }}
run: |
echo "::error title=Failed to checkout tests::Something went wrong. Please check the logs for more details."
exit 1
shell: bash
- name: π Sign in to Entra ID
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 #v2.3.0
with:
client-id: ${{ inputs.client_id }}
tenant-id: ${{ inputs.tenant_id }}
allow-no-subscriptions: true
- name: π§ͺ Run Maester
id: maester
shell: pwsh
run: |
${{ github.action_path }}\script\Run-MaesterAction.ps1 `
-TenantId '${{ inputs.tenant_id}}' `
-ClientId '${{ inputs.client_id }}' `
-Path '${{ github.workspace }}' `
-MaesterVersion '${{ inputs.maester_version }}' `
-IncludePublicTests('${{ inputs.include_public_tests }}' -eq 'true') `
-IncludeExchange ('${{ inputs.include_exchange }}' -eq 'true') `
-IncludeTeams ('${{ inputs.include_teams }}' -eq 'true') `
-IncludeLongRunning ('${{ inputs.include_longrunning_tests }}' -eq 'true') `
-IncludePreview ('${{ inputs.include_preview_tests }}' -eq 'true') `
-IncludeTags '${{ inputs.include_tags }}' `
-ExcludeTags '${{ inputs.exclude_tags }}' `
-DisableTelemetry ('${{ inputs.disable_telemetry}}' -eq 'true') `
-PesterVerbosity '${{ inputs.pester_verbosity }}' `
-IsDebug ('${{runner.debug}}' -eq '1') `
-GitHubStepSummary ('${{ inputs.step_summary }}' -eq 'true') `
-MailRecipients '${{ inputs.mail_recipients }}' `
-MailUser '${{ inputs.mail_userid }}' `
-TestResultURI '${{ inputs.mail_testresultsuri }}' `
-TeamsWebhookUri '${{ inputs.notification_teams_webhook }}' `
-TeamsChannelId '${{ inputs.notification_teams_channel_id }}' `
-TeamsTeamId '${{ inputs.notification_teams_team_id }}'
- name: π Archive Maester Html Report
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f #v7.0.0
if: always() && steps.maester.outputs.results_json != '' && inputs.artifact_upload == 'true'
with:
name: maester-test-results-${{inputs.maester_version}}-${{ env.NOW }}
path: test-results
include-hidden-files: true