Skip to content

feature: support 2.10+ releases #24

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 24, 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
6 changes: 6 additions & 0 deletions .github/actions/latest-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
# # ---> 1.10.13-0
# - run: echo ${{ steps.latest-version.outputs.git-describe }}
# # ---> 1.10.13-0-g1d2c5aad5
#
# Caution: It works smoothly only for 1.10/2.8, but not for 2.10+
# due to changes in the package versioning (see the new release
# policy document, [1]).
#
# [1]: https://github.com/tarantool/tarantool/discussions/6182

name: 'Latest tarantool version'
description: 'Get latest tarantool version of given release series'
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,52 @@ jobs:
with:
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
from-cache: true

# This test case installs tarantool of series-2 using
# one/two/three digit version specifier.
#
# It performs the following steps and checks.
#
# - install 2/2.10/2.10.0
# - checks: version, non-cached
# - uninstall tarantool
# - install 2/2.10/2.10.0
# - checks: version, cached
test-series-2:
strategy:
fail-fast: false
matrix:
tarantool:
- '2'
- '2.10'
- '2.10.0'
runs-on: ubuntu-latest
env:
# github.run_id is the same across different jobs created
# from the same matrix.
TARANTOOL_CACHE_KEY_SUFFIX: -G-${{ matrix.tarantool }}-${{ github.run_id }}
steps:
- uses: actions/checkout@v2

- name: Install ${{ matrix.tarantool }} (non-cached)
uses: ./
with:
tarantool-version: '${{ matrix.tarantool }}'

- uses: ./.github/actions/verify-version
with:
tarantool-version: '${{ matrix.tarantool }}'
from-cache: false

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

- name: Install ${{ matrix.tarantool }} (cached)
uses: ./
with:
tarantool-version: '${{ matrix.tarantool }}'

- uses: ./.github/actions/verify-version
with:
tarantool-version: '${{ matrix.tarantool }}'
from-cache: true
42 changes: 38 additions & 4 deletions dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58024,10 +58024,6 @@ const path = __importStar(__nccwpck_require__(1017));
const fs = __importStar(__nccwpck_require__(7147));
const nightlyBuild = (core.getInput('nightly-build') || 'false').toUpperCase() === 'TRUE';
const tarantool_version = core.getInput('tarantool-version', { required: true });
const tarantool_series = tarantool_version.split('.', 2).join('.');
const baseUrl = 'https://download.tarantool.org/tarantool/' +
(nightlyBuild ? '' : 'release/') +
tarantool_series;
async function capture(cmd, options) {
let output = '';
await exec.exec(cmd, [], {
Expand Down Expand Up @@ -58081,7 +58077,44 @@ function semver_max(a, b) {
return pa[i] >= pb[i] ? a : b;
}
}
function construct_base_url() {
const parts = tarantool_version.split('.', 2);
const major = Number(parts[0]);
const minor = Number(parts[1]);
var tarantool_series;
// Assume that just 2 is latest 2, so it is 2.10+ too.
if (major >= 3 ||
(major == 2 && minor >= 10) ||
(major == 2 && isNaN(minor))) {
/*
* 2.10+ -- the new release policy is in effect.
*
* A release series is determined by a major version.
* Nightly builds are not provided.
*
* https://github.com/tarantool/tarantool/discussions/6182
*/
tarantool_series = `series-${major}`;
if (nightlyBuild) {
throw new Error(`${tarantool_series} does not offer nightly builds`);
}
}
else {
/*
* 1.10, 2.1, ..., 2.8 -- old release policy is in effect.
*
* A release series is determined by major and minor
* versions. There are release and nightly builds (separate
* repositories).
*/
tarantool_series = `${major}.${minor}`;
}
return ('https://download.tarantool.org/tarantool/' +
(nightlyBuild ? '' : 'release/') +
tarantool_series);
}
async function available_versions(version_prefix) {
const baseUrl = construct_base_url();
const repo = baseUrl + '/ubuntu/dists/' + (await lsb_release());
// Don't return 1.10.10, when the version prefix is 1.10.1.
const prefix = version_prefix ? version_prefix + '.' : '';
Expand Down Expand Up @@ -58123,6 +58156,7 @@ async function run_linux() {
try {
const distro = await lsb_release();
const cache_dir = 'cache-tarantool';
const baseUrl = construct_base_url();
core.startGroup(`Checking latest tarantool ${tarantool_version} version`);
const version = await latest_version(tarantool_version);
core.info(`${version}`);
Expand Down
49 changes: 44 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ import * as fs from 'fs'
const nightlyBuild =
(core.getInput('nightly-build') || 'false').toUpperCase() === 'TRUE'
const tarantool_version = core.getInput('tarantool-version', {required: true})
const tarantool_series = tarantool_version.split('.', 2).join('.')
const baseUrl =
'https://download.tarantool.org/tarantool/' +
(nightlyBuild ? '' : 'release/') +
tarantool_series

interface CaptureOptions {
/** optional. defaults to false */
Expand Down Expand Up @@ -78,9 +73,52 @@ function semver_max(a: string, b: string): string {
}
}

function construct_base_url(): string {
const parts = tarantool_version.split('.', 2)
const major = Number(parts[0])
const minor = Number(parts[1])

var tarantool_series
// Assume that just 2 is latest 2, so it is 2.10+ too.
if (
major >= 3 ||
(major == 2 && minor >= 10) ||
(major == 2 && isNaN(minor))
) {
/*
* 2.10+ -- the new release policy is in effect.
*
* A release series is determined by a major version.
* Nightly builds are not provided.
*
* https://github.com/tarantool/tarantool/discussions/6182
*/
tarantool_series = `series-${major}`
if (nightlyBuild) {
throw new Error(`${tarantool_series} does not offer nightly builds`)
}
} else {
/*
* 1.10, 2.1, ..., 2.8 -- old release policy is in effect.
*
* A release series is determined by major and minor
* versions. There are release and nightly builds (separate
* repositories).
*/
tarantool_series = `${major}.${minor}`
}

return (
'https://download.tarantool.org/tarantool/' +
(nightlyBuild ? '' : 'release/') +
tarantool_series
)
}

async function available_versions(
version_prefix: string
): Promise<Array<string>> {
const baseUrl = construct_base_url()
const repo = baseUrl + '/ubuntu/dists/' + (await lsb_release())

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

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