Skip to content

Commit

Permalink
Merge pull request #1 from LerianStudio/develop
Browse files Browse the repository at this point in the history
First Pull Request: Initial Commit for Midaz
  • Loading branch information
ferr3ira-gabriel authored May 17, 2024
2 parents 92b9d76 + 90fb1ec commit 96bec66
Show file tree
Hide file tree
Showing 236 changed files with 19,894 additions and 24 deletions.
52 changes: 52 additions & 0 deletions .githooks/commit-msg/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/sh
#
# Add a specific emoji to the end of the first line in every commit message
# based on the conventional commits keyword.

if [ ! -f "$1" ] || grep -q "fixup!" "$1"; then
# Exit if we didn't get a target file for some reason
# or we have a fixup commit
exit 0
fi

KEYWORD=$(head -n 1 "$1" | awk '{print $1}' | sed -e 's/://')

case $KEYWORD in
"feat"|"feat("*)
EMOJI=":sparkles:"
;;
"fix"|"fix("*)
EMOJI=":bug:"
;;
"docs"|"docs("*)
EMOJI=":books:"
;;
"style"|"style("*)
EMOJI=":gem:"
;;
"refactor"|"refactor("*)
EMOJI=":hammer:"
;;
"perf"|"perf("*)
EMOJI=":rocket:"
;;
"test"|"test("*)
EMOJI=":rotating_light:"
;;
"build"|"build("*)
EMOJI=":package:"
;;
"ci"|"ci("*)
EMOJI=":construction_worker:"
;;
"chore"|"chore("*)
EMOJI=":wrench:"
;;
*)
EMOJI=""
;;
esac

MESSAGE=$(sed -E "1s/(.*)/\\1 $EMOJI/" <"$1")

echo "$MESSAGE" >"$1"
51 changes: 51 additions & 0 deletions .githooks/pre-commit/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

source "$PWD"/common/shell/colors.sh
source "$PWD"/common/shell/ascii.sh

branch=$(git rev-parse --abbrev-ref HEAD)

