chore: Add used utility files

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb 2024-06-26 23:02:11 +03:00
parent 0c90ef795b
commit e6a6c0e18b
Signed by: awiteb
GPG key ID: 3F6B55640AA6682F
3 changed files with 204 additions and 0 deletions

37
Justfile Normal file
View file

@ -0,0 +1,37 @@
# This justfile is for the contrbutors of this project, not for the end user.
#
# Requirements for this justfile:
# - Linux distribution
# - just (Of course) <https://github.com/casey/just>
# - cargo (For the build and tests) <https://doc.rust-lang.org/cargo/getting-started/installation.html>
set shell := ["/usr/bin/bash", "-c"]
JUST_EXECUTABLE := "just -u -f " + justfile()
header := "Available tasks:\n"
# Get the MSRV from the Cargo.toml
msrv := `cat Cargo.toml | grep "rust-version" | sed 's/.*"\(.*\)".*/\1/'`
_default:
@{{JUST_EXECUTABLE}} --list-heading "{{header}}" --list
# Run the CI
@ci: && msrv
cargo build --all-targets
cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
# Check that the current MSRV is correct
@msrv:
rustup toolchain install {{msrv}}
echo "Checking MSRV ({{msrv}})"
cargo +{{msrv}} check -q --workspace
echo "MSRV is correct"
run:
docker-compose up -d db
RUST_LOG=debug cargo run -p oxidetalis -- --config config.toml
[private]
alias r := run

110
cliff.toml Normal file
View file

@ -0,0 +1,110 @@
[changelog]
body = """
{# Check if there is a `BREAKING-CHANGE` footer in the message or not #}\
{% macro is_breaking(commit) %}\
{{"BREAKING-CHANGE" in commit.message}}\
{% endmacro is_breaking %}\
{# Return the commit header #}\
{% macro commit_header(commit) %}\
{{commit.message | split(pat="\n") | nth(n=0) | upper_first }}\
{% endmacro commit_header %}\
{# Return the `BREAKING-CHANGE` footer message #}\
{% macro bc_des(commit) %}\
{% set lines = [] %}\
{% set found_breaking = false %}\
{% for line in commit.message | split(pat="\n") %}\
{% if found_breaking and line is not containing(":") %}\
{% set_global lines = lines | concat(with=line) %}\
{% elif found_breaking and line is containing(":") %}\
{% set_global found_breaking = false %}\
{% endif %}\
{% if line is starting_with("BREAKING-CHANGE") %}\
{% set_global found_breaking = true %}\
{% set breaking_line = line | split(pat=":") | nth(n=1) %}\
{% set_global lines = lines | concat(with=breaking_line) %}\
{% endif %}\
{% endfor %}\
{% if lines | length != 0 %}\
{{ lines | join(sep="\n") | trim_end(pat="\n") }}\
{% endif %}\
{% endmacro bc_des %}\
{% if version %}\
{% if previous.version %}\
## [{{ version | trim_start_matches(pat="v") }}](<REPO>/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%Y-%m-%d") }}
{% endif %}\
{% else %}\
## unreleased
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}\
### {{ group | upper_first }}
{% for commit in commits | sort(attribute="message") %}\
- {{ self::commit_header(commit=commit) }} ([`{{ commit.id | truncate(length=7, end="") }}`](<REPO>/commit/{{ commit.id }}))
{% if self::is_breaking(commit=commit) == "true" %}\
\t- **BC**: {{self::bc_des(commit=commit)}}
{% endif %}\
{% endfor %}\
{% endfor %}\n
"""
footer = """
This changelog was generated by [git-cliff](https://github.com/orhun/git-cliff)
"""
header = """
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n
"""
postprocessors = [
{pattern = '<REPO>', replace = "https://git.4rs.nl/oxidetalis/oxidetalis"},
{pattern = '- (\w+)(\(\w+\))?:', replace = "- "}, # Remove the type
{pattern = '- \((\w+)\):', replace = "- (**$1**)"}, # Make the scope blod
{pattern = "\t", replace = " "},
]
# remove the leading and trailing whitespace from the template
trim = true
[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = false
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
{pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([**#${2}**](<REPO>/issues/${2}))"}, # replace issue numbers (Note the PR is also an issue in Forgejo, so this will also link to PRs)
{pattern = ' +$', replace = ""}, # Remove trailing whitespace.
{pattern = ' +', replace = " "}, # Replace multiple spaces with a single space.
]
# regex for parsing and grouping commits
commit_parsers = [
{message = "^feat", group = "Added"},
{message = "^fix", group = "Fixed"},
{message = "^(refactor|change)", group = "Changed"},
{message = "^deprecate", group = "Deprecated"},
{message = "^remove", group = "Removed"},
{message = "^security", group = "Security"},
]
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# regex for matching git tags
tag_pattern = "v[0-9]+\\.[0-9]+\\.[0-9]+"
# regex for skipping tags
skip_tags = ""
# regex for ignoring tags
ignore_tags = "v[0-9]+\\.[0-9]+\\.[0-9]+-(alpha|beta|rc)(\\.[0-9]+)?"
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"

57
sumi.toml Normal file
View file

@ -0,0 +1,57 @@
# git-sumi ~ configuration file
# Config: https://sumi.rs/docs/configuration
# Rules: https://sumi.rs/docs/rules
# Suppresses progress messages.
quiet = false
# Displays parsed commit message.
display = true
# Sets display format: cli, json, table, toml.
format = "cli"
# Processes each non-empty line as an individual commit.
split_lines = false
# Rule: Include one valid Gitmoji.
# See https://gitmoji.dev/.
gitmoji = false
# Rule: Description must start with the specified case.
# Options: 'any', 'lower', 'upper'.
description_case = "upper"
# Rule: Use the imperative mood in the description.
# Example: 'Fix bug' instead of 'Fixed bug'.
imperative = true
# Rule: Do not end commit header with a period.
no_period = true
# Rule: Header length limit.
# A value of 0 disables the rule.
max_header_length = 55
# Rule: Body line length limit.
# A value of 0 disables the rule.
max_body_length = 80
# Rule: No leading, trailing, or consecutive spaces.
whitespace = true
# Rule: Follow Conventional Commits format.
# See https://www.conventionalcommits.org/.
conventional = true
# Rule: List of allowed commit scopes.
# An empty list allows all scopes. Example: ["docs", "cli"].
scopes_allowed = []
# Rule: List of allowed commit types.
# An empty list allows all types. Example: ["feat", "fix", "docs"].
types_allowed = ["feat", "fix", "docs", "refactor", "change", "deprecate", "remove", "security", "perf", "test", "chore"]
# Rule: Header must match regex pattern.
# Example: '^JIRA-\d+:'.
header_pattern = '^\w+(\([\w-]+\))?(!)?: \w'