cisagov / ScubaGear

Automation to assess the state of your M365 tenant against CISA's baselines
https://www.cisa.gov/resources-tools/services/secure-cloud-business-applications-scuba-project
Creative Commons Zero v1.0 Universal
1.77k stars 228 forks source link

Convert workflow testing code to functions #1430

Closed james-garriss closed 4 days ago

james-garriss commented 1 week ago

πŸ—£ Description

These two workflow functions were converted from modules to just functions. There was no change in functionality.

πŸ’­ Motivation and context

Closes: #1429

πŸ§ͺ Testing

Tested via functional tests workflow and the workflow pipeline

βœ… Pre-approval checklist

βœ… Pre-merge checklist

βœ… Post-merge checklist

james-garriss commented 5 days ago

Summary of reasons for using functions in .ps1 files for workflow code:

1) They should not be part of the SG module, and there is no need for a testing module. 2) Functions support standard PowerShell options like -Debug. 3) Functions are easy to integrate into Pester tests.

Thus, the goal is move all workflow code into functions in .ps1 files and write unit tests for them that are executed by the workflow CI pipeline.

james-garriss commented 4 days ago

@nanda-katikaneni

mitchelbaker-cisa commented 4 days ago

Ran functional tests, jobs pass excluding known SharePoint failures: https://github.com/cisagov/ScubaGear/actions/runs/11963450431 Ran workflow pipeline, pass: https://github.com/cisagov/ScubaGear/actions/runs/11963470997