diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..f9ba8cf65f --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,9 @@ +# Microsoft Open Source Code of Conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). + +Resources: + +- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) +- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cce3c8b57e..55ddd5386d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,6 +30,8 @@ Check out the links below to get started. - GitHub Help: - [Git and GitHub learning resources][learn-git]. - [GitHub Flow Guide][github-flow]. + - [Fork a repo][github-fork]. + - [About Pull Requests][github-pr]. ## Contributing to issues @@ -43,6 +45,26 @@ Check out the links below to get started. - Be prepared to discuss a feature and take feedback. - Include unit tests and updates documentation to complement the change. +When you are ready to contribute a fix or feature: + +- Start by [forking the PSRule repo][github-fork]. +- Create a new branch from master in your fork. +- Add commits in your branch. + - If you have updated module code also update `CHANGELOG.md`. + - You don't need to update the `CHANGELOG.md` for changes to unit tests or documentation. + - Try building your changes locally. See [building from source][build] for instructions. +- [Create a pull request][github-pr-create] to merge changes into the PSRule `master` branch. + - If you are _ready_ for your changes to be reviewed create a _pull request_. + - If you are _not ready_ for your changes to be reviewed, create a _draft pull request_. + - An continuous integration (CI) process will automatically build your changes. + - You changes must build successfully to be merged. + - If you have any build errors, push new commits to your branch. + - Avoid using forced pushes or squashing changes while in review, as this makes reviewing your changes harder. + [learn-git]: https://help.github.com/en/articles/git-and-github-learning-resources [github-flow]: https://guides.github.com/introduction/flow/ [github-signup]: https://github.com/signup/free +[github-fork]: https://help.github.com/en/github/getting-started-with-github/fork-a-repo +[github-pr]: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests +[github-pr-create]: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork +[build]: docs/scenarios/install-instructions.md#building-from-source diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000000..25c49dee7b --- /dev/null +++ b/build.ps1 @@ -0,0 +1,10 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +# Note: +# This manually builds the project locally + +. ./.azure-pipelines/pipeline-deps.ps1 +Invoke-Build Test -AssertStyle Client + +Write-Host "If no build errors occured. The module has been saved to out/modules/PSRule" diff --git a/docs/scenarios/install-instructions.md b/docs/scenarios/install-instructions.md index 5cd0b1070e..a84e5d05b6 100644 --- a/docs/scenarios/install-instructions.md +++ b/docs/scenarios/install-instructions.md @@ -50,6 +50,34 @@ code --install-extension bewhite.psrule-vscode-preview For detailed instructions, follow the steps in the [Visual Studio Code documentation][vscode-ext-gallery]. +## Building from source + +To build this module from source run `./build.ps1`. +This build script will compile the module and documentation then output the result into `out/modules/PSRule`. + +The following PowerShell modules will be automatically downloaded if the required versions are not present: + +- PlatyPS +- Pester +- PSScriptAnalyzer +- PowerShellGet +- PackageManagement +- InvokeBuild + +These additional modules are only required for building PSRule and are not required for running PSRule. + +If you are on a network that does not permit Internet access to the PowerShell Gallery, download these modules on an alternative device that has access. +The following script can be used to download the required modules to an alternative device. +After downloading the modules copy the module directories to devices with restricted Internet access. + +```powershell +# Save modules, in the .\modules directory +Save-Module -Name PlatyPS, Pester, PSScriptAnalyzer, PowerShellGet, PackageManagement, InvokeBuild -Repository PSGallery -Path '.\modules'; +``` + +Additionally .NET Core SDK v2.1 is required. .NET Core will not be automatically downloaded and installed. +To download and install .NET Core SDK see [Download .NET Core 2.1](https://dotnet.microsoft.com/download/dotnet-core/2.1). + [module-psrule]: https://www.powershellgallery.com/packages/PSRule [ext-psrule]: https://marketplace.visualstudio.com/items?itemName=bewhite.psrule-vscode-preview [vscode-ext-gallery]: https://code.visualstudio.com/docs/editor/extension-gallery