Merge branch 'fix/build-output-retrieval' into fix/linux-act-setup
This commit is contained in:
40
src/act.ts
40
src/act.ts
@@ -2,9 +2,9 @@ import * as childProcess from "child_process";
|
|||||||
import * as fs from "fs/promises";
|
import * as fs from "fs/promises";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import sanitize from "sanitize-filename";
|
import sanitize from "sanitize-filename";
|
||||||
import { CustomExecution, EventEmitter, ExtensionContext, Pseudoterminal, ShellExecution, TaskDefinition, TaskGroup, TaskPanelKind, TaskRevealKind, tasks, TaskScope, TerminalDimensions, Uri, window, workspace, WorkspaceFolder } from "vscode";
|
import { CustomExecution, env, EventEmitter, ExtensionContext, Pseudoterminal, ShellExecution, TaskDefinition, TaskGroup, TaskPanelKind, TaskRevealKind, tasks, TaskScope, TerminalDimensions, Uri, window, workspace, WorkspaceFolder } from "vscode";
|
||||||
import { ComponentsManager } from "./componentsManager";
|
import { ComponentsManager } from "./componentsManager";
|
||||||
import { ConfigurationManager, Section } from "./configurationManager";
|
import { ConfigurationManager, Platform, Section } from "./configurationManager";
|
||||||
import { componentsTreeDataProvider, historyTreeDataProvider } from './extension';
|
import { componentsTreeDataProvider, historyTreeDataProvider } from './extension';
|
||||||
import { HistoryManager, HistoryStatus } from './historyManager';
|
import { HistoryManager, HistoryStatus } from './historyManager';
|
||||||
import { SecretManager } from "./secretManager";
|
import { SecretManager } from "./secretManager";
|
||||||
@@ -172,9 +172,9 @@ export class Act {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Refresh components view after installation
|
// Refresh components view after installation
|
||||||
tasks.onDidEndTask(async e => {
|
tasks.onDidEndTaskProcess(async e => {
|
||||||
const taskDefinition = e.execution.task.definition;
|
const taskDefinition = e.execution.task.definition;
|
||||||
if (taskDefinition.type === 'nektos/act installation') {
|
if (taskDefinition.type === 'nektos/act installation' && e.exitCode === 0) {
|
||||||
// Update base act command based on installation method
|
// Update base act command based on installation method
|
||||||
if (taskDefinition.ghCliInstall) {
|
if (taskDefinition.ghCliInstall) {
|
||||||
await ConfigurationManager.set(Section.actCommand, Act.githubCliCommand);
|
await ConfigurationManager.set(Section.actCommand, Act.githubCliCommand);
|
||||||
@@ -191,6 +191,19 @@ export class Act {
|
|||||||
return ConfigurationManager.get<string>(Section.actCommand) || Act.command;
|
return ConfigurationManager.get<string>(Section.actCommand) || Act.command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getShell() {
|
||||||
|
switch (process.platform) {
|
||||||
|
case Platform.windows:
|
||||||
|
return 'cmd';
|
||||||
|
case Platform.mac:
|
||||||
|
return 'zsh';
|
||||||
|
case Platform.linux:
|
||||||
|
return 'bash';
|
||||||
|
default:
|
||||||
|
return env.shell;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async runAllWorkflows(workspaceFolder: WorkspaceFolder) {
|
async runAllWorkflows(workspaceFolder: WorkspaceFolder) {
|
||||||
return await this.runCommand({
|
return await this.runCommand({
|
||||||
path: workspaceFolder.uri.fsPath,
|
path: workspaceFolder.uri.fsPath,
|
||||||
@@ -367,13 +380,16 @@ export class Act {
|
|||||||
command,
|
command,
|
||||||
{
|
{
|
||||||
cwd: commandArgs.path,
|
cwd: commandArgs.path,
|
||||||
shell: true,
|
shell: this.getShell(),
|
||||||
env: settings.secrets
|
env: {
|
||||||
.filter(secret => secret.value)
|
...process.env,
|
||||||
.reduce((previousValue, currentValue) => {
|
...settings.secrets
|
||||||
previousValue[currentValue.key] = currentValue.value;
|
.filter(secret => secret.value)
|
||||||
return previousValue;
|
.reduce((previousValue, currentValue) => {
|
||||||
}, {} as Record<string, string>)
|
previousValue[currentValue.key] = currentValue.value;
|
||||||
|
return previousValue;
|
||||||
|
}, {} as Record<string, string>)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
exec.stdout.on('data', handleIO);
|
exec.stdout.on('data', handleIO);
|
||||||
@@ -458,7 +474,7 @@ export class Act {
|
|||||||
problemMatchers: [],
|
problemMatchers: [],
|
||||||
runOptions: {},
|
runOptions: {},
|
||||||
group: TaskGroup.Build,
|
group: TaskGroup.Build,
|
||||||
execution: new ShellExecution(command)
|
execution: new ShellExecution(command, { executable: this.getShell() })
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export class ComponentsManager {
|
|||||||
|
|
||||||
if (selectedPrebuiltExecutable) {
|
if (selectedPrebuiltExecutable) {
|
||||||
await env.openExternal(Uri.parse(selectedPrebuiltExecutable.link));
|
await env.openExternal(Uri.parse(selectedPrebuiltExecutable.link));
|
||||||
window.showInformationMessage('Unpack and run the executable in the terminal specifying the full path or add it to one of the paths in your PATH environment variable. Once nektos/act is successfully installed, refresh the components view.', 'Refresh').then(async value => {
|
window.showInformationMessage('Unpack the executable and move it to your desired location. Once nektos/act is successfully installed, add it to your shell\'s PATH and then refresh the components view.', 'Refresh').then(async value => {
|
||||||
if (value === 'Refresh') {
|
if (value === 'Refresh') {
|
||||||
componentsTreeDataProvider.refresh();
|
componentsTreeDataProvider.refresh();
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ export class ComponentsManager {
|
|||||||
}
|
}
|
||||||
} else if (selectedInstallationMethod.link) {
|
} else if (selectedInstallationMethod.link) {
|
||||||
await env.openExternal(Uri.parse(selectedInstallationMethod.link));
|
await env.openExternal(Uri.parse(selectedInstallationMethod.link));
|
||||||
window.showInformationMessage('Once nektos/act is successfully installed, refresh the components view.', 'Refresh').then(async value => {
|
window.showInformationMessage('Once nektos/act is successfully installed, add it to your shell\'s PATH and then refresh the components view.', 'Refresh').then(async value => {
|
||||||
if (value === 'Refresh') {
|
if (value === 'Refresh') {
|
||||||
componentsTreeDataProvider.refresh();
|
componentsTreeDataProvider.refresh();
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ export class ComponentsManager {
|
|||||||
problemMatchers: [],
|
problemMatchers: [],
|
||||||
runOptions: {},
|
runOptions: {},
|
||||||
group: TaskGroup.Build,
|
group: TaskGroup.Build,
|
||||||
execution: new ShellExecution('systemctl start docker')
|
execution: new ShellExecution('systemctl start docker', { executable: env.shell })
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
window.showErrorMessage(`Invalid environment: ${process.platform}`, 'Report an Issue').then(async value => {
|
window.showErrorMessage(`Invalid environment: ${process.platform}`, 'Report an Issue').then(async value => {
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ export class SettingsManager {
|
|||||||
return environments;
|
return environments;
|
||||||
}
|
}
|
||||||
|
|
||||||
async createSettingFile(workspaceFolder: WorkspaceFolder, storageKey: StorageKey, settingFileName: string) {
|
async createSettingFile(workspaceFolder: WorkspaceFolder, storageKey: StorageKey, settingFileName: string, content: string) {
|
||||||
const settingFileUri = Uri.file(path.join(workspaceFolder.uri.fsPath, settingFileName));
|
const settingFileUri = Uri.file(path.join(workspaceFolder.uri.fsPath, settingFileName));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -172,7 +172,7 @@ export class SettingsManager {
|
|||||||
window.showErrorMessage(`A file or folder named ${settingFileName} already exists at ${workspaceFolder.uri.fsPath}. Please choose another name.`);
|
window.showErrorMessage(`A file or folder named ${settingFileName} already exists at ${workspaceFolder.uri.fsPath}. Please choose another name.`);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
try {
|
try {
|
||||||
await workspace.fs.writeFile(settingFileUri, new TextEncoder().encode(''));
|
await workspace.fs.writeFile(settingFileUri, new TextEncoder().encode(content));
|
||||||
await this.locateSettingFile(workspaceFolder, storageKey, [settingFileUri]);
|
await this.locateSettingFile(workspaceFolder, storageKey, [settingFileUri]);
|
||||||
const document = await workspace.openTextDocument(settingFileUri);
|
const document = await workspace.openTextDocument(settingFileUri);
|
||||||
await window.showTextDocument(document);
|
await window.showTextDocument(document);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export default class SettingsTreeDataProvider implements TreeDataProvider<Github
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (secretFileName) {
|
if (secretFileName) {
|
||||||
await act.settingsManager.createSettingFile(secretsTreeItem.workspaceFolder, secretsTreeItem.storageKey, secretFileName);
|
await act.settingsManager.createSettingFile(secretsTreeItem.workspaceFolder, secretsTreeItem.storageKey, secretFileName, '');
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@@ -55,7 +55,7 @@ export default class SettingsTreeDataProvider implements TreeDataProvider<Github
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (variableFileName) {
|
if (variableFileName) {
|
||||||
await act.settingsManager.createSettingFile(variablesTreeItem.workspaceFolder, variablesTreeItem.storageKey, variableFileName);
|
await act.settingsManager.createSettingFile(variablesTreeItem.workspaceFolder, variablesTreeItem.storageKey, variableFileName, '');
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@@ -81,7 +81,7 @@ export default class SettingsTreeDataProvider implements TreeDataProvider<Github
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (inputFileName) {
|
if (inputFileName) {
|
||||||
await act.settingsManager.createSettingFile(inputsTreeItem.workspaceFolder, inputsTreeItem.storageKey, inputFileName);
|
await act.settingsManager.createSettingFile(inputsTreeItem.workspaceFolder, inputsTreeItem.storageKey, inputFileName, '');
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@@ -107,7 +107,7 @@ export default class SettingsTreeDataProvider implements TreeDataProvider<Github
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (payloadFileName) {
|
if (payloadFileName) {
|
||||||
await act.settingsManager.createSettingFile(payloadsTreeItem.workspaceFolder, payloadsTreeItem.storageKey, payloadFileName);
|
await act.settingsManager.createSettingFile(payloadsTreeItem.workspaceFolder, payloadsTreeItem.storageKey, payloadFileName, '{}');
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user