Skip to content

Commit 3092a0c

Browse files
Merge pull request #1267 from Gijsreyn/gh-1263/main/add-cla-docs
Add section on building and testing from source to README and CLA agreement
2 parents 77f673a + 4d92a68 commit 3092a0c

File tree

2 files changed

+149
-0
lines changed

2 files changed

+149
-0
lines changed

CONTRIBUTING.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,153 @@ To run the link-checker, follow these steps:
6767
`npm install -g [email protected]`
6868
* run `find . \*.md -exec markdown-link-check {} \;`
6969

70+
## Contributing to Code
71+
72+
### Contributor License Agreement (CLA)
73+
74+
Contributions to the DSC repository requires signing the [Contributor License Agreement (CLA)][01].
75+
You can manually sign the CLA at any time. When you submit a pull request to this repository, the
76+
continuous integration will check whether you have already signed the CLA. If you haven't, the
77+
automation will prompt you to do so as a comment on your PR.
78+
79+
We can't accept any contributions without the author signing the CLA. Signing the CLA is a one-time
80+
requirement and applies to contributions to Microsoft open source repositories.
81+
82+
For more information, see [Contributor License Agreements][01].
83+
84+
[01]: https://cla.microsoft.com/
85+
86+
### Building and testing
87+
88+
#### Prerequisites
89+
90+
Building the DSC project requires PowerShell 7.2 or later to execute the build script. For more
91+
information about installing PowerShell, see [Install PowerShell on Windows, Linux, and macOS][02].
92+
93+
DSC requires other tools for building the project. The build script (`build.new.ps1`) installs the
94+
tools in the following table if they aren't already installed on your system:
95+
96+
| Tool | Version | Platforms | Projects |
97+
|:--------------------------------------------------------|:-------------:|:---------------------:|:-----------------------------------------------------|
98+
| [Rust toolchain][03] | Latest stable | Linux, macOS, Windows | All Rust crates |
99+
| [Visual Studio Build Tools for C++][04] | Latest stable | Windows | All Rust crates |
100+
| [`cargo audit`][05] | Latest stable | Linux, macOS, Windows | All Rust crates |
101+
| [Clippy][06] | Latest stable | Linux, macOS, Windows | All Rust crates |
102+
| [Tree-sitter CLI][07] | Latest stable | Linux, macOS, Windows | All grammars |
103+
| [NodeJS][08] | `v24` | Linux, macOS, Windows | All grammars |
104+
| [**Pester** PowerShell module][09] | Latest stable | Linux, macOS, Windows | All acceptance tests |
105+
| [**PSDesiredStateConfiguration** PowerShell module][10] | `v2.0.7` | Windows | `Microsoft.Windows/WindowsPowerShell` adapter tests |
106+
107+
[02]: https://learn.microsoft.com/powershell/scripting/install/installing-powershell
108+
[03]: https://rustup.rs/
109+
[04]: https://learn.microsoft.com/cpp/windows/latest-supported-vc-redist
110+
[05]: https://crates.io/crates/cargo-audit
111+
[06]: https://doc.rust-lang.org/clippy/index.html
112+
[07]: https://github.com/tree-sitter/tree-sitter/blob/master/crates/cli/README.md
113+
[08]: https://nodejs.org/
114+
[09]: https://pester.dev/
115+
[10]: https://www.powershellgallery.com/packages/PSDesiredStateConfiguration/2.0.7
116+
117+
#### Quick start
118+
119+
```powershell
120+
# Build the project
121+
./build.new.ps1
122+
123+
# Build with linting (recommended)
124+
./build.new.ps1 -Clippy
125+
126+
# Build and run all tests
127+
./build.new.ps1 -Clippy -Test
128+
129+
# Build in release mode (optimized)
130+
./build.new.ps1 -Release
131+
```
132+
133+
#### Running tests
134+
135+
DSCv3 includes Rust unit tests and PowerShell Pester tests:
136+
137+
```powershell
138+
# Run all tests
139+
./build.new.ps1 -Test
140+
141+
# Run only Rust tests
142+
./build.new.ps1 -Test -ExcludePesterTests
143+
144+
# Run only Pester tests
145+
./build.new.ps1 -Test -ExcludeRustTests
146+
147+
# Run specific Pester test groups
148+
./build.new.ps1 -SkipBuild -Test -ExcludeRustTests -PesterTestGroup dsc
149+
```
150+
151+
Available Pester test groups include:
152+
153+
- `dsc` - Acceptance tests for the `dsc` executable.
154+
- `adapters` - Acceptance tests for projects in the `adapters` folder.
155+
- `extensions` - Acceptance tests for projects in the `extensions` folder.
156+
- `resources` - Acceptance tests for projects in the `resources` folder.
157+
- `grammars` - Acceptance tests for projects in the `grammars` folder.
158+
159+
#### Cross-platform builds
160+
161+
By default, the build script compiles code for the current platform and architecture. You can build
162+
for other platforms and architectures with the `-Architecture` parameter:
163+
164+
```powershell
165+
# Windows ARM
166+
./build.new.ps1 -Architecture aarch64-pc-windows-msvc
167+
168+
# macOS Apple Silicon
169+
./build.new.ps1 -Architecture aarch64-apple-darwin
170+
171+
# Linux x64
172+
./build.new.ps1 -Architecture x86_64-unknown-linux-gnu
173+
```
174+
175+
#### Additional Information
176+
177+
For detailed build instructions, troubleshooting, and CI/CD workflows, see the
178+
[Build and Test Instructions](.github/instructions/instructions.md).
179+
180+
### Pull Request Guidelines
181+
182+
- Always create a pull request to the `main` branch of this repository.
183+
- Avoid making big pull requests. Before you invest a large amount of time, file an issue and start
184+
a discussion with the community.
185+
- Add a meaningful title to the PR describing what change you want to check in.
186+
- When you create a pull request, include a summary about your changes in the PR description. If
187+
the changes are related to an existing GitHub issue, please reference the issue in the PR
188+
description (e.g. `Fix #123`).
189+
- Please use the present tense and imperative mood when describing your changes:
190+
191+
- Instead of `Adding support for new feature`, write `Add support for new feature`.
192+
- Instead of `Fixed bug in parser`, write `Fix bug in parser`.
193+
194+
- If your change adds a new source file, ensure the appropriate copyright and license headers are
195+
included at the top of the file:
196+
197+
- For `.rs` files, use the copyright header with an empty line after it:
198+
199+
```rust
200+
// Copyright (c) Microsoft Corporation.
201+
// Licensed under the MIT License.
202+
203+
```
204+
205+
- For `.ps1` and `.psm1` files, use the copyright header with an empty line after it:
206+
207+
```powershell
208+
# Copyright (c) Microsoft Corporation.
209+
# Licensed under the MIT License.
210+
211+
```
212+
213+
* Create and update relevant tests when making code changes.
214+
* Run tests and ensure they're passing before opening a pull request.
215+
* All pull requests **must** pass CI checks before they can be merged.
216+
70217
## Code of Conduct Enforcement
71218

72219
Reports of abuse will be reviewed by the PS-Committee and if it has been determined that violations of the

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ To install DSC v3:
4242
1. Expand the release archive.
4343
1. Add the folder containing the expanded archive contents to the `PATH`.
4444

45+
For information on building and testing DSC from source, see the [Contributing Guide](CONTRIBUTING.md).
46+
4547
## Explore DSCv3
4648

4749
If you're new to DSC or configuration management, we recommend reviewing the [documentation][02].

0 commit comments

Comments
 (0)