Skip to content

api: add hardcoded versioning support #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/publish.yaml
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: 'migrator'

publish-scm-1:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-20.04
Expand All @@ -18,6 +28,7 @@ jobs:

publish-tag:
if: startsWith(github.ref, 'refs/tags/')
needs: version-check
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push]

jobs:
all:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
container:
image: centos:7
timeout-minutes: 10
Expand All @@ -17,7 +17,7 @@ jobs:
run: |
yum -y install epel-release https://repo.ius.io/ius-release-el7.rpm
yum -y update
yum -y install wget git222 cmake make unzip
yum -y install wget git cmake make unzip gcc gcc-c++
- name: Checkout sources
uses: actions/checkout@v2
- name: Install sdk
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added:
- Versioning support

## [0.4.2]
### Fixed:
Expand Down
1 change: 1 addition & 0 deletions migrations-scm-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ build = {
install = {
lua = {
['migrator'] = 'migrator/init.lua',
['migrator.version'] = 'migrator/version.lua',
['migrator.utils'] = 'migrator/utils.lua',
['migrator.directory-loader'] = 'migrator/directory-loader.lua',
['migrator.config-loader'] = 'migrator/config-loader.lua',
Expand Down
4 changes: 3 additions & 1 deletion migrator/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,7 @@ return {
set_loader = set_loader,
set_use_cartridge_ddl = set_use_cartridge_ddl,

get_schema = get_schema
get_schema = get_schema,

_VERSION = require('migrator.version'),
}
4 changes: 4 additions & 0 deletions migrator/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 '0.4.2'
8 changes: 8 additions & 0 deletions test/integration/fockups_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ g.test_error_in_migrations = function()
}
]] } })
local result = g.cluster.main_server:http_request('post', '/migrations/up', { json = {}, raise = false })
t.assert_equals(result.status, 500)

t.xfail('See https://github.com/tarantool/migrations/issues/63')

t.assert_str_contains(result.body, 'Oops')
t.assert_str_contains(result.body, 'Errors happened during migrations')
end
Expand All @@ -150,6 +154,10 @@ g.test_inconsistent_migrations = function()
]])

local result = g.cluster.main_server:http_request('post', '/migrations/up', { json = {}, raise = false })
t.assert_equals(result.status, 500)

t.xfail('See https://github.com/tarantool/migrations/issues/63')

t.assert_str_contains(result.body, 'Not all migrations applied')
end

Expand Down