-
Notifications
You must be signed in to change notification settings - Fork 2
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.