Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test dist aliases #11

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply internal discussion agreements
  • Loading branch information
panticmilos committed Nov 25, 2022
commit f1f69d49da7f85ae8f8d0d039e7478fc76a9632e
2 changes: 0 additions & 2 deletions .github/workflows/versions.yml
Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@ jobs:
uses: ./
with:
go-version: stable
architecture: x64
- name: Verify Go
run: go version

@@ -40,7 +39,6 @@ jobs:
uses: ./
with:
go-version: oldstable
architecture: x64
- name: Verify Go
run: go version

2 changes: 1 addition & 1 deletion __tests__/setup-go.test.ts
Original file line number Diff line number Diff line change
@@ -722,7 +722,7 @@ describe('setup-go', () => {
expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...');
expect(logSpy).toHaveBeenCalledWith('Added go to the path');
expect(logSpy).toHaveBeenCalledWith(
`Successfully set up Go version ${patchVersion}`
`Successfully set up Go version ${versionSpec}`
);
});

4 changes: 2 additions & 2 deletions src/installer.ts
Original file line number Diff line number Diff line change
@@ -129,7 +129,7 @@ export async function getGo(
return downloadPath;
}

export async function resolveVersionFromManifest(
async function resolveVersionFromManifest(
versionSpec: string,
stable: boolean,
auth: string | undefined,
@@ -358,7 +358,7 @@ export async function resolveStableVersionInput(
versionSpec: string,
auth: string | undefined,
arch = os.arch(),
manifest: tc.IToolRelease[] | undefined
manifest: tc.IToolRelease[] | undefined,
): Promise<string> {
if (!manifest) {
core.debug('No manifest cached');
11 changes: 3 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -8,15 +8,14 @@ import {isCacheFeatureAvailable} from './cache-utils';
import cp from 'child_process';
import fs from 'fs';
import os from 'os';
import {IS_WINDOWS} from './utils';

export async function run() {
try {
//
// versionSpec is optional. If supplied, install / use from the tool cache
// If not supplied then problem matchers will still be setup. Useful for self-hosted.
//
let versionSpec = resolveVersionInput();
const versionSpec = resolveVersionInput();

const cache = core.getBooleanInput('cache');
core.info(`Setup go version spec ${versionSpec}`);
@@ -43,16 +42,12 @@ export async function run() {
manifest
);

if (IS_WINDOWS) {
versionSpec = installDir.split('\\').reverse()[1];
} else {
versionSpec = installDir.split('/').reverse()[1];
}
const installDirVersion = path.basename(path.dirname(installDir));

core.addPath(path.join(installDir, 'bin'));
core.info('Added go to the path');

const version = installer.makeSemver(versionSpec);
const version = installer.makeSemver(installDirVersion);
// Go versions less than 1.9 require GOROOT to be set
if (semver.lt(version, '1.9.0')) {
core.info('Setting GOROOT for Go version < 1.9');
2 changes: 0 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -2,5 +2,3 @@ export enum StableReleaseAlias {
Stable = 'stable',
OldStable = 'oldstable'
}

export const IS_WINDOWS = process.platform === 'win32';