diff --git a/.github/ISSUES_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from .github/ISSUES_TEMPLATE/bug_report.md rename to .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUES_TEMPLATE/feature_report.md b/.github/ISSUE_TEMPLATE/feature_report.md similarity index 100% rename from .github/ISSUES_TEMPLATE/feature_report.md rename to .github/ISSUE_TEMPLATE/feature_report.md diff --git a/.github/workflows/powershell-pester-test.yml b/.github/workflows/powershell-pester-test.yml new file mode 100644 index 0000000..ff00102 --- /dev/null +++ b/.github/workflows/powershell-pester-test.yml @@ -0,0 +1,40 @@ +name: Pester Unit Tests + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + permissions: + contents: read # for actions/checkout to fetch code + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + name: pester-unit-tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Run Pester tests + shell: pwsh + run: | + $ErrorActionPreference = "Stop" + . "$($ENV:GITHUB_WORKSPACE)/tests/setupTest.ps1" + - name: Upload Test Results + uses: actions/upload-artifact@v4 + with: + name: ubuntu-Unit-Tests + path: "${{GITHUB.WORKSPACE}}/out/Tests" diff --git a/.github/workflow/powershell-psscriptanalyzer.yml b/.github/workflows/powershell-psscriptanalyzer.yml similarity index 79% rename from .github/workflow/powershell-psscriptanalyzer.yml rename to .github/workflows/powershell-psscriptanalyzer.yml index 24afae9..490f7b0 100644 --- a/.github/workflow/powershell-psscriptanalyzer.yml +++ b/.github/workflows/powershell-psscriptanalyzer.yml @@ -14,6 +14,7 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + workflow_dispatch: permissions: contents: read @@ -33,7 +34,7 @@ jobs: with: dotnet-version: 8.0.x - - name: Run PSScriptAnalyzer + - name: Run PSScriptAnalyzer uses: microsoft/psscriptanalyzer-action@6b2948b1944407914a58661c49941824d149734f with: # Check https://github.com/microsoft/action-psscriptanalyzer for more info about the options. @@ -49,16 +50,3 @@ jobs: uses: github/codeql-action/upload-sarif@v3 with: sarif_file: results.sarif - - - name: Restore dependencies - run: dotnet restore - - name: Build - run: dotnet build --no-restore - - # run powershell script /tests/setupTest.ps1 to run pester unit-testing - - name: Run Pester tests - shell: pwsh - run: | - $ErrorActionPreference = "Stop" - $PSScriptRoot = (Get-Item -Path $MyInvocation.MyCommand.Path).DirectoryName - . "$PSScriptRoot/tests/setupTest.ps1" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b0c96da --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,18 @@ + +We welcome contributions! To get started, follow these steps: + +1. Fork the repository. +2. Create a new branch for your feature or bug fix. +3. Commit your changes and submit a pull request. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a +Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us +the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. + +When you submit a pull request, a CLA bot will automatically determine whether you need to provide +a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions +provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. \ No newline at end of file diff --git a/Microsoft.AzureStack.Util.ConvertNetwork.csproj b/Microsoft.AzureStack.Util.ConvertNetwork.csproj index c351711..463451c 100644 --- a/Microsoft.AzureStack.Util.ConvertNetwork.csproj +++ b/Microsoft.AzureStack.Util.ConvertNetwork.csproj @@ -15,7 +15,7 @@ - + diff --git a/README.md b/README.md index c116f71..b8ef72b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Microsoft.AzureStack.Util.ConvertNetwork -[![Build Status](https://img.shields.io/github/actions/workflow/status/microsoft/Microsoft.AzureStack.Util.ConvertNetwork/powershell-psscriptanalyzer.yml?branch=main)](https://github.com/microsoft/Microsoft.AzureStack.Util.ConvertNetwork/actions) +[![Pester Unit Tests](https://github.com/microsoft/Microsoft.AzureStack.Util.ConvertNetwork/actions/workflows/powershell-pester-test.yml/badge.svg)](https://github.com/microsoft/Microsoft.AzureStack.Util.ConvertNetwork/actions/workflows/powershell-pester-test.yml) +[![PSScriptAnalyzer](https://github.com/microsoft/Microsoft.AzureStack.Util.ConvertNetwork/actions/workflows/powershell-psscriptanalyzer.yml/badge.svg)](https://github.com/microsoft/Microsoft.AzureStack.Util.ConvertNetwork/actions/workflows/powershell-psscriptanalyzer.yml) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) ## Overview @@ -33,6 +34,20 @@ git clone https://github.com/microsoft/Microsoft.AzureStack.Util.ConvertNetwork. Import-Module .\src\Microsoft.AzureStack.Util.ConvertNetwork.psm1 ``` +### Unit-Testing + +Requirements: + +- dotnet8 sdk + +To install dotnet 8 see https://dotnet.microsoft.com/en-us/download/dotnet/8.0 + +The build step will download the required pester NuGet package before executing the test. + +The Pester testing script expects a dotnet build to be executed before running the test. The build step will place the script into an `/out` directory then execute the test on that script. The test results will be place in `/out/Tests`. + +Upon a pull-request, the unit-test will be performed against the script. A passing unit-test will be required before any changes are approved. + ## Usage Here are some examples of how to use the module: @@ -176,24 +191,7 @@ This project is licensed under the [MIT License](LICENSE). If you encounter any issues or have questions, please file an issue in the [GitHub Issues](https://github.com/microsoft/Microsoft.AzureStack.Util.ConvertNetwork/issues) section. ## Contributing - -We welcome contributions! To get started, follow these steps: - -1. Fork the repository. -2. Create a new branch for your feature or bug fix. -3. Commit your changes and submit a pull request. - -This project welcomes contributions and suggestions. Most contributions require you to agree to a -Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us -the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. - -When you submit a pull request, a CLA bot will automatically determine whether you need to provide -a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions -provided by the bot. You will only need to do this once across all repos using our CLA. - -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or -contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. +[Contributing](CONTRIBUTING.md). ## Code of Conduct diff --git a/src/Microsoft.AzureStack.Util.ConvertNetwork.psd1 b/src/Microsoft.AzureStack.Util.ConvertNetwork.psd1 index 7c0e756..2e94345 100644 --- a/src/Microsoft.AzureStack.Util.ConvertNetwork.psd1 +++ b/src/Microsoft.AzureStack.Util.ConvertNetwork.psd1 @@ -106,10 +106,10 @@ PrivateData = @{ # Tags = @() # A URL to the license for this module. - # LicenseUri = '' + LicenseUri = 'https://github.com/microsoft/Microsoft.AzureStack.Util.ConvertNetwork/blob/main/LICENSE' # A URL to the main website for this project. - # ProjectUri = '' + ProjectUri = 'https://github.com/microsoft/Microsoft.AzureStack.Util.ConvertNetwork' # A URL to an icon representing this module. # IconUri = ''