Skip to content

Commit 0125b26

Browse files
committed
api: add hardcoded versioning support
Added the _VERSION variable to the exported table. Is part of the task [1]. 1. github.com/tarantool/roadmap-internal/issues/204
1 parent 6f041ee commit 0125b26

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

.github/workflows/test_on_push.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,35 @@ on:
55
pull_request:
66

77
jobs:
8+
hardcoded_ver_check:
9+
runs-on: ubuntu-20.04
10+
11+
steps:
12+
- name: Clone the module
13+
uses: actions/checkout@v2
14+
15+
- name: Fetch tags
16+
# Found that Github checkout Actions pulls all the tags, but
17+
# right it deannotates the testing tag, check:
18+
# https://github.com/actions/checkout/issues/290
19+
# But we use 'git describe ..' calls w/o '--tags' flag and it
20+
# prevents us from getting the needed tag for packages version
21+
# setup. To avoid of it, let's fetch it manually, to be sure
22+
# that all tags will exists always.
23+
run: git fetch --tags -f
24+
25+
- name: Fetch hardcoded and last repository tag versions
26+
run: |
27+
echo HARDCODED_VERSION=$(cat crud/version.lua | grep -oP "'\K[^']+" ) >> $GITHUB_ENV
28+
echo REPO_LAST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) >> $GITHUB_ENV
29+
30+
- name: Hardcoded version relevance check
31+
if: env.HARDCODED_VERSION != env.REPO_LAST_TAG
32+
run: |
33+
echo "Hardcoded version and the last repository tag are not equal"
34+
echo "You may have forgotten to update the value in the version.lua file"
35+
exit 1
36+
837
run-tests-ce:
938
if: |
1039
github.event_name == 'push' ||

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
* Add hardcoded versioning support, now the exported table
10+
has _VERSION variable.
911

1012
### Fixed
1113
* Pre-hotreload `cartridge` support (older than 2.4.0) (PR #341).

crud.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ local stats = require('crud.stats')
2323

2424
local crud = {}
2525

26+
crud['_VERSION'] = require('crud.version')
27+
2628
--- CRUD operations.
2729
-- @section crud
2830

crud/version.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Сontains the module version.
2+
-- Requires manual update in case of release commit.
3+
4+
return '1.0.0'

0 commit comments

Comments
 (0)