mirror of
https://github.com/actions/setup-go.git
synced 2025-04-24 01:50:52 +00:00
fix tests and add log
This commit is contained in:
parent
54167c0c25
commit
e53583cbb2
5 changed files with 215 additions and 739 deletions
|
@ -215,7 +215,7 @@ describe('setup-go', () => {
|
|||
findSpy.mockImplementation(() => toolPath);
|
||||
await main.run();
|
||||
|
||||
expect(logSpy).toHaveBeenCalledWith(`Setup go stable version spec 1.13.0`);
|
||||
expect(logSpy).toHaveBeenCalledWith(`Setup go version spec 1.13.0`);
|
||||
});
|
||||
|
||||
it('evaluates to stable with no input', async () => {
|
||||
|
@ -227,7 +227,7 @@ describe('setup-go', () => {
|
|||
findSpy.mockImplementation(() => toolPath);
|
||||
await main.run();
|
||||
|
||||
expect(logSpy).toHaveBeenCalledWith(`Setup go stable version spec 1.13.0`);
|
||||
expect(logSpy).toHaveBeenCalledWith(`Setup go version spec 1.13.0`);
|
||||
});
|
||||
|
||||
it('finds a version of go already in the cache', async () => {
|
||||
|
@ -393,7 +393,7 @@ describe('setup-go', () => {
|
|||
await main.run();
|
||||
|
||||
let expPath = path.join(toolPath, 'bin');
|
||||
expect(logSpy).toHaveBeenCalledWith('Setup go stable version spec 1.12.14');
|
||||
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.12.14');
|
||||
expect(findSpy).toHaveBeenCalled();
|
||||
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.12.14...');
|
||||
expect(dlSpy).toHaveBeenCalled();
|
||||
|
@ -557,8 +557,8 @@ describe('setup-go', () => {
|
|||
|
||||
// 1.13.1 => 1.13.1
|
||||
// 1.13 => 1.13.0
|
||||
// 1.10beta1 => 1.10.0-beta1, 1.10rc1 => 1.10.0-rc1
|
||||
// 1.8.5beta1 => 1.8.5-beta1, 1.8.5rc1 => 1.8.5-rc1
|
||||
// 1.10beta1 => 1.10.0-beta.1, 1.10rc1 => 1.10.0-rc.1
|
||||
// 1.8.5beta1 => 1.8.5-beta.1, 1.8.5rc1 => 1.8.5-rc.1
|
||||
it('converts prerelease versions', async () => {
|
||||
expect(im.makeSemver('1.10beta1')).toBe('1.10.0-beta.1');
|
||||
expect(im.makeSemver('1.10rc1')).toBe('1.10.0-rc.1');
|
||||
|
@ -605,7 +605,7 @@ describe('setup-go', () => {
|
|||
|
||||
await main.run();
|
||||
|
||||
expect(logSpy).toHaveBeenCalledWith('Setup go stable version spec 1.16');
|
||||
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.16');
|
||||
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
||||
});
|
||||
|
||||
|
@ -630,7 +630,7 @@ describe('setup-go', () => {
|
|||
await main.run();
|
||||
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Setup go stable version spec ${versionSpec}`
|
||||
`Setup go version spec ${versionSpec}`
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
'Attempting to resolve the latest version from the manifest...'
|
||||
|
|
|
@ -7,9 +7,6 @@ inputs:
|
|||
check-latest:
|
||||
description: 'Set this option to true if you want the action to always check for the latest available version that satisfies the version spec'
|
||||
default: false
|
||||
stable:
|
||||
description: 'Whether to download only stable versions'
|
||||
default: 'true'
|
||||
token:
|
||||
description: Used to pull node distributions from go-versions. Since there's a default, this is typically not supplied by the user.
|
||||
default: ${{ github.token }}
|
||||
|
|
927
dist/index.js
vendored
927
dist/index.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -271,8 +271,8 @@ export async function getVersionsDist(
|
|||
// Convert the go version syntax into semver for semver matching
|
||||
// 1.13.1 => 1.13.1
|
||||
// 1.13 => 1.13.0
|
||||
// 1.10beta1 => 1.10.0-beta1, 1.10rc1 => 1.10.0-rc1
|
||||
// 1.8.5beta1 => 1.8.5-beta1, 1.8.5rc1 => 1.8.5-rc1
|
||||
// 1.10beta1 => 1.10.0-beta.1, 1.10rc1 => 1.10.0-rc.1
|
||||
// 1.8.5beta1 => 1.8.5-beta.1, 1.8.5rc1 => 1.8.5-rc.1
|
||||
export function makeSemver(version: string): string {
|
||||
version = version.replace('go', '');
|
||||
version = version.replace('beta', '-beta.').replace('rc', '-rc.');
|
||||
|
|
|
@ -14,11 +14,7 @@ export async function run() {
|
|||
//
|
||||
let versionSpec = core.getInput('go-version');
|
||||
|
||||
// stable will be true unless false is the exact input
|
||||
// since getting unstable versions should be explicit
|
||||
let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE';
|
||||
|
||||
core.info(`Setup go ${stable ? 'stable' : ''} version spec ${versionSpec}`);
|
||||
core.info(`Setup go version spec ${versionSpec}`);
|
||||
|
||||
if (versionSpec) {
|
||||
let token = core.getInput('token');
|
||||
|
|
Loading…
Add table
Reference in a new issue