修改下载文件arch问题
All checks were successful
Continuous Integration / GitHub Actions Test (push) Successful in 29s
All checks were successful
Continuous Integration / GitHub Actions Test (push) Successful in 29s
This commit is contained in:
parent
974228f061
commit
f586867fa1
@ -1,25 +0,0 @@
|
||||
/**
|
||||
* Unit tests for src/wait.ts
|
||||
*/
|
||||
|
||||
import { wait } from '../src/wait'
|
||||
import { expect } from '@jest/globals'
|
||||
|
||||
describe('wait.ts', () => {
|
||||
it('throws an invalid number', async () => {
|
||||
const input = parseInt('foo', 10)
|
||||
expect(isNaN(input)).toBe(true)
|
||||
|
||||
await expect(wait(input)).rejects.toThrow('milliseconds not a number')
|
||||
})
|
||||
|
||||
it('waits with a valid number', async () => {
|
||||
const start = new Date()
|
||||
await wait(500)
|
||||
const end = new Date()
|
||||
|
||||
const delta = Math.abs(end.getTime() - start.getTime())
|
||||
|
||||
expect(delta).toBeGreaterThan(450)
|
||||
})
|
||||
})
|
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
@ -5,7 +5,8 @@ import os from 'os'
|
||||
const BinBaseUrl = 'https://nodejs.org/dist/'
|
||||
const DestDir = '/denv'
|
||||
|
||||
export function getFileName(version: string, arch = os.arch()): string {
|
||||
export function getFileName(version: string): string {
|
||||
const arch = 'x64'
|
||||
return `node-${version}-${os.platform()}-${arch}.tar.gz`
|
||||
}
|
||||
|
||||
|
16
src/main.ts
16
src/main.ts
@ -1,7 +1,6 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as io from '@actions/io'
|
||||
import * as ac from '@actions/cache'
|
||||
import os from 'os'
|
||||
import path from 'path'
|
||||
import cp from 'child_process'
|
||||
import { getFileName, getRootPath, getInstalledPath } from './install'
|
||||
@ -18,16 +17,13 @@ export async function run(): Promise<void> {
|
||||
const version: string = resolveVersionInput()
|
||||
// Debug logs are only output if the `ACTIONS_STEP_DEBUG` secret is true
|
||||
core.debug(`The input version is: ${version}`)
|
||||
// 获取输入的architecture
|
||||
let arch = core.getInput('architecture')
|
||||
if (!arch) {
|
||||
arch = os.arch()
|
||||
}
|
||||
if (arch === 'x64') {
|
||||
arch = 'amd64'
|
||||
}
|
||||
// // 获取输入的architecture
|
||||
// let arch = core.getInput('architecture')
|
||||
// if (!arch) {
|
||||
// arch = os.arch()
|
||||
// }
|
||||
// 构建文件名
|
||||
const dlgfName = getFileName(version, arch)
|
||||
const dlgfName = getFileName(version)
|
||||
let installedPath = getRootPath(version)
|
||||
// 尝试从缓存中恢复
|
||||
const rcr = await ac.restoreCache([installedPath], dlgfName)
|
||||
|
Loading…
Reference in New Issue
Block a user