Skip to content

Commit e781ac7

Browse files
committed
feature: support 2.10+ releases
## Background The new release policy (see [1]) is in effect since Tarantool 2.10 and changes several things, including: 1. Repositories layout. - The new release series naming: `series-2` instead of `2.10`, `2.11` and so on. - The new `pre-release` repository. - No nightly builds (`live` repository). 2. Versioning. - Three digit versions for release builds: `2.10.0` instead of `2.10.0.0`. - `alpha`, `beta`, `rc` marks in pre-release tarantool versions. [1]: tarantool/tarantool#6182 ## Usage This commit offers support of 2.10+ *releases* and leaves pre-releases unsupported (it is tracked in #23). The usage is quite straightforward: ```yaml steps: - uses: actions/checkout@v2 - uses: tarantool/setup-tarantool@v1 with: tarantool-version: '2.10.0' # or '2.10', or just '2' ``` The latest 2.10.X version will be installed for `tarantool-version: '2.10'`. The latest 2.X.Y version will be installed for `tarantool-version: '2'`. ## Implementatoin details We have nothing to do regarding versioning in order to support 2.10+ *releases*. However we should reflect the repository layout change: * tarantool-version: 2.8, nightly-build: false or unset (Nothing is changed here.) ``` baseUrl: https://download.tarantool.org/tarantool/release/2.8 ``` * tarantool-version: 2.8, nightly-build: true (Nothing is changed here.) ``` baseUrl: https://download.tarantool.org/tarantool/2.8 ``` * tarantool-version: 2.10, nightly-build: false or unset (This is the new logic introduced by this commit.) ``` baseUrl: https://download.tarantool.org/tarantool/release/series-2 ``` * tarantool-version: 2.10, nightly-build: true (This is the new logic introduced by this commit.) Raise an error. If the version is set as `'2'` or `'2.10.0'`, use the same logic as for `'2.10'`. Fixes #19
1 parent e1bb39f commit e781ac7

File tree

4 files changed

+137
-9
lines changed

4 files changed

+137
-9
lines changed

.github/actions/latest-version/action.yml

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
# # ---> 1.10.13-0
2525
# - run: echo ${{ steps.latest-version.outputs.git-describe }}
2626
# # ---> 1.10.13-0-g1d2c5aad5
27+
#
28+
# Caution: It works smoothly only for 1.10/2.8, but not for 2.10+
29+
# due to changes in the package versioning (see the new release
30+
# policy document, [1]).
31+
#
32+
# [1]: https://github.com/tarantool/tarantool/discussions/6182
2733

2834
name: 'Latest tarantool version'
2935
description: 'Get latest tarantool version of given release series'

.github/workflows/test.yml

+49
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,52 @@ jobs:
301301
with:
302302
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
303303
from-cache: true
304+
305+
# This test case installs tarantool of series-2 using
306+
# one/two/three digit version specifier.
307+
#
308+
# It performs the following steps and checks.
309+
#
310+
# - install 2/2.10/2.10.0
311+
# - checks: version, non-cached
312+
# - uninstall tarantool
313+
# - install 2/2.10/2.10.0
314+
# - checks: version, cached
315+
test-series-2:
316+
strategy:
317+
fail-fast: false
318+
matrix:
319+
tarantool:
320+
- '2'
321+
- '2.10'
322+
- '2.10.0'
323+
runs-on: ubuntu-latest
324+
env:
325+
# github.run_id is the same across different jobs created
326+
# from the same matrix.
327+
TARANTOOL_CACHE_KEY_SUFFIX: -G-${{ matrix.tarantool }}-${{ github.run_id }}
328+
steps:
329+
- uses: actions/checkout@v2
330+
331+
- name: Install ${{ matrix.tarantool }} (non-cached)
332+
uses: ./
333+
with:
334+
tarantool-version: '${{ matrix.tarantool }}'
335+
336+
- uses: ./.github/actions/verify-version
337+
with:
338+
tarantool-version: '${{ matrix.tarantool }}'
339+
from-cache: false
340+
341+
- name: Uninstall tarantool
342+
run: sudo apt-get -y remove tarantool tarantool-dev tarantool-common
343+
344+
- name: Install ${{ matrix.tarantool }} (cached)
345+
uses: ./
346+
with:
347+
tarantool-version: '${{ matrix.tarantool }}'
348+
349+
- uses: ./.github/actions/verify-version
350+
with:
351+
tarantool-version: '${{ matrix.tarantool }}'
352+
from-cache: true

dist/main/index.js

+38-4
Original file line numberDiff line numberDiff line change
@@ -58024,10 +58024,6 @@ const path = __importStar(__nccwpck_require__(1017));
5802458024
const fs = __importStar(__nccwpck_require__(7147));
5802558025
const nightlyBuild = (core.getInput('nightly-build') || 'false').toUpperCase() === 'TRUE';
5802658026
const tarantool_version = core.getInput('tarantool-version', { required: true });
58027-
const tarantool_series = tarantool_version.split('.', 2).join('.');
58028-
const baseUrl = 'https://download.tarantool.org/tarantool/' +
58029-
(nightlyBuild ? '' : 'release/') +
58030-
tarantool_series;
5803158027
async function capture(cmd, options) {
5803258028
let output = '';
5803358029
await exec.exec(cmd, [], {
@@ -58081,7 +58077,44 @@ function semver_max(a, b) {
5808158077
return pa[i] >= pb[i] ? a : b;
5808258078
}
5808358079
}
58080+
function construct_base_url() {
58081+
const parts = tarantool_version.split('.', 2);
58082+
const major = Number(parts[0]);
58083+
const minor = Number(parts[1]);
58084+
var tarantool_series;
58085+
// Assume that just 2 is latest 2, so it is 2.10+ too.
58086+
if (major >= 3 ||
58087+
(major == 2 && minor >= 10) ||
58088+
(major == 2 && isNaN(minor))) {
58089+
/*
58090+
* 2.10+ -- the new release policy is in effect.
58091+
*
58092+
* A release series is determined by a major version.
58093+
* Nightly builds are not provided.
58094+
*
58095+
* https://github.com/tarantool/tarantool/discussions/6182
58096+
*/
58097+
tarantool_series = `series-${major}`;
58098+
if (nightlyBuild) {
58099+
throw new Error(`${tarantool_series} does not offer nightly builds`);
58100+
}
58101+
}
58102+
else {
58103+
/*
58104+
* 1.10, 2.1, ..., 2.8 -- old release policy is in effect.
58105+
*
58106+
* A release series is determined by major and minor
58107+
* versions. There are release and nightly builds (separate
58108+
* repositories).
58109+
*/
58110+
tarantool_series = `${major}.${minor}`;
58111+
}
58112+
return ('https://download.tarantool.org/tarantool/' +
58113+
(nightlyBuild ? '' : 'release/') +
58114+
tarantool_series);
58115+
}
5808458116
async function available_versions(version_prefix) {
58117+
const baseUrl = construct_base_url();
5808558118
const repo = baseUrl + '/ubuntu/dists/' + (await lsb_release());
5808658119
// Don't return 1.10.10, when the version prefix is 1.10.1.
5808758120
const prefix = version_prefix ? version_prefix + '.' : '';
@@ -58123,6 +58156,7 @@ async function run_linux() {
5812358156
try {
5812458157
const distro = await lsb_release();
5812558158
const cache_dir = 'cache-tarantool';
58159+
const baseUrl = construct_base_url();
5812658160
core.startGroup(`Checking latest tarantool ${tarantool_version} version`);
5812758161
const version = await latest_version(tarantool_version);
5812858162
core.info(`${version}`);

src/main.ts

+44-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ import * as fs from 'fs'
1010
const nightlyBuild =
1111
(core.getInput('nightly-build') || 'false').toUpperCase() === 'TRUE'
1212
const tarantool_version = core.getInput('tarantool-version', {required: true})
13-
const tarantool_series = tarantool_version.split('.', 2).join('.')
14-
const baseUrl =
15-
'https://download.tarantool.org/tarantool/' +
16-
(nightlyBuild ? '' : 'release/') +
17-
tarantool_series
1813

1914
interface CaptureOptions {
2015
/** optional. defaults to false */
@@ -78,9 +73,52 @@ function semver_max(a: string, b: string): string {
7873
}
7974
}
8075

76+
function construct_base_url(): string {
77+
const parts = tarantool_version.split('.', 2)
78+
const major = Number(parts[0])
79+
const minor = Number(parts[1])
80+
81+
var tarantool_series
82+
// Assume that just 2 is latest 2, so it is 2.10+ too.
83+
if (
84+
major >= 3 ||
85+
(major == 2 && minor >= 10) ||
86+
(major == 2 && isNaN(minor))
87+
) {
88+
/*
89+
* 2.10+ -- the new release policy is in effect.
90+
*
91+
* A release series is determined by a major version.
92+
* Nightly builds are not provided.
93+
*
94+
* https://github.com/tarantool/tarantool/discussions/6182
95+
*/
96+
tarantool_series = `series-${major}`
97+
if (nightlyBuild) {
98+
throw new Error(`${tarantool_series} does not offer nightly builds`)
99+
}
100+
} else {
101+
/*
102+
* 1.10, 2.1, ..., 2.8 -- old release policy is in effect.
103+
*
104+
* A release series is determined by major and minor
105+
* versions. There are release and nightly builds (separate
106+
* repositories).
107+
*/
108+
tarantool_series = `${major}.${minor}`
109+
}
110+
111+
return (
112+
'https://download.tarantool.org/tarantool/' +
113+
(nightlyBuild ? '' : 'release/') +
114+
tarantool_series
115+
)
116+
}
117+
81118
async function available_versions(
82119
version_prefix: string
83120
): Promise<Array<string>> {
121+
const baseUrl = construct_base_url()
84122
const repo = baseUrl + '/ubuntu/dists/' + (await lsb_release())
85123

86124
// Don't return 1.10.10, when the version prefix is 1.10.1.
@@ -125,6 +163,7 @@ async function run_linux(): Promise<void> {
125163
try {
126164
const distro = await lsb_release()
127165
const cache_dir = 'cache-tarantool'
166+
const baseUrl = construct_base_url()
128167

129168
core.startGroup(`Checking latest tarantool ${tarantool_version} version`)
130169
const version = await latest_version(tarantool_version)

0 commit comments

Comments
 (0)