-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add check for branch name in CI and with git hooks (#150)
* add pre-commit hooks in .githooks folder * test branch name validation github action * correction of github action because of no on action and no jobs * add mandatory runs-on * Update CONTRIBUTING.md for description of supported branch names * Make pre-commit executable * correction of installer because of CONTRIBUTING.txt rename to CONTRIBUTING.md Co-authored-by: Florian Omnes <[email protected]>
- Loading branch information
Showing
5 changed files
with
68 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
LC_ALL=C | ||
|
||
local_branch="$(git rev-parse --abbrev-ref HEAD)" | ||
|
||
valid_branch_regex="^(feature|features|fix|release)\/[a-z0-9._-]+$" | ||
|
||
message="There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. Your commit will be rejected. You should rename your branch to a valid name and try again." | ||
|
||
if [[ ! $local_branch =~ $valid_branch_regex ]] | ||
then | ||
echo "$message" | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Branch name validation | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
|
||
valid-branch-name: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: deepakputhraya/action-branch-name@master | ||
with: | ||
regex: '([a-z])+\/([a-z])+' # Regex the branch should match. This example enforces grouping | ||
allowed_prefixes: 'feature,features,fix,release' # All branches should start with the given prefix | ||
ignore: master,develop # Ignore exactly matching branch names from convention |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# How to contribute to Antares Simulator | ||
|
||
## Reporting bug | ||
- Make sure that the bug was not already reported by searching on GitHub under [Issues](https://github.com/AntaresSimulatorTeam/Antares_Simulator/issues). | ||
|
||
- If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/AntaresSimulatorTeam/Antares_Simulator/issues/new). You must provide : | ||
- description of bug and unexpected behavior | ||
- expected behavior | ||
- small antares study to reproduce unexpected behavior | ||
- Antares Simulator version and OS used | ||
|
||
|
||
## Developpement | ||
Antares Simulator team will be pleased to have some developpers join our project. | ||
|
||
You can find all steps needed for compilation and installation of Antares Simulator in [INSTALL.md](INSTALL.md). | ||
|
||
### Branch names | ||
Currently CI is runned only for specific branch names : | ||
- `feature/*` | ||
- `features/*` | ||
- `fix/*` | ||
- `release/*` | ||
|
||
If you create a branch with a different name no CI will be runned but you should receive an email indicating that your branch name is incorrect. | ||
|
||
In order to avoid pushing with invalid branch name, a git hooks is provided for pre-commit check. This hooks is available in `.githooks` directory. | ||
|
||
By default git use hooks in `.git/hooks` directory which is not under version control. You can define a new hooks directory with this command in Antares Simulator root directory : | ||
``` | ||
git config core.hooksPath .githooks | ||
``` | ||
|
||
### Code formatting | ||
We're using [clang-format](https://clang.llvm.org/docs/ClangFormat.html) to format code. Rules are defined in [.clang-format](src/.clang-format) file. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters