Skip to content

Commit

Permalink
api: add hardcoded versioning support
Browse files Browse the repository at this point in the history
Added the _VERSION variable to the exported table.
Is part of the task [1].

1. github.com/tarantool/roadmap-internal/issues/204
  • Loading branch information
GRISHNOV authored and LeonidVas committed Mar 13, 2023
1 parent 2f157c9 commit 094cbf9
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ name: packaging
on: [push, pull_request]

jobs:
# Run not only on tags, otherwise dependent job will skip.
version-check:
# Skip pull request job when the source branch is in the same
# repository.
if: |
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-20.04
steps:
- name: Check module version
# We need this step to run only on push with tag.
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
uses: tarantool/actions/check-module-version@master
with:
module-name: 'queue'

package:
# Skip pull request jobs when the source branch is in the same
# repository.
Expand All @@ -12,6 +28,7 @@ jobs:
# Packaging for CentOS 7 does not work with other versions, see:
# https://github.com/packpack/packpack/issues/145
runs-on: ubuntu-20.04
needs: version-check

strategy:
fail-fast: false
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ on:
tags: ['*']

jobs:
version-check:
# We need this job to run only on push with tag.
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-20.04
steps:
- name: Check module version
uses: tarantool/actions/check-module-version@master
with:
module-name: 'queue'

publish-rockspec-scm-1:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
Expand All @@ -19,6 +29,7 @@ jobs:
publish-rockspec-tag:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: version-check
steps:
- uses: actions/checkout@v3

Expand Down
3 changes: 2 additions & 1 deletion queue-scm-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ build = {
['queue.abstract.driver.limfifottl'] = 'queue/abstract/driver/limfifottl.lua',
['queue.compat'] = 'queue/compat.lua',
['queue.util'] = 'queue/util.lua',
['queue'] = 'queue/init.lua'
['queue'] = 'queue/init.lua',
['queue.version'] = 'queue/version.lua'
}
}

Expand Down
1 change: 1 addition & 0 deletions queue/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ queue = setmetatable({
register_driver = register_driver,
state = queue_state.show,
cfg = deferred_cfg,
_VERSION = require('queue.version'),
}, { __index = function()
print(debug.traceback())
error('Please configure box.cfg{} in read/write mode first')
Expand Down
4 changes: 4 additions & 0 deletions queue/version.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Сontains the module version.
-- Requires manual update in case of release commit.

return '1.2.5'

0 comments on commit 094cbf9

Please sign in to comment.