diff --git a/.github/actions/latest-version/action.yml b/.github/actions/latest-version/action.yml index 0bc2b81..3ca0873 100644 --- a/.github/actions/latest-version/action.yml +++ b/.github/actions/latest-version/action.yml @@ -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' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c7ffec9..ad0b7ed 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/dist/main/index.js b/dist/main/index.js index 01100cd..61c35e7 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -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, [], { @@ -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 + '.' : ''; @@ -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}`); diff --git a/src/main.ts b/src/main.ts index 34ba98b..fcbd96c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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 */ @@ -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> { + 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. @@ -125,6 +163,7 @@ async function run_linux(): Promise { 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)