Skip to content

Commit e1bb39f

Browse files
committed
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. Fixes #15
1 parent 966c6c1 commit e1bb39f

File tree

6 files changed

+424
-20
lines changed

6 files changed

+424
-20
lines changed
+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# This action is supposed to be used in setup-tarantool CI.
2+
#
3+
# It determines the latest tarantool version available in the
4+
# repository defined by the input parameters.
5+
#
6+
# The output values represent the tarantool version in different
7+
# forms for convenience.
8+
#
9+
# Usage example:
10+
#
11+
# - steps:
12+
# - id: latest_version
13+
# uses: ./.github/actions/latest-version
14+
# with:
15+
# tarantool-series: '1.10' # don't miss quotes!
16+
#
17+
# - run: echo ${{ steps.latest-version.outputs.package }}
18+
# # ---> 1.10.13.0.g1d2c5aad5-1
19+
# - run: echo ${{ steps.latest-version.outputs.abc }}
20+
# # ---> 1.10.13
21+
# - run: echo ${{ steps.latest-version.outputs.abcd }}
22+
# # ---> 1.10.13.0
23+
# - run: echo ${{ steps.latest-version.outputs.abc-d }}
24+
# # ---> 1.10.13-0
25+
# - run: echo ${{ steps.latest-version.outputs.git-describe }}
26+
# # ---> 1.10.13-0-g1d2c5aad5
27+
28+
name: 'Latest tarantool version'
29+
description: 'Get latest tarantool version of given release series'
30+
inputs:
31+
tarantool-series:
32+
description: 'Tarantool release series'
33+
required: true
34+
nightly-build:
35+
description: 'Whether to look into a repository with nightly builds'
36+
required: false
37+
default: false
38+
outputs:
39+
package:
40+
description: 'Latest tarantool version in the Debian package format'
41+
value: ${{ steps.get-latest-version.outputs.package }}
42+
abc:
43+
description: 'Latest tarantool version in the A.B.C form'
44+
value: ${{ steps.get-latest-version.outputs.abc }}
45+
abcd:
46+
description: 'Latest tarantool version in the A.B.C.D form'
47+
value: ${{ steps.get-latest-version.outputs.abcd }}
48+
abc-d:
49+
description: 'Latest tarantool version in the A.B.C-D form'
50+
value: ${{ steps.get-latest-version.outputs.abc-d }}
51+
git-describe:
52+
description: 'Latest tarantool version in the A.B.C-D-gHHHHHHHHH form'
53+
value: ${{ steps.get-latest-version.outputs.git-describe }}
54+
runs:
55+
using: 'composite'
56+
steps:
57+
- id: get-latest-version
58+
run: |
59+
node <<'SCRIPT'
60+
process.env['INPUT_TARANTOOL-VERSION'] = '${{ inputs.tarantool-series }}'
61+
process.env['INPUT_NIGHTLY-BUILD'] = '${{ inputs.nightly-build }}'
62+
require('./dist/main').latest_version().then(v => {
63+
console.log(`package: ${v}`)
64+
console.log(`::set-output name=package::${v}`)
65+
66+
/*
67+
* 1.10.13.0.g1d2c5aad5-1
68+
* ->
69+
* parts[0]: '1'
70+
* parts[1]: '10'
71+
* parts[2]: '13'
72+
* parts[3]: '0'
73+
* parts[4]: 'g1d2c5aad5'
74+
* parts[5]: '1'
75+
*/
76+
var parts = v.split(/[.-]/)
77+
78+
var abc = parts.slice(0, 3).join('.')
79+
var abcd = `${abc}.${parts[3]}`
80+
var abc_d = `${abc}-${parts[3]}`
81+
var git_describe = `${abc_d}-${parts[4]}`
82+
83+
console.log(`abc: ${abc}`)
84+
console.log(`abcd: ${abcd}`)
85+
console.log(`abc-d: ${abc_d}`)
86+
console.log(`git-describe: ${git_describe}`)
87+
88+
console.log(`::set-output name=abc::${abc}`)
89+
console.log(`::set-output name=abcd::${abcd}`)
90+
console.log(`::set-output name=abc-d::${abc_d}`)
91+
console.log(`::set-output name=git-describe::${git_describe}`)
92+
})
93+
SCRIPT
94+
shell: bash
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This action is supposed to be used in setup-tarantool CI.
2+
#
3+
# It verifies currently installed tarantool against two
4+
# properties:
5+
#
6+
# 1. Tarantool version matches provided version prefix.
7+
# 2. Tarantool is installed by apt-get/from cache.
8+
#
9+
# Usage example:
10+
#
11+
# - steps:
12+
# - uses: ./.github/actions/verify-version
13+
# with:
14+
# tarantool-version: '1.10.12' # don't miss quotes!
15+
# from-cache: false
16+
17+
name: 'Verify tarantool version'
18+
description: 'Verify that installed tarantool has given version'
19+
inputs:
20+
tarantool-version:
21+
description: 'Expected tarantool version (version string prefix)'
22+
required: true
23+
from-cache:
24+
description: 'Expect tarantool from cache or from apt-get (if omitted, does not perform the check)'
25+
required: false
26+
default: ''
27+
runs:
28+
using: 'composite'
29+
steps:
30+
- name: Verify tarantool version
31+
run: |
32+
tarantool -e "assert(_TARANTOOL:startswith('${{ inputs.tarantool-version }}'), _TARANTOOL)"
33+
shell: bash
34+
35+
- name: Verify that tarantool is installed from the cache
36+
run: |
37+
if dpkg --status tarantool; then
38+
echo "Tarantool is installed by apt-get, but it is expected that"
39+
echo "tarantool will be installed from the cache"
40+
exit 1
41+
fi
42+
if: inputs.from-cache == 'true'
43+
shell: bash
44+
45+
- name: Verify that tarantool is installed by apt-get (not from the cache)
46+
run: |
47+
dpkg --status tarantool
48+
if: inputs.from-cache == 'false'
49+
shell: bash

.github/workflows/test.yml

+211
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,214 @@ jobs:
9090
uses: ./
9191
with:
9292
tarantool-version: '1.10'
93+
94+
# This test case performs basic test of the three digit version
95+
# support.
96+
#
97+
# It performs the following steps and checks.
98+
#
99+
# - install 1.10.12
100+
# - checks: version, non-cached
101+
# - uninstall tarantool
102+
# - install 1.10.12
103+
# - checks: version, cached
104+
# - install 1.10.LATEST
105+
# - checks: version, non-cached
106+
test-exact-version-basic:
107+
runs-on: ubuntu-latest
108+
env:
109+
TARANTOOL_CACHE_KEY_SUFFIX: -C-${{ github.run_id }}
110+
steps:
111+
- uses: actions/checkout@v2
112+
113+
- id: latest-version
114+
uses: ./.github/actions/latest-version
115+
with:
116+
tarantool-series: '1.10'
117+
118+
- name: Install 1.10.12 (non-cached)
119+
uses: ./
120+
with:
121+
tarantool-version: '1.10.12'
122+
nightly-build: false
123+
124+
- uses: ./.github/actions/verify-version
125+
with:
126+
tarantool-version: '1.10.12-0'
127+
from-cache: false
128+
129+
- name: Uninstall tarantool
130+
run: sudo apt-get -y remove tarantool tarantool-dev tarantool-common
131+
132+
- name: Install 1.10.12 (cached)
133+
uses: ./
134+
with:
135+
tarantool-version: '1.10.12'
136+
nightly-build: false
137+
138+
- uses: ./.github/actions/verify-version
139+
with:
140+
tarantool-version: '1.10.12-0'
141+
from-cache: true
142+
143+
- name: Install 1.10.LATEST (non-cached)
144+
uses: ./
145+
with:
146+
tarantool-version: '${{ steps.latest-version.outputs.abc }}'
147+
nightly-build: false
148+
149+
- uses: ./.github/actions/verify-version
150+
with:
151+
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
152+
from-cache: false
153+
154+
# This test case verifies that a two digit version is installed
155+
# without any problem after a three digit version (not a latest
156+
# one).
157+
#
158+
# - install 1.10.12
159+
# - checks: version, non-cached
160+
# - uninstall tarantool
161+
# - install 1.10
162+
# - checks: version, non-cached
163+
test-exact-version-then-two-digit-version:
164+
runs-on: ubuntu-latest
165+
env:
166+
TARANTOOL_CACHE_KEY_SUFFIX: -D-${{ github.run_id }}
167+
steps:
168+
- uses: actions/checkout@v2
169+
170+
- id: latest-version
171+
uses: ./.github/actions/latest-version
172+
with:
173+
tarantool-series: '1.10'
174+
175+
- name: Install 1.10.12 (non-cached)
176+
uses: ./
177+
with:
178+
tarantool-version: '1.10.12'
179+
nightly-build: false
180+
181+
- uses: ./.github/actions/verify-version
182+
with:
183+
tarantool-version: '1.10.12-0'
184+
from-cache: false
185+
186+
- name: Uninstall tarantool
187+
run: sudo apt-get -y remove tarantool tarantool-dev tarantool-common
188+
189+
- name: Install 1.10 (non-cached)
190+
uses: ./
191+
with:
192+
tarantool-version: '1.10'
193+
nightly-build: false
194+
195+
- uses: ./.github/actions/verify-version
196+
with:
197+
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
198+
from-cache: false
199+
200+
# This test case verifies that a two digit version is installed
201+
# without any problem after a three digit version (the latest
202+
# one).
203+
#
204+
# - install 1.10.LATEST
205+
# - checks: version, non-cached
206+
# - uninstall tarantool
207+
# - install 1.10
208+
# - checks: version, cached
209+
test-exact-version-latest-then-two-digit-version:
210+
runs-on: ubuntu-latest
211+
env:
212+
TARANTOOL_CACHE_KEY_SUFFIX: -E-${{ github.run_id }}
213+
steps:
214+
- uses: actions/checkout@v2
215+
216+
- id: latest-version
217+
uses: ./.github/actions/latest-version
218+
with:
219+
tarantool-series: '1.10'
220+
221+
- name: Install 1.10.LATEST (non-cached)
222+
uses: ./
223+
with:
224+
tarantool-version: '${{ steps.latest-version.outputs.abc }}'
225+
nightly-build: false
226+
227+
- uses: ./.github/actions/verify-version
228+
with:
229+
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
230+
from-cache: false
231+
232+
- name: Uninstall tarantool
233+
run: sudo apt-get -y remove tarantool tarantool-dev tarantool-common
234+
235+
- name: Install 1.10 (cached)
236+
uses: ./
237+
with:
238+
tarantool-version: '1.10'
239+
nightly-build: false
240+
241+
- uses: ./.github/actions/verify-version
242+
with:
243+
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
244+
from-cache: true
245+
246+
# This test case performs basic test of four digit version
247+
# support (for nightly repositories).
248+
#
249+
# - install 1.10.LATEST.LATEST (nightly)
250+
# - checks: version, non-cached
251+
# - uninstall tarantool
252+
# - install 1.10.LATEST (nightly)
253+
# - checks: version, cached
254+
# - install 1.10 (nightly)
255+
# - checks: version, cached
256+
test-exact-version-nightly:
257+
runs-on: ubuntu-latest
258+
env:
259+
TARANTOOL_CACHE_KEY_SUFFIX: -F-${{ github.run_id }}
260+
steps:
261+
- uses: actions/checkout@v2
262+
263+
- id: latest-version
264+
uses: ./.github/actions/latest-version
265+
with:
266+
tarantool-series: '1.10'
267+
nightly-build: true
268+
269+
- name: Install 1.10.LATEST.LATEST (nightly, non-cached)
270+
uses: ./
271+
with:
272+
tarantool-version: '${{ steps.latest-version.outputs.abcd }}'
273+
nightly-build: true
274+
275+
- uses: ./.github/actions/verify-version
276+
with:
277+
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
278+
from-cache: false
279+
280+
- name: Uninstall tarantool
281+
run: sudo apt-get -y remove tarantool tarantool-dev tarantool-common
282+
283+
- name: Install 1.10.LATEST (nightly, cached)
284+
uses: ./
285+
with:
286+
tarantool-version: '1.10'
287+
nightly-build: true
288+
289+
- uses: ./.github/actions/verify-version
290+
with:
291+
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
292+
from-cache: true
293+
294+
- name: Install 1.10 (nightly, cached)
295+
uses: ./
296+
with:
297+
tarantool-version: '1.10'
298+
nightly-build: true
299+
300+
- uses: ./.github/actions/verify-version
301+
with:
302+
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
303+
from-cache: true

README.md

+11-1
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

0 commit comments

Comments
 (0)