Skip to content

Commit

Permalink
(doc) Updates Contributing.md with Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JPRuskin committed May 14, 2024
1 parent ca94cc7 commit 8b4666e
Showing 1 changed file with 43 additions and 16 deletions.
59 changes: 43 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,62 @@ This document outlines how to help with development of the Chocolatey Quickstart

## Development

When looking to make a change ensure any working branch is taken from `develop`. You can do this with the following:
When looking to make a change ensure any working branch is taken from the tip of `main`. You can do this with the following:

```powershell
git checkout develop
git fetch upstream
git rebase upstream/develop
git push origin
git checkout -b $NewBranchName
$ChocolateyUpstream = ((git remote -v) -match "github.com/chocolatey/choco-quickstart-scripts.git \(fetch\)$" -split "\t")[0]
git fetch $ChocolateyUpstream
git checkout -b $NewBranchName $ChocolateyUpstream/main
```

## Testing
### Development Testing

Test your changes before raising a Pull Request to merge your changes. In order to set things up for testing do the following:
You must test your changes before submitting a PR.

1. Set `$env:CHOCO_QSG_DEVELOP = $true`
1. The first step of the Guide will need amended to fetch from the `develop` branch:
You should test on a clean, supported operating system.

> NB: To save time in repeated testing from a clean environment, you can run the OfflineInstallPreparation script in your repository and copy the files directory before copying.
To test the quickstart environment:

1. Copy the repository directory over to `C:\choco-setup\files\` on the test machine. You do not need to copy the `.git` directory.
1. Open an elevated Windows PowerShell console.
1. Run `C:\choco-setup\files\Start-C4bSetup.ps1`, and continue through the guide steps as detailed in `README.md`.
1. Run `C:\choco-setup\files\Start-C4bVerification.ps1` and check that all tests pass.

## Testing a PR

Changes in a PR must be tested before merging. In order to set things up for testing do the following in an elevated Windows PowerShell terminal:

1. Set `$env:CHOCO_QSG_BRANCH` to the PR ID or Branch Name to download.
1. Run Quickstart Guide as documented, in the same session.

Example:

```powershell
$env:CHOCO_QSG_BRANCH = "< Insert PR ID or Upstream BranchName Here >"
Set-ExecutionPolicy Bypass -Scope Process -Force
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::tls12
$QuickStart = 'https://raw.githubusercontent.com/chocolatey/choco-quickstart-scripts/develop/Start-C4bSetup.ps1'
$Script = [System.Net.Webclient]::new().DownloadString($QuickStart)
$sb = [ScriptBlock]::Create($Script)
& $sb
Invoke-RestMethod "https://ch0.co/qsg-go" | Invoke-Expression
```

1. Perform each step of the Quickstart Guide, and make sure the changes you have attempted to make work appropriately.
1. Run `Start-C4bVerification.ps1` and check that all tests pass.
1. If everything looks OK, push your branch and create your Pull Request.

## SSL Certificates for testing
## Creating a PR

Push your branch to a fork or repository, and create a new PR [here](https://github.com/chocolatey/choco-quickstart-scripts/compare).

You should fill out the issue template as much as possible.

Reach out to Stephen, and he can generate a Let's Encrypt certificate for you.
### Rebasing Your Branch

If something else has been merged since you created your branch, you should rebase your branch onto the new tip of `main`. If you'd already pushed the branch, you may need to force-push the new history over the upstream version. You can do this as follows:

```powershell
$ChocolateyUpstream = ((git remote -v) -match "github.com/chocolatey/choco-quickstart-scripts.git \(fetch\)$" -split "\t")[0]
git fetch $ChocolateyUpstream
git rebase $ChocolateyUpstream\main --autostash
```

0 comments on commit 8b4666e

Please sign in to comment.