feature/compatibility #1

Closed
orikik wants to merge 2 commits from feature/compatibility into master
4 changed files with 33 additions and 13 deletions
Showing only changes of commit 3cb6553234 - Show all commits

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,33 @@ 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); \ @version=$$(git show remotes/origin/master:version.json); \
if [[ -z "$$diff" ]]; then \ if [ -z "$$version" ]; then \
echo "⇒ You need to update the api version in the version.json file"; \ exit; \
exit 1;\ 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; \