tests(withdeploy): add tests for withdeploy
This commit is contained in:
parent
35de0fc568
commit
d7ba37343c
5 changed files with 50 additions and 11 deletions
|
@ -43,6 +43,8 @@ jobs:
|
||||||
- name: Test
|
- name: Test
|
||||||
id: npm-ci-test
|
id: npm-ci-test
|
||||||
run: npm run ci-test
|
run: npm run ci-test
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.RENOVATE_GITHUB_TOKEN }}
|
||||||
|
|
||||||
test-action:
|
test-action:
|
||||||
name: GitHub Actions Test
|
name: GitHub Actions Test
|
||||||
|
|
|
@ -18,7 +18,9 @@ afterEach(() => {
|
||||||
|
|
||||||
describe('Install Hugo', () => {
|
describe('Install Hugo', () => {
|
||||||
test('Download latest Hugo', async () => {
|
test('Download latest Hugo', async () => {
|
||||||
const releaseLookup = new OctokitReleaseLookup()
|
const releaseLookup = new OctokitReleaseLookup(
|
||||||
|
process.env.GITHUB_TOKEN || undefined
|
||||||
|
)
|
||||||
const platformMock = new Platform('linux', undefined, { HOME: tmpDir })
|
const platformMock = new Platform('linux', undefined, { HOME: tmpDir })
|
||||||
const hugo = new HugoInstaller(releaseLookup, platformMock)
|
const hugo = new HugoInstaller(releaseLookup, platformMock)
|
||||||
|
|
||||||
|
@ -29,4 +31,36 @@ describe('Install Hugo', () => {
|
||||||
})
|
})
|
||||||
).not.toThrow()
|
).not.toThrow()
|
||||||
}, 30_000)
|
}, 30_000)
|
||||||
|
|
||||||
|
test('Download latest Hugo - extended', async () => {
|
||||||
|
const releaseLookup = new OctokitReleaseLookup(
|
||||||
|
process.env.GITHUB_TOKEN || undefined
|
||||||
|
)
|
||||||
|
const platformMock = new Platform('linux', undefined, { HOME: tmpDir })
|
||||||
|
const hugo = new HugoInstaller(releaseLookup, platformMock)
|
||||||
|
|
||||||
|
expect(
|
||||||
|
async () =>
|
||||||
|
await hugo.install({
|
||||||
|
version: 'latest',
|
||||||
|
extended: true
|
||||||
|
})
|
||||||
|
).not.toThrow()
|
||||||
|
}, 30_000)
|
||||||
|
|
||||||
|
test('Download latest Hugo - with deploy', async () => {
|
||||||
|
const releaseLookup = new OctokitReleaseLookup(
|
||||||
|
process.env.GITHUB_TOKEN || undefined
|
||||||
|
)
|
||||||
|
const platformMock = new Platform('linux', undefined, { HOME: tmpDir })
|
||||||
|
const hugo = new HugoInstaller(releaseLookup, platformMock)
|
||||||
|
|
||||||
|
expect(
|
||||||
|
async () =>
|
||||||
|
await hugo.install({
|
||||||
|
version: 'latest',
|
||||||
|
withDeploy: true
|
||||||
|
})
|
||||||
|
).not.toThrow()
|
||||||
|
}, 30_000)
|
||||||
})
|
})
|
||||||
|
|
8
dist/index.js
vendored
8
dist/index.js
vendored
|
@ -50817,10 +50817,10 @@ class HugoInstaller {
|
||||||
const tmpDir = external_node_os_namespaceObject.tmpdir();
|
const tmpDir = external_node_os_namespaceObject.tmpdir();
|
||||||
let versionSpec = release.tag_name;
|
let versionSpec = release.tag_name;
|
||||||
if (cmd.extended) {
|
if (cmd.extended) {
|
||||||
versionSpec += '+extended';
|
versionSpec = `${release.tag_name}+extended`;
|
||||||
}
|
}
|
||||||
if (cmd.withDeploy) {
|
else if (cmd.withDeploy) {
|
||||||
versionSpec += '+withdeploy';
|
versionSpec = `${release.tag_name}+extended+withdeploy`;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const cachedTool = tool_cache.find(Hugo.Name, versionSpec, this.platform.arch);
|
const cachedTool = tool_cache.find(Hugo.Name, versionSpec, this.platform.arch);
|
||||||
|
@ -50832,7 +50832,7 @@ class HugoInstaller {
|
||||||
catch (e) {
|
catch (e) {
|
||||||
core.warning(`Failed to lookup tool in cache: ${errorMsg(e)}`);
|
core.warning(`Failed to lookup tool in cache: ${errorMsg(e)}`);
|
||||||
}
|
}
|
||||||
const toolUrl = release.assetUrl(this.platform, cmd.extended);
|
const toolUrl = release.assetUrl(this.platform, cmd.extended, cmd.withDeploy);
|
||||||
if (!toolUrl) {
|
if (!toolUrl) {
|
||||||
throw new Error('No matching URL detected for given platform');
|
throw new Error('No matching URL detected for given platform');
|
||||||
}
|
}
|
||||||
|
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
13
src/hugo.ts
13
src/hugo.ts
|
@ -43,10 +43,9 @@ export class HugoInstaller {
|
||||||
|
|
||||||
let versionSpec = release.tag_name
|
let versionSpec = release.tag_name
|
||||||
if (cmd.extended) {
|
if (cmd.extended) {
|
||||||
versionSpec += '+extended'
|
versionSpec = `${release.tag_name}+extended`
|
||||||
}
|
} else if (cmd.withDeploy) {
|
||||||
if (cmd.withDeploy) {
|
versionSpec = `${release.tag_name}+extended+withdeploy`
|
||||||
versionSpec += '+withdeploy'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -59,7 +58,11 @@ export class HugoInstaller {
|
||||||
core.warning(`Failed to lookup tool in cache: ${errorMsg(e)}`)
|
core.warning(`Failed to lookup tool in cache: ${errorMsg(e)}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const toolUrl = release.assetUrl(this.platform, cmd.extended)
|
const toolUrl = release.assetUrl(
|
||||||
|
this.platform,
|
||||||
|
cmd.extended,
|
||||||
|
cmd.withDeploy
|
||||||
|
)
|
||||||
|
|
||||||
if (!toolUrl) {
|
if (!toolUrl) {
|
||||||
throw new Error('No matching URL detected for given platform')
|
throw new Error('No matching URL detected for given platform')
|
||||||
|
|
Loading…
Reference in a new issue