Skip to content

Commit c4461fb

Browse files
authored
Merge pull request #3464 from arturcic/main
#3463 - updated CONTRIBUTING
2 parents bba0a5d + f0ebcec commit c4461fb

File tree

2 files changed

+66
-49
lines changed

2 files changed

+66
-49
lines changed

CONTRIBUTING.md

Lines changed: 59 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
We love contributions to get started contributing you might need:
44

5-
* [Get started with git](http://rogerdudler.github.io/git-guide)
5+
* [Get started with git](https://rogerdudler.github.io/git-guide)
66
* [How to create a pull request](https://help.github.com/articles/using-pull-requests)
7-
* [An issue to work on](https://github.com/GitTools/GitVersion/labels/up-for-grabs) - We are on [Up for grabs](http://up-for-grabs.net/), our up for grabs issues are tagged `up-for-grabs`
8-
* An understanding of our [architecture](http://gitversion.net/docs/learn/how-it-works#architecture) and how [we write tests](#writing-tests)
7+
* [An issue to work on](https://github.com/GitTools/GitVersion/labels/up-for-grabs) - We are on [Up for grabs](https://up-for-grabs.net/), our up for grabs issues are tagged `up-for-grabs`
8+
* An understanding of our [architecture](https://gitversion.net/docs/learn/how-it-works#architecture) and how [we write tests](#writing-tests)
99

1010
Once you know how to create a pull request and have an issue to work on, just post a comment saying you will work on it.
1111
If you end up not being able to complete the task, please post another comment so others can pick it up.
@@ -23,7 +23,7 @@ Issues are also welcome, [failing tests](#writing-tests) are even more welcome.
2323

2424
## How it works
2525

26-
See [how it works](http://gitversion.net/docs/learn/how-it-works/) in GitVersion's documentation
26+
See [how it works](https://gitversion.net/docs/learn/how-it-works) in GitVersion's documentation
2727

2828
## Writing Tests
2929

@@ -39,7 +39,25 @@ Find where your issue would logically sit. Or create a new scenario class if it
3939

4040
We are currently using NUnit, so just create a descriptive test method and attribute it with `[Test]`
4141

42-
### 3. Use a fixture
42+
### 3. Create a configuration
43+
44+
We use a builder pattern to create a configuration. You can use the `GitFlowConfigurationBuilder` or `GitHubConfigurationBuilder` or `EmptyConfigurationBuilder` to create a configuration builder.
45+
46+
```csharp
47+
var configurationBuilder = GitFlowConfigurationBuilder.New;
48+
```
49+
50+
We can then customize the configuration by chaining methods of the builder. At the end we build the configuration.
51+
52+
For example:
53+
```csharp
54+
var configuration = configurationBuilder
55+
.WithVersioningMode(VersioningMode.ContinuousDeployment)
56+
.WithNextVersion("1.0.0")
57+
.Build();
58+
```
59+
60+
### 4. Use a fixture
4361

4462
We have a few fixtures for different scenarios.
4563

@@ -50,15 +68,9 @@ We have a few fixtures for different scenarios.
5068
You can use a fixture by just `using` it. Like this
5169

5270
```csharp
53-
using (var fixture = new EmptyRepositoryFixture(new Config()))
54-
{
55-
}
71+
using var repo = new EmptyRepositoryFixture();
5672
```
5773

58-
### 4. Customize config
59-
60-
If you are using non-default configuration just modify the `Config` class before creating the fixture
61-
6274
### 5. Writing the scenario
6375

6476
We have a number of extension method off `IRepository` to make it easy to write tests at the flow level and not worry about creating/commiting files.
@@ -72,7 +84,7 @@ fixture.Repository.Checkout("feature-test");
7284
fixture.Repository.MakeACommit();
7385
fixture.Repository.MakeCommits(4);
7486

75-
fixture.AssertFullSemver("1.0.1-test.1+5");
87+
fixture.AssertFullSemver("1.0.1-test.1-5", configuration);
7688
```
7789

7890
The last line is the most important. `AssertFullSemver` will run GitVersion and assert that the full SemVer it calculates is what you expect.
@@ -81,47 +93,49 @@ The last line is the most important. `AssertFullSemver` will run GitVersion and
8193

8294
Even better include the fix, but a failing test is a great start
8395

84-
## Build / Release Process
85-
86-
We use Cake for our build and deployment process. The way the build / release process is setup is:
87-
88-
1. We build releasable artifacts on AppVeyor
89-
2. Login to AppVeyor
90-
3. Deploy the latest main build
91-
![docs/input/docs/img/release-1-deploy.png](docs/input/docs/img/release-1-deploy.png)
92-
4. Choose GitVersion release, when you press deploy it will create a _non-released_ GitHub release, this _will not_ create a Git tag. This step is so we can validate the release and release notes before pushing the button.
93-
![docs/input/docs/img/release-2-deploy.png](docs/input/docs/img/release-2-deploy.png)
94-
5. All the artifacts should upload nicely
95-
![docs/input/docs/img/release-3-deploy.png](docs/input/docs/img/release-3-deploy.png)
96-
6. Head over to GitHub releases, you should have a draft release, download a copy of the release notes
97-
![docs/input/docs/img/release-4-deploy.png](docs/input/docs/img/release-4-deploy.png)
98-
7. Edit the release and do the following:
99-
1. Remove the build metadata from the tag and title (the + and everything after it)
100-
2. Paste the downloaded release notes in, you can clean them up if you want otherwise there may be closed issues which were questions etc.
101-
3. Tick the pre-release box if it's pre-release
102-
4. Press Publish
103-
8. Publishing tags (a git tag) the release commit, this will trigger another appveyor build which only builds tags, this build uses deploy.cake. It downloads the artifacts from that GitHub release, then performs the release
104-
105-
## Docker
106-
107-
It is a manual release step after the release now, first download the appropriate ZIP and put into a `releaseArtifacts` folder in the GitVersion repository, then run:
108-
109-
```bash
110-
docker build . --build-arg GitVersionZip=GitVersion_<VERSION>.zip --tag gittools/gitversion
111-
```
96+
## Release Process
97+
98+
We use Cake for our build and deployment process. The way the release process is setup is:
99+
100+
1. We build releasable artifacts with GitHub Actions
101+
2. We create a milestone for the release if it's not already created. Our milestones are named using the semver.
102+
For example `5.12.0` or `6.0.0-beta.2`
103+
3. We move all the closed issues and closed pull requests that are going to be included in the release to the milestone.
104+
4. We check that all the issues and pull requests that are going to be included in the release have a label assigned,
105+
otherwise it will fail the release.
106+
5. We create a release in the GitHub UI, and create a tag and name it using the milestone name. For example `5.12.0` or `6.0.0-beta.2`
107+
6. We specify if the release is a pre-release or latest release in the GitHub UI.
108+
7. We publish the release.
109+
8. The GitHub Actions will create a GitHub release and publish the artifacts to NuGet, Chocolatey, Docker, Homebrew
110+
and other distribution channels.
111+
9. The issues and pull requests will get updated with message specifying in which release it was included.
112112

113113
## Code Style
114114

115115
In order to apply the code style defined by by the `.editorconfig` file you can use [`dotnet-format`](https://github.com/dotnet/format).
116116

117-
1. Install [`dotnet-format`](https://github.com/dotnet/format) as a global tool:
117+
Change to the root folder of the GitVersion repository and use the following command to apply the code style:
118+
119+
```shell
120+
dotnet format ./src/ --exclude **/AddFormats/
121+
```
122+
123+
## Documentation
124+
125+
The documentation is stored in the repository under the [`docs`](docs) folder.
126+
Have a look at the [documentation readme file](docs/readme.md) for guidance.
127+
128+
In order to check locally how the documentation looks like you can use the following command:
118129

119130
```shell
120-
dotnet tool install -g dotnet-format
131+
./build.ps1 -Stage docs -Target PreviewDocs
121132
```
122133

123-
2. Change to the root folder of the GitVersion repository and use the following command to apply the code style:
134+
## Schemas generation
135+
136+
If there are changes to the GitVersionVariables or to the GitVersionConfiguration, the following command should be executed to update the schema files:
124137

125138
```shell
126-
dotnet format ./ --folder --exclude **/AddFormats/ --fix-codestyle
139+
./build.ps1 -Stage build -Target BuildPrepare
140+
./build.ps1 -Stage docs -Target GenerateSchemas
127141
```

docs/readme.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@ expected.
1717

1818
## Serving the documentation locally
1919

20-
To serve up the documentation locally, you need to run the `build.ps1` script
21-
with the arguments `-Target Preview-Documentation`.
20+
To serve up the documentation locally, you need to run the script
21+
22+
```shell
23+
./build.ps1 -Stage docs -Target PreviewDocs
24+
```
2225

2326
### On Windows
2427

2528
On Windows, you need to run the following build command in a PowerShell
2629
terminal:
2730

2831
```shell
29-
.\build.ps1 -Target Preview-Documentation
32+
./build.ps1 -Stage docs -Target PreviewDocs
3033
```
3134

3235
### On Unix
@@ -35,7 +38,7 @@ First you need to [install PowerShell on macOS][ps-mac] or [Linux][ps-linux],
3538
then execute the following command:
3639

3740
```shell
38-
pwsh build.ps1 -Target Preview-Documentation
41+
pwsh ./build.ps1 -Stage docs -Target PreviewDocs
3942
```
4043

4144
After pressing enter, the documentation will be generated and then served under

0 commit comments

Comments
 (0)