[#68] Update version linter.
All checks were successful
Formatters / Run fmt (pull_request) Successful in 27s
DCO action / DCO (pull_request) Successful in 58s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m0s

Add additional description to compatibility linter.
Change the release name to reflect the new convention.
Signed-off-by: Ori Bruk <o.bruk@yadro.com>
This commit is contained in:
Ori Bruk 2024-10-08 17:42:00 +03:00
parent 527fe93e5d
commit de471049e5
4 changed files with 34 additions and 13 deletions

View file

@ -10,6 +10,8 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install deps - name: Install deps
run: | run: |
apt update apt update

View file

@ -22,9 +22,9 @@ repos:
entry: make fmt entry: make fmt
language: system language: system
pass_filenames: false pass_filenames: false
- id: make-version - id: make-check-version
name: Run make version name: Run make check-version
entry: make version entry: make check-version
language: system language: system
pass_filenames: false pass_filenames: false
- id: make-compatibility - id: make-compatibility

View file

@ -1,6 +1,6 @@
# Changelog # Changelog
## [3.0] - 2024-10-08 - Oryukdo (오륙도, 五六島) ## [3.0] - 2024-10-08 - Potanin Glacier
### Added ### Added
- Version compatibility information - Version compatibility information

View file

@ -3,7 +3,7 @@ SHELL=bash
include help.mk include help.mk
.PHONY: doc fmt version compatibility pre-commit unpre-commit pre-commit-run .PHONY: doc fmt check-version compatibility pre-commit unpre-commit pre-commit-run
# Regenerate documentation for proto files: # Regenerate documentation for proto files:
doc: doc:
@ -22,15 +22,34 @@ fmt:
clang-format -i $$f; \ clang-format -i $$f; \
done done
# Run version update check # Run version update check in version.json file
version: check-version:
@diff=$$(git diff-index master version.json); \ @protoChanges=$$(git diff --name-only remotes/origin/master | grep '**/*.proto'); \
if [[ -z "$$diff" ]]; then \ version=$$(git show remotes/origin/master:version.json); \
echo "⇒ You need to update the api version in the version.json file"; \ if [ -z "$$version" ] || [ -z "$$protoChanges" ]; then \
exit 1;\ exit; \
fi fi; \
masterMilestone=$$(jq -n --argjson data "$$version" '$$data.milestone'); \
masterPatch=$$(jq -n --argjson data "$$version" '$$data.patch'); \
milestone=$$(jq -r '.milestone' version.json); \
patch=$$(jq -r '.patch' version.json); \
if [ "$$masterMilestone" -eq "$$milestone" -a "$$masterPatch" -eq "$$patch" ]; then \
echo "⇒ You need to update the api version in the version.json file"; \
exit 1; \
elif [ "$$masterMilestone" -gt "$$milestone" ]; then \
echo "⇒ The milestone cannot be decrement in the version.json file"; \
exit 1; \
elif [ "$$masterMilestone" -eq "$$milestone" -a "$$masterPatch" -gt "$$patch" ]; then \
echo "⇒ The patch cannot be decrement without milestone increment in the version.json file"; \
exit 1; \
elif [ "$$masterMilestone" -lt "$$milestone" -a "$$patch" -ne 0 ]; then \
echo "⇒ The patch should be 0 after milestone increment in the version.json file"; \
exit 1; \
fi
# Run compatibility information check # Run a compatibility information check \
Checks that the files that describe compatibility in the compatibility package \
have the current version information added in the version.json file
compatibility: compatibility:
@version=$$(jq -r '.milestone' version.json).$$(jq -r '.patch' version.json); \ @version=$$(jq -r '.milestone' version.json).$$(jq -r '.patch' version.json); \
conflicts=0; \ conflicts=0; \