[#68] Fix version linter.
All checks were successful
Formatters / Run fmt (pull_request) Successful in 26s
DCO action / DCO (pull_request) Successful in 1m2s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m4s

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 3cb6553234
4 changed files with 33 additions and 13 deletions

View file

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

View file

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

View file

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

View file

@ -3,7 +3,7 @@ SHELL=bash
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:
doc:
@ -22,15 +22,33 @@ fmt:
clang-format -i $$f; \
done
# Run version update check
version:
@diff=$$(git diff-index master version.json); \
if [[ -z "$$diff" ]]; then \
echo "⇒ You need to update the api version in the version.json file"; \
exit 1;\
fi
# Run version update check in version.json file
check-version:
@version=$$(git show remotes/origin/master:version.json); \
if [ -z "$$version" ]; then \
exit; \
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:
@version=$$(jq -r '.milestone' version.json).$$(jq -r '.patch' version.json); \
conflicts=0; \