Skip to content

feature: acquire exact tarantool version #22

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 1 commit into from
Jun 23, 2022
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
94 changes: 94 additions & 0 deletions .github/actions/latest-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# This action is supposed to be used in setup-tarantool CI.
#
# It determines the latest tarantool version available in the
# repository defined by the input parameters.
#
# The output values represent the tarantool version in different
# forms for convenience.
#
# Usage example:
#
# - steps:
# - id: latest_version
# uses: ./.github/actions/latest-version
# with:
# tarantool-series: '1.10' # don't miss quotes!
#
# - run: echo ${{ steps.latest-version.outputs.package }}
# # ---> 1.10.13.0.g1d2c5aad5-1
# - run: echo ${{ steps.latest-version.outputs.abc }}
# # ---> 1.10.13
# - run: echo ${{ steps.latest-version.outputs.abcd }}
# # ---> 1.10.13.0
# - run: echo ${{ steps.latest-version.outputs.abc-d }}
# # ---> 1.10.13-0
# - run: echo ${{ steps.latest-version.outputs.git-describe }}
# # ---> 1.10.13-0-g1d2c5aad5

name: 'Latest tarantool version'
description: 'Get latest tarantool version of given release series'
inputs:
tarantool-series:
description: 'Tarantool release series'
required: true
nightly-build:
description: 'Whether to look into a repository with nightly builds'
required: false
default: false
outputs:
package:
description: 'Latest tarantool version in the Debian package format'
value: ${{ steps.get-latest-version.outputs.package }}
abc:
description: 'Latest tarantool version in the A.B.C form'
value: ${{ steps.get-latest-version.outputs.abc }}
abcd:
description: 'Latest tarantool version in the A.B.C.D form'
value: ${{ steps.get-latest-version.outputs.abcd }}
abc-d:
description: 'Latest tarantool version in the A.B.C-D form'
value: ${{ steps.get-latest-version.outputs.abc-d }}
git-describe:
description: 'Latest tarantool version in the A.B.C-D-gHHHHHHHHH form'
value: ${{ steps.get-latest-version.outputs.git-describe }}
runs:
using: 'composite'
steps:
- id: get-latest-version
run: |
node <<'SCRIPT'
process.env['INPUT_TARANTOOL-VERSION'] = '${{ inputs.tarantool-series }}'
process.env['INPUT_NIGHTLY-BUILD'] = '${{ inputs.nightly-build }}'
require('./dist/main').latest_version().then(v => {
console.log(`package: ${v}`)
console.log(`::set-output name=package::${v}`)

/*
* 1.10.13.0.g1d2c5aad5-1
* ->
* parts[0]: '1'
* parts[1]: '10'
* parts[2]: '13'
* parts[3]: '0'
* parts[4]: 'g1d2c5aad5'
* parts[5]: '1'
*/
var parts = v.split(/[.-]/)

var abc = parts.slice(0, 3).join('.')
var abcd = `${abc}.${parts[3]}`
var abc_d = `${abc}-${parts[3]}`
var git_describe = `${abc_d}-${parts[4]}`

console.log(`abc: ${abc}`)
console.log(`abcd: ${abcd}`)
console.log(`abc-d: ${abc_d}`)
console.log(`git-describe: ${git_describe}`)

console.log(`::set-output name=abc::${abc}`)
console.log(`::set-output name=abcd::${abcd}`)
console.log(`::set-output name=abc-d::${abc_d}`)
console.log(`::set-output name=git-describe::${git_describe}`)
})
SCRIPT
shell: bash
49 changes: 49 additions & 0 deletions .github/actions/verify-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This action is supposed to be used in setup-tarantool CI.
#
# It verifies currently installed tarantool against two
# properties:
#
# 1. Tarantool version matches provided version prefix.
# 2. Tarantool is installed by apt-get/from cache.
#
# Usage example:
#
# - steps:
# - uses: ./.github/actions/verify-version
# with:
# tarantool-version: '1.10.12' # don't miss quotes!
# from-cache: false

name: 'Verify tarantool version'
description: 'Verify that installed tarantool has given version'
inputs:
tarantool-version:
description: 'Expected tarantool version (version string prefix)'
required: true
from-cache:
description: 'Expect tarantool from cache or from apt-get (if omitted, does not perform the check)'
required: false
default: ''
runs:
using: 'composite'
steps:
- name: Verify tarantool version
run: |
tarantool -e "assert(_TARANTOOL:startswith('${{ inputs.tarantool-version }}'), _TARANTOOL)"
shell: bash

- name: Verify that tarantool is installed from the cache
run: |
if dpkg --status tarantool; then
echo "Tarantool is installed by apt-get, but it is expected that"
echo "tarantool will be installed from the cache"
exit 1
fi
if: inputs.from-cache == 'true'
shell: bash

- name: Verify that tarantool is installed by apt-get (not from the cache)
run: |
dpkg --status tarantool
if: inputs.from-cache == 'false'
shell: bash
211 changes: 211 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,214 @@ jobs:
uses: ./
with:
tarantool-version: '1.10'

# This test case performs basic test of the three digit version
# support.
#
# It performs the following steps and checks.
#
# - install 1.10.12
# - checks: version, non-cached
# - uninstall tarantool
# - install 1.10.12
# - checks: version, cached
# - install 1.10.LATEST
# - checks: version, non-cached
test-exact-version-basic:
runs-on: ubuntu-latest
env:
TARANTOOL_CACHE_KEY_SUFFIX: -C-${{ github.run_id }}
steps:
- uses: actions/checkout@v2

