Skip to content

Commit

Permalink
docs: add contributing section
Browse files Browse the repository at this point in the history
  • Loading branch information
fallion committed Jun 25, 2020
1 parent 14e7b3f commit e6f39a7
Show file tree
Hide file tree
Showing 15 changed files with 564 additions and 56 deletions.
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Contributing

Contributions are most welcome. Please check the [CONTRIBUTING](https://commitsar.tech/docs/contributing/get_started) section of documentation.
1 change: 1 addition & 0 deletions FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: fallion
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@

Tool to make sure your commits are compliant with [conventional commits](https://www.conventionalcommits.org). It is aimed mainly at CIs to prevent branches with commits that don't comply. Usage as a pre-commit hook is also under consideration.

## Table of contents
## Usage

1. [Usage](#usage)
Please check [Documentation](https://commitsar.tech).

## Usage
## Contributing

Contributions are most welcome. Please check the [CONTRIBUTING](https://commitsar.tech/docs/contributing/get_started) section of documentation.

## Sponsoring

Please check [Documentation](https://commitsar.tech).
If you feel like showing even more support for this project you can sponsor it using the Sponsor button on Github. A little help goes a long way when it comes with OSS and it'll help support this project.
11 changes: 0 additions & 11 deletions www/blog/2019-05-28-hola.md

This file was deleted.

17 changes: 0 additions & 17 deletions www/blog/2019-05-29-hello-world.md

This file was deleted.

13 changes: 0 additions & 13 deletions www/blog/2019-05-30-welcome.md

This file was deleted.

28 changes: 28 additions & 0 deletions www/docs/contributing/filtering.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
id: filtering
title: How commit filtering works
---

import Mermaid from "@theme/Mermaid";

<Mermaid
chart={`
graph TD
A(First commit on master) --> B(merge branch feat/docs into master)
B-->C(Third commit on master)
B-->|branch| D(first commit on branch)
D-->E(second commit on branch)
E-->F(merge master into branch)
C-->F
`}
/>

### Branch diff

By default commitsar will run git log on the base branch and the branch which is going to get merged and gets a diff of the commit objects.
This allows us to get commits only on the branch iregardless of what was merged from master.

### Filtering by type

In the above example when running commitsar on master or the branch the commit `merge branch feat/docs into master` and `merge master into branch` will get filtered out.
This is to prevent commitsar checking the default merge commits which are not going to be conventional commit compliant.
34 changes: 34 additions & 0 deletions www/docs/contributing/get_started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
id: get_started
title: Get started
---

## Requirements

- [Go](https://golang.org/) (See pinned version in go.mod)
- [git](https://git-scm.com/) (while git is not required to run commitsar it is needed to set up tests)

This project also uses [magefiles](https://magefile.org/). To get up and running please run: `go install github.com/magefile/mage`. These allow us to set up templates and cross-platform commands.

## Running tests

Run `mage test`. This will git clone all git bundles and run tests in the entire repo. To run single tests use the VSCode functionality or provide full path to `go test`.

## Git bundles

In order to test commitsar against complicated real-life examples we use [git bundles](https://git-scm.com/docs/git-bundle). These can be `git cloned` like real repositories. They allow us to created real history and prevent edge cases that can happen when creating git history using shell (all commits have same timestamp for example).

### Creating a new bundle

- create a new folder testdata/
- cd into it
- git initgitz
- commit away
- once ready run `git bundle create name_of_repo.bundle --all`
- copy the bundle to testdata/

All files outside of .bundle files are ignore in the testdata folder so you don't have to worry about cleanup.

## Commit style

This project uses the [conventional commit style](https://www.conventionalcommits.org/en/v1.0.0/), it is also the default style commitsar uses.
22 changes: 22 additions & 0 deletions www/docs/contributing/pipelines.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
id: pipelines
title: Worker pipelines
---

Commitsar uses pipelines in order to use as much CPU power as possible. These are based on number of CPU \* 2 (assuming 1 physical and 1 logical core available). In order to add a new pipeline
you just need to build a pipeline that adheres to the types provided here: https://github.com/aevea/commitsar/blob/master/internal/dispatcher/pipeline.go and register it in the root_runner.
Each pipeline returns either a success type or pushes errors into the error channel.

At the end all of this is collected and the results are presented to the user.

This will also be used to introduce an easy plugin system in the future.

import Mermaid from "@theme/Mermaid";

<Mermaid
chart={`
graph TD
A(Dispatcher)-->B(Commit pipeline)
A-->C(PR title pipeline)
`}
/>
4 changes: 2 additions & 2 deletions www/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ title: Introduction

Tool to make sure your commits are compliant with [conventional commits](https://www.conventionalcommits.org). It is aimed mainly at CIs to prevent branches with commits that don't comply. Usage as a pre-commit hook is also under consideration.

# Usage
## Usage

Commitsar is shipped as a Dockerfile. This is the easiest way to add it to your CI.

**Important: Commitsar currently needs to be run in the same folder as the git repository you want checked, currently no override is provided for setting path to git repo see https://github.com/aevea/commitsar/issues/93**
**Important: Commitsar currently needs to be run in the same folder as the git repository you want checked, currently no override is provided for setting path to git repo see https://github.com/aevea/commitsar/issues/93**
2 changes: 2 additions & 0 deletions www/docs/usage/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
id: source
title: Building from source
---

TODO
3 changes: 2 additions & 1 deletion www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@docusaurus/core": "2.0.0-alpha.58",
"@docusaurus/preset-classic": "2.0.0-alpha.58",
"classnames": "2.2.6",
"mermaid": "^8.5.2",
"react": "16.13.1",
"react-dom": "16.13.1"
},
Expand All @@ -26,4 +27,4 @@
"last 1 safari version"
]
}
}
}
10 changes: 6 additions & 4 deletions www/sidebars.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
someSidebar: {
Introduction: ["intro"],
"Usage": [
Usage: [
"usage/gobinaries",
"usage/docker",
"usage/github",
Expand All @@ -10,9 +10,11 @@ module.exports = {
"usage/binary",
"usage/source",
],
Configuration: [
"configuration/flags",
"configuration/config-file",
Configuration: ["configuration/flags", "configuration/config-file"],
Contributing: [
"contributing/get_started",
"contributing/filtering",
"contributing/pipelines",
],
},
};
15 changes: 15 additions & 0 deletions www/src/theme/Mermaid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React, { useEffect } from "react";
import mermaid from "mermaid";

mermaid.initialize({
startOnLoad: true,
});

const Mermaid = ({ chart }) => {
useEffect(() => {
mermaid.contentLoaded();
}, []);
return <div className="mermaid">{chart}</div>;
};

export default Mermaid;
Loading

1 comment on commit e6f39a7

@vercel
Copy link

@vercel vercel bot commented on e6f39a7 Jun 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.