Skip to content

Commit c7585a5

Browse files
committed
feature: take arch into account
There are a few places, where we assume that only amd64 exists. Let's take the architecture into account. It solves two problems: * Now we fetch appropriate tarantool versions list (#60). * Now the architecture is a part of the cache key (#62). Fixes #60 Fixes #62
1 parent a0a2e46 commit c7585a5

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

dist/main/index.js

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ const nightlyBuild =
1111
(core.getInput('nightly-build') || 'false').toUpperCase() === 'TRUE'
1212
const tarantool_version = core.getInput('tarantool-version', {required: true})
1313

14+
// Debian/Ubuntu uses amd64/arm64 naming.
15+
const arch = core.platform.arch === 'x64' ? 'amd64' : core.platform.arch
16+
1417
interface CaptureOptions {
1518
/** optional. defaults to false */
1619
silent?: boolean
@@ -158,7 +161,7 @@ async function available_versions(
158161
const distro_id = (await lsb_release_id()).toLowerCase()
159162
const repo = baseUrl + '/' + distro_id + '/dists/' + distro
160163

161-
return http_get(`${repo}/main/binary-amd64/Packages`)
164+
return http_get(`${repo}/main/binary-${arch}/Packages`)
162165
.then(response => {
163166
if (response.message.statusCode !== 200) {
164167
throw new Error(`server replied ${response.message.statusCode}`)
@@ -299,6 +302,10 @@ function dpkg_is_file_included(
299302
}
300303

301304
async function run_linux(): Promise<void> {
305+
if (arch !== 'amd64' && arch !== 'arm64') {
306+
throw new Error(`Unsupported arch: ${arch}`)
307+
}
308+
302309
const distro = await lsb_release()
303310
const distro_id = (await lsb_release_id()).toLowerCase()
304311
const cache_dir = 'cache-tarantool'
@@ -309,15 +316,15 @@ async function run_linux(): Promise<void> {
309316
if (version == '') {
310317
throw new Error(
311318
`There is no tarantool ${tarantool_version} for ` +
312-
`${distro_id} ${distro}`
319+
`${distro_id} ${distro} ${arch}`
313320
)
314321
}
315322
core.info(`${version}`)
316323
core.endGroup()
317324
if (core.getInput('cache-key')) {
318325
core.warning("Setup-tarantool input 'cache-key' is deprecated")
319326
}
320-
let cache_key = `tarantool-setup-${distro}-${version}`
327+
let cache_key = `tarantool-setup-${distro}-${version}-${arch}`
321328
// This for testing only
322329
cache_key += process.env['TARANTOOL_CACHE_KEY_SUFFIX'] || ''
323330

0 commit comments

Comments
 (0)