if [[ $branch == "main" || $branch == "develop" || $branch == release/* ]]; then
echo "${bold}You can't commit directly to protected branches"
exit 1
fi

commit_msg_type_regex='feature|fix|refactor|style|test|docs|build'
commit_msg_scope_regex='.{1,20}'
commit_msg_description_regex='.{1,100}'
commit_msg_regex="^(${commit_msg_type_regex})(\(${commit_msg_scope_regex}\))?: (${commit_msg_description_regex})\$"
merge_msg_regex="^Merge branch '.+'\$"

zero_commit="0000000000000000000000000000000000000000"

# Do not traverse over commits that are already in the repository
excludeExisting="--not --all"

error=""
while read oldrev newrev refname; do
# branch or tag get deleted
if [ "$newrev" = "$zero_commit" ]; then
continue
fi

# Check for new branch or tag
if [ "$oldrev" = "$zero_commit" ]; then
rev_span=$(git rev-list $newrev $excludeExisting)
else
rev_span=$(git rev-list $oldrev..$newrev $excludeExisting)
fi

for commit in $rev_span; do
commit_msg_header=$(git show -s --format=%s $commit)
if ! [[ "$commit_msg_header" =~ (${commit_msg_regex})|(${merge_msg_regex}) ]]; then
echo "$commit" >&2
echo "ERROR: Invalid commit message format" >&2
echo "$commit_msg_header" >&2
error="true"
fi
done
done

if [ -n "$error" ]; then
exit 1
fi
17 changes: 17 additions & 0 deletions .githooks/pre-push/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

source "$PWD"/common/shell/colors.sh
source "$PWD"/common/shell/ascii.sh

while read local_ref local_sha remote_ref remote_sha; do
if [[ "$local_ref" =~ ^refs/heads/ ]]; then
branch_name=$(echo "$local_ref" | sed 's|^refs/heads/||')

if [[ ! "$branch_name" =~ ^(feature|fix|hotfix|docs|refactor|build|test)/.*$ ]]; then
echo "${bold}Branch names must start with 'feature/', 'fix/', 'refactor/', 'docs/', 'test/' or 'hotfix/' followed by either a task id or feature name."
exit 1
fi
fi
done

exit 0
21 changes: 21 additions & 0 deletions .githooks/pre-receive/pre-receive
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

zero_commit="0000000000000000000000000000000000000000"

while read oldrev newrev refname; do

if [[ $oldrev == $zero_commit ]]; then
continue
fi

if [[ $refname == "refs/heads/main" && $newrev != $zero_commit ]]; then
branch_name=$(basename $refname)

if [[ $branch_name == release/* ]]; then
continue
else
echo "Error: You can only merge branches that start with 'release/' into the main branch."
exit 1
fi
fi
done
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Default owners for the entire repository
* @LerianStudio/Dev @LerianStudio/Devops

# Owners for specific directories and files
.github/* @LerianStudio/Devops
.githooks/* @LerianStudio/Devops
components/* @LerianStudio/Dev
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [LerianStudio]
80 changes: 80 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG-REPORT.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: "🐛 Bug Report"
description: Create a new ticket for a bug.
title: "🐛 [BUG] - <title>"
labels: [
"bug"
]
body:
- type: textarea
id: description
attributes:
label: "Description"
description: Please enter an explicit description of your issue
placeholder: Short and explicit description of your incident...
validations:
required: true
- type: input
id: reprod-url
attributes:
label: "Reproduction URL"
description: Please enter your GitHub URL to provide a reproduction of the issue
placeholder: ex. https://github.com/USERNAME/REPO-NAME
validations:
required: true
- type: textarea
id: reprod
attributes:
label: "Reproduction steps"
description: Please enter an explicit description of your issue
value: |
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
render: bash
validations:
required: true
- type: textarea
id: screenshot
attributes:
label: "Screenshots"
description: If applicable, add screenshots to help explain your problem.
value: |
![DESCRIPTION](LINK.png)
render: bash
validations:
required: false
- type: textarea
id: logs
attributes:
label: "Logs"
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: bash
validations:
required: false
- type: dropdown
id: browsers
attributes:
label: "Browsers"
description: What browsers are you seeing the problem on ?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
- Opera
validations:
required: false
- type: dropdown
id: os
attributes:
label: "OS"
description: What is the impacted environment ?
multiple: true
options:
- Windows
- Linux
- Mac
validations:
required: false
63 changes: 63 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE-REQUEST.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: "💡 Feature Request"
description: Create a new ticket for a new feature request
title: "💡 [REQUEST] - <title>"
labels: [
"feature"
]
body:
- type: input
id: start_date
attributes:
label: "Start Date"
description: Start of development
placeholder: "month/day/year"
validations:
required: false
- type: textarea
id: implementation_pr
attributes:
label: "Implementation PR"
description: Pull request used
placeholder: "#Pull Request ID"
validations:
required: false
- type: textarea
id: reference_issues
attributes:
label: "Reference Issues"
description: Common issues
placeholder: "#Issues IDs"
validations:
required: false
- type: textarea
id: summary
attributes:
label: "Summary"
description: Provide a brief explanation of the feature
placeholder: Describe in a few lines your feature request
validations:
required: true
- type: textarea
id: basic_example
attributes:
label: "Basic Example"
description: Indicate here some basic examples of your feature.
placeholder: A few specific words about your feature request.
validations:
required: true
- type: textarea
id: drawbacks
attributes:
label: "Drawbacks"
description: What are the drawbacks/impacts of your feature request ?
placeholder: Identify the drawbacks and impacts while being neutral on your feature request
validations:
required: true
- type: textarea
id: unresolved_question
attributes:
label: "Unresolved questions"
description: What questions still remain unresolved ?
placeholder: Identify any unresolved issues.
validations:
required: false
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
target-branch: "develop"
26 changes: 26 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Midaz Pull Request Checklist

## Pull Request Type
[//]: # (Check the appropriate box for the type of pull request.)

- [ ] Ledger
- [ ] Auth
- [ ] Mdz
- [ ] Transaction
- [ ] Pipeline
- [ ] Documentation

## Checklist
Please check each item after it's completed.

- [ ] I have tested these changes locally.
- [ ] I have updated the documentation accordingly.
- [ ] I have added necessary comments to the code, especially in complex areas.
- [ ] I have ensured that my changes adhere to the project's coding standards.
- [ ] I have checked for any potential security issues.
- [ ] I have ensured that all tests pass.
- [ ] I have updated the version appropriately (if applicable).
- [ ] I have confirmed this code is ready for review.

## Additional Notes
[//]: # (Add any additional notes, context, or explanation that could be helpful for reviewers.)
Loading

0 comments on commit 96bec66

Please sign in to comment.