diff --git a/.cz.toml b/.cz.toml new file mode 100644 index 0000000..c4f4bed --- /dev/null +++ b/.cz.toml @@ -0,0 +1,8 @@ +[tool.commitizen] +name = "cz_conventional_commits" +tag_format = "0.0.1" +version_scheme = "semver" +version = "1.0.0" +update_changelog_on_bump = true +major_version_zero = true +version_files = ["meson.build:version"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7fd3e70 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,16 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-added-large-files + + - repo: https://github.com/commitizen-tools/commitizen + rev: 3.8.0 + hooks: + - id: commitizen + - id: commitizen-branch + stages: [push] diff --git a/Justfile b/Justfile index 1975e3f..28ca546 100644 --- a/Justfile +++ b/Justfile @@ -1,26 +1,28 @@ -# Set default values for variables. Justfile doesn't support dynamic defaulting in -# the same way Make does, so we have to handle it within the command executions. - # Default build prefix and type BUILD_PREFIX := "./build" BUILD_TYPE := "release" set positional-arguments -# Set up the actual BUILD_PREFIX based on the presence of the directory -#BUILD_PREFIX := `mkdir -p {{BUILD_PREFIX}} && cd {{BUILD_PREFIX}} && pwd` - -default: build +# List all available targets +default: + just --list +# Build and run the development environment dev: docker build -t dev-container -f Dockerfile . + # Note: running with the volumes mounted in the same directory allows clangd to work docker run -it --rm -v $(pwd):$(pwd) dev-container -c "cd $(pwd) && /bin/zsh" +# Bootstrap the project when cloning for the first time by installing git hooks and others +bootstrap: + pre-commit install --hook-type commit-msg --hook-type pre-push + # Recipe to configure the build environment configure: @echo "\nBUILD_PREFIX: {{BUILD_PREFIX}}\n\n" meson setup --buildtype={{BUILD_TYPE}} {{BUILD_PREFIX}} -# Default build target +# Build a target, or default if none is specified build target="": configure ninja -C {{BUILD_PREFIX}} {{target}} @@ -32,7 +34,7 @@ test: build coverage: test ninja -C {{BUILD_PREFIX}} coverage -# Debug build +# Debug buildoutdated debug: meson configure {{BUILD_PREFIX}} --buildtype=debug ninja -C {{BUILD_PREFIX}} @@ -46,6 +48,7 @@ release: sanitize: meson configure {{BUILD_PREFIX}} -Db_sanitize=address ninja -C {{BUILD_PREFIX}} + ninja -C {{BUILD_PREFIX}} test # Static analysis check: diff --git a/meson.build b/meson.build index a8d081c..4bdb078 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('${REPO_NAME_PASCAL}', 'cpp', - version : '0.1', + version : '0.0.1', default_options : ['warning_level=3', 'cpp_std=c++20', 'b_coverage=true'])