Skip to content

Commit

Permalink
added env descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrinded committed Sep 8, 2023
1 parent 3615574 commit da8c418
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 46 deletions.
4 changes: 3 additions & 1 deletion .changeset/moody-fans-juggle.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
# September Update

- [#258](https://github.com/Moonsong-Labs/moonwall/issues/258)
- [#254](https://github.com/Moonsong-Labs/moonwall/issues/254)
- [#254](https://github.com/Moonsong-Labs/moonwall/issues/254)
- [#251](https://github.com/Moonsong-Labs/moonwall/issues/251)
- [#224](https://github.com/Moonsong-Labs/moonwall/issues/224)
88 changes: 46 additions & 42 deletions packages/cli/src/cmds/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,46 +45,46 @@ async function mainMenu(config: MoonwallConfig) {
message: `Main Menu - Please select one of the following:`,
default: 0,
pageSize: 12,
choices: [
{
name: !configPresent
? "1) Initialise: Generate a new Moonwall Config File."
: chalk.dim("1) Initialise: ✅ CONFIG ALREADY GENERATED"),
value: "init",
disabled: configPresent,
},
{
name: configPresent
? `2) Network Launcher & Toolbox: Launch network, access tools: tail logs, interactive tests etc.`
: chalk.dim("2) Network Launcher & Toolbox NO CONFIG FOUND"),
value: "run",
disabled: !configPresent,
},
{
name: configPresent
? "3) Test Suite Execution: Run automated tests, start network if needed."
: chalk.dim("3) Test Suite Execution: NO CONFIG FOUND"),
value: "test",
choices: !configPresent
? [
{
name: !configPresent
? "1) Initialise: Generate a new Moonwall Config File."
: chalk.dim("1) Initialise: ✅ CONFIG ALREADY GENERATED"),
value: "init",
},
{
name: "2) Artifact Downloader: Fetch artifacts (x86) from GitHub repos.",
value: "download",
},
{
name: `3) Quit Application`,
value: "quit",
},
]
: [
{
name: configPresent
? `1) Network Launcher & Toolbox: Launch network, access tools: tail logs, interactive tests etc.`
: chalk.dim("2) Network Launcher & Toolbox NO CONFIG FOUND"),
value: "run",
},
{
name: configPresent
? "2) Test Suite Execution: Run automated tests, start network if needed."
: chalk.dim("3) Test Suite Execution: NO CONFIG FOUND"),
value: "test",
},

disabled: !configPresent,
},
{
name: chalk.dim("4) Batch-Run Tests: 🏗️ NOT YET IMPLEMENTED "),
value: "batch",

disabled: true,
},
{
name: "5) Artifact Downloader: Fetch artifacts (x86) from GitHub repos.",
value: "download",

disabled: false,
},
{
name: `6) Quit Application`,
value: "quit",
},
],
{
name: "3) Artifact Downloader: Fetch artifacts (x86) from GitHub repos.",
value: "download",
},
{
name: `4) Quit Application`,
value: "quit",
},
],
filter(val) {
return val;
},
Expand Down Expand Up @@ -134,6 +134,8 @@ async function resolveDownloadChoice() {
const binList = ghRepos().reduce((acc, curr) => {
acc.push(...curr.binaries.map((bin) => bin.name).flat());
acc.push(new inquirer.Separator());
acc.push("Back");
acc.push(new inquirer.Separator());
return acc;
}, [] as string[]);

Expand Down Expand Up @@ -204,7 +206,7 @@ async function resolveDownloadChoice() {
const chooseTestEnv = async (config: MoonwallConfig) => {
const envs = config.environments
.map((a) => ({
name: `Env: ${a.name} (${a.foundation.type})`,
name: `[${a.foundation.type}] ${a.name}${a.description ? ": \t\t" + a.description : ""}`,
value: a.name,
disabled: false,
}))
Expand Down Expand Up @@ -235,9 +237,11 @@ const chooseRunEnv = async (config: MoonwallConfig) => {
a.foundation.type === "chopsticks" ||
a.foundation.type === "zombie"
) {
result.name = `Env: ${a.name} (${a.foundation.type})`;
result.name = `[${a.foundation.type}] ${a.name}${
a.description ? ": \t\t" + a.description : ""
}`;
} else {
result.name = chalk.dim(`Env: ${a.name} (${a.foundation.type}) NO NETWORK TO RUN`);
result.name = chalk.dim(`[${a.foundation.type}] ${a.name} NO NETWORK TO RUN`);
result.disabled = true;
}
return result;
Expand Down
9 changes: 7 additions & 2 deletions packages/types/config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,11 @@
"additionalRepos": {
"description": "Use this to specify additional repos to download binaries from.\nPolkadot, Tanssi and Moonbeam are available by default.",
"items": {
"description": "`RepoSpec` type represents the configuration required to download binaries\nfrom a project's GitHub repository.",
"properties": {
"binaries": {
"items": {
"description": "`Bin` type defines the binary configurations within a `RepoSpec`.",
"properties": {
"defaultArgs": {
"items": {
Expand All @@ -515,8 +517,7 @@
"type": {
"enum": [
"binary",
"tar",
"zip"
"tar"
],
"type": "string"
}
Expand Down Expand Up @@ -586,6 +587,10 @@
},
"type": "object"
},
"description": {
"description": "Description of the environment to display in menus.",
"type": "string"
},
"envVars": {
"description": "An optional array of environment variable names.",
"items": {
Expand Down
49 changes: 48 additions & 1 deletion packages/types/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ export type Environment = {
*/
name: string;

/**
* Description of the environment to display in menus.
*/
description?: string;

/**
* An array of directories with test files.
*/
Expand Down Expand Up @@ -440,15 +445,57 @@ export interface OrcOptionsInterface {
setGlobalNetwork?: (network: object) => void;
}

/**
* `RepoSpec` type represents the configuration required to download binaries
* from a project's GitHub repository.
*
* @property {string} name - A unique identifier or name for the repo configuration.
* @property {string} ghAuthor - The GitHub username or organization under which the repository resides.
* @property {string} ghRepo - The GitHub repository name.
* @property {Bin[]} binaries - An array of binary configurations to be downloaded.
*
* @example
* {
* "name": "astar",
* "ghAuthor": "AstarNetwork",
* "ghRepo": "Astar",
* "binaries": [
* {
* "name": "astar-collator*ubuntu-x86*",
* "type": "tar",
* "defaultArgs": ["--dev", "--sealing=manual", "--no-hardware-benchmarks", "--no-telemetry"]
* }
* ]
* }
*/
export type RepoSpec = {
name: string;
ghAuthor: string;
ghRepo: string;
binaries: Bin[];
};

/**
* `Bin` type defines the binary configurations within a `RepoSpec`.
*
* @property {string} name - The name or pattern to identify the binary.
* @property {("binary"|"tar")?} type - The type of the binary. It's optional and can be one of "binary" or "tar".
* @property {string[]?} defaultArgs - An optional array of default arguments to be used with the binary.
*
* @example
* {
* "name": "hydradx"
* }
*
* @example
* {
* "name": "astar-collator*ubuntu-x86*",
* "type": "tar",
* "defaultArgs": ["--dev", "--sealing=manual", "--no-hardware-benchmarks", "--no-telemetry"]
* }
*/
export type Bin = {
name: string;
type?: "binary" | "tar" | "zip";
type?: "binary" | "tar" ;
defaultArgs?: string[];
};
3 changes: 3 additions & 0 deletions test/moonwall.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
{
"name": "dev_tanssi",
"testFileDir": ["suites/tanssi"],
"description": "Basic Tanssi dev test",
"foundation": {
"type": "dev",
"launchSpec": [
Expand Down Expand Up @@ -75,6 +76,7 @@
},
{
"name": "zombie_wasm",
"description": "For upgrade testing using zombienet",
"testFileDir": ["suites/zombie"],
"foundation": {
"type": "zombie",
Expand Down Expand Up @@ -142,6 +144,7 @@
},
{
"name": "basic",
"description": "Suite of tests that doesnt involve any blockchain stuff",
"testFileDir": ["suites/basic/"],
"foundation": {
"type": "read_only"
Expand Down

0 comments on commit da8c418

Please sign in to comment.