- id: latest-version
uses: ./.github/actions/latest-version
with:
tarantool-series: '1.10'

- name: Install 1.10.12 (non-cached)
uses: ./
with:
tarantool-version: '1.10.12'
nightly-build: false

- uses: ./.github/actions/verify-version
with:
tarantool-version: '1.10.12-0'
from-cache: false

- name: Uninstall tarantool
run: sudo apt-get -y remove tarantool tarantool-dev tarantool-common

- name: Install 1.10.12 (cached)
uses: ./
with:
tarantool-version: '1.10.12'
nightly-build: false

- uses: ./.github/actions/verify-version
with:
tarantool-version: '1.10.12-0'
from-cache: true

- name: Install 1.10.LATEST (non-cached)
uses: ./
with:
tarantool-version: '${{ steps.latest-version.outputs.abc }}'
nightly-build: false

- uses: ./.github/actions/verify-version
with:
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
from-cache: false

# This test case verifies that a two digit version is installed
# without any problem after a three digit version (not a latest
# one).
#
# - install 1.10.12
# - checks: version, non-cached
# - uninstall tarantool
# - install 1.10
# - checks: version, non-cached
test-exact-version-then-two-digit-version:
runs-on: ubuntu-latest
env:
TARANTOOL_CACHE_KEY_SUFFIX: -D-${{ github.run_id }}
steps:
- uses: actions/checkout@v2

- id: latest-version
uses: ./.github/actions/latest-version
with:
tarantool-series: '1.10'

- name: Install 1.10.12 (non-cached)
uses: ./
with:
tarantool-version: '1.10.12'
nightly-build: false

- uses: ./.github/actions/verify-version
with:
tarantool-version: '1.10.12-0'
from-cache: false

- name: Uninstall tarantool
run: sudo apt-get -y remove tarantool tarantool-dev tarantool-common

- name: Install 1.10 (non-cached)
uses: ./
with:
tarantool-version: '1.10'
nightly-build: false

- uses: ./.github/actions/verify-version
with:
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
from-cache: false

# This test case verifies that a two digit version is installed
# without any problem after a three digit version (the latest
# one).
#
# - install 1.10.LATEST
# - checks: version, non-cached
# - uninstall tarantool
# - install 1.10
# - checks: version, cached
test-exact-version-latest-then-two-digit-version:
runs-on: ubuntu-latest
env:
TARANTOOL_CACHE_KEY_SUFFIX: -E-${{ github.run_id }}
steps:
- uses: actions/checkout@v2

- id: latest-version
uses: ./.github/actions/latest-version
with:
tarantool-series: '1.10'

- name: Install 1.10.LATEST (non-cached)
uses: ./
with:
tarantool-version: '${{ steps.latest-version.outputs.abc }}'
nightly-build: false

- uses: ./.github/actions/verify-version
with:
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
from-cache: false

- name: Uninstall tarantool
run: sudo apt-get -y remove tarantool tarantool-dev tarantool-common

- name: Install 1.10 (cached)
uses: ./
with:
tarantool-version: '1.10'
nightly-build: false

- uses: ./.github/actions/verify-version
with:
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
from-cache: true

# This test case performs basic test of four digit version
# support (for nightly repositories).
#
# - install 1.10.LATEST.LATEST (nightly)
# - checks: version, non-cached
# - uninstall tarantool
# - install 1.10.LATEST (nightly)
# - checks: version, cached
# - install 1.10 (nightly)
# - checks: version, cached
test-exact-version-nightly:
runs-on: ubuntu-latest
env:
TARANTOOL_CACHE_KEY_SUFFIX: -F-${{ github.run_id }}
steps:
- uses: actions/checkout@v2

- id: latest-version
uses: ./.github/actions/latest-version
with:
tarantool-series: '1.10'
nightly-build: true

- name: Install 1.10.LATEST.LATEST (nightly, non-cached)
uses: ./
with:
tarantool-version: '${{ steps.latest-version.outputs.abcd }}'
nightly-build: true

- uses: ./.github/actions/verify-version
with:
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
from-cache: false

- name: Uninstall tarantool
run: sudo apt-get -y remove tarantool tarantool-dev tarantool-common

- name: Install 1.10.LATEST (nightly, cached)
uses: ./
with:
tarantool-version: '1.10'
nightly-build: true

- uses: ./.github/actions/verify-version
with:
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
from-cache: true

- name: Install 1.10 (nightly, cached)
uses: ./
with:
tarantool-version: '1.10'
nightly-build: true

- uses: ./.github/actions/verify-version
with:
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
from-cache: true
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,24 @@ steps:
- run: .rocks/bin/luatest -v
```

### Install an exact version

```
steps:
- uses: actions/checkout@v2
- uses: tarantool/setup-tarantool@v1
with:
tarantool-version: '2.6.1'
```

### Install a nightly build

```yaml
steps:
- uses: actions/checkout@v2
- uses: tarantool/setup-tarantool@v1
with:
tarantool-version: '2.6'
tarantool-version: '2.6' # or, say, '2.6.1.0' for exact version
nightly-build: true
```

Expand Down
Loading