Skip to content

Commit 679ae6b

Browse files
committed
WIP: feature: acquire exact tarantool version
Sometimes we want to test a module against specific tarantool version, not a latest in the series. For example, 2.6 series may have 2.6.1, 2.6.2 and 2.6.3 releases and we want to setup 2.6.1. TBD: Rebase after PR #21. TBD: Add a test. Fixes #15
1 parent fbbee14 commit 679ae6b

File tree

3 files changed

+59
-15
lines changed

3 files changed

+59
-15
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,24 @@ steps:
2424
- run: .rocks/bin/luatest -v
2525
```
2626
27+
### Install an exact version
28+
29+
```
30+
steps:
31+
- uses: actions/checkout@v2
32+
- uses: tarantool/setup-tarantool@v1
33+
with:
34+
tarantool-version: '2.6.1'
35+
```
36+
2737
### Install a nightly build
2838
2939
```yaml
3040
steps:
3141
- uses: actions/checkout@v2
3242
- uses: tarantool/setup-tarantool@v1
3343
with:
34-
tarantool-version: '2.6'
44+
tarantool-version: '2.6' # or, say, '2.6.1.0' for exact version
3545
nightly-build: true
3646
```
3747

dist/main/index.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58023,9 +58023,11 @@ const io = __importStar(__nccwpck_require__(7436));
5802358023
const path = __importStar(__nccwpck_require__(1017));
5802458024
const fs = __importStar(__nccwpck_require__(7147));
5802558025
const nightlyBuild = (core.getInput('nightly-build') || 'false').toUpperCase() === 'TRUE';
58026+
const tarantool_version = core.getInput('tarantool-version', { required: true });
58027+
const tarantool_series = tarantool_version.split('.', 2).join('.');
5802658028
const baseUrl = 'https://download.tarantool.org/tarantool/' +
5802758029
(nightlyBuild ? '' : 'release/') +
58028-
core.getInput('tarantool-version', { required: true });
58030+
tarantool_series;
5802958031
async function capture(cmd, options) {
5803058032
let output = '';
5803158033
await exec.exec(cmd, [], {
@@ -58106,14 +58108,28 @@ async function run_linux() {
5810658108
try {
5810758109
const distro = await lsb_release();
5810858110
const cache_dir = 'cache-tarantool';
58109-
core.startGroup('Checking latest tarantool version');
58110-
const version = await latest_version();
58111-
core.info(`${version}`);
58112-
core.endGroup();
58111+
/*
58112+
* Find latest version if inexact tarantool version is
58113+
* provided.
58114+
*
58115+
* Exact version is X.Y.Z for 'release' repository and X.Y.Z.N
58116+
* for 'live' repository (nightly builds).
58117+
*/
58118+
const version_is_exact = tarantool_version.split('.').length >= (nightlyBuild ? 3 : 4);
58119+
let exact_version;
58120+
if (version_is_exact) {
58121+
exact_version = tarantool_version;
58122+
}
58123+
else {
58124+
core.startGroup('Checking latest tarantool version');
58125+
exact_version = await latest_version();
58126+
core.endGroup();
58127+
}
58128+
core.info(`${exact_version}`);
5811358129
if (core.getInput('cache-key')) {
5811458130
core.warning("Setup-tarantool input 'cache-key' is deprecated");
5811558131
}
58116-
let cache_key = `tarantool-setup-${distro}-${version}`;
58132+
let cache_key = `tarantool-setup-${distro}-${exact_version}`;
5811758133
// This for testing only
5811858134
cache_key += process.env['TARANTOOL_CACHE_KEY_SUFFIX'] || '';
5811958135
if (await cache.restoreCache([cache_dir], cache_key)) {
@@ -58143,7 +58159,7 @@ async function run_linux() {
5814358159
});
5814458160
core.startGroup('Installing tarantool');
5814558161
const dpkg_before = await dpkg_list();
58146-
await exec.exec('sudo apt-get install -y tarantool tarantool-dev');
58162+
await exec.exec(`sudo apt-get install -y tarantool=${exact_version}* tarantool-dev=${exact_version}*`);
5814758163
const dpkg_after = await dpkg_list();
5814858164
const dpkg_diff = Array.from(dpkg_after.values()).filter(pkg => !dpkg_before.has(pkg));
5814958165
core.endGroup();

src/main.ts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ import * as fs from 'fs'
99

1010
const nightlyBuild =
1111
(core.getInput('nightly-build') || 'false').toUpperCase() === 'TRUE'
12+
const tarantool_version = core.getInput('tarantool-version', {required: true})
13+
const tarantool_series = tarantool_version.split('.', 2).join('.')
1214
const baseUrl =
1315
'https://download.tarantool.org/tarantool/' +
1416
(nightlyBuild ? '' : 'release/') +
15-
core.getInput('tarantool-version', {required: true})
17+
tarantool_series
1618

1719
interface CaptureOptions {
1820
/** optional. defaults to false */
@@ -104,15 +106,29 @@ async function run_linux(): Promise<void> {
104106
const distro = await lsb_release()
105107
const cache_dir = 'cache-tarantool'
106108

107-
core.startGroup('Checking latest tarantool version')
108-
const version = await latest_version()
109-
core.info(`${version}`)
110-
core.endGroup()
109+
/*
110+
* Find latest version if inexact tarantool version is
111+
* provided.
112+
*
113+
* Exact version is X.Y.Z for 'release' repository and X.Y.Z.N
114+
* for 'live' repository (nightly builds).
115+
*/
116+
const version_is_exact =
117+
tarantool_version.split('.').length >= (nightlyBuild ? 3 : 4)
118+
let exact_version
119+
if (version_is_exact) {
120+
exact_version = tarantool_version
121+
} else {
122+
core.startGroup('Checking latest tarantool version')
123+
exact_version = await latest_version()
124+
core.endGroup()
125+
}
126+
core.info(`${exact_version}`)
111127

112128
if (core.getInput('cache-key')) {
113129
core.warning("Setup-tarantool input 'cache-key' is deprecated")
114130
}
115-
let cache_key = `tarantool-setup-${distro}-${version}`
131+
let cache_key = `tarantool-setup-${distro}-${exact_version}`
116132
// This for testing only
117133
cache_key += process.env['TARANTOOL_CACHE_KEY_SUFFIX'] || ''
118134

@@ -148,7 +164,9 @@ async function run_linux(): Promise<void> {
148164
core.startGroup('Installing tarantool')
149165

150166
const dpkg_before = await dpkg_list()
151-
await exec.exec('sudo apt-get install -y tarantool tarantool-dev')
167+
await exec.exec(
168+
`sudo apt-get install -y tarantool=${exact_version}* tarantool-dev=${exact_version}*`
169+
)
152170
const dpkg_after = await dpkg_list()
153171

154172
const dpkg_diff: Array<string> = Array.from(dpkg_after.values()).filter(

0 commit comments

Comments
 (0)