Skip to content

Commit

Permalink
Feb Bug fixes (#380)
Browse files Browse the repository at this point in the history
* added download output name

* moved res

* using octokit

* refactor

* added type rigour to inquirer

* updated CI actions
  • Loading branch information
timbrinded authored Feb 19, 2024
1 parent 64da03f commit b15e00a
Show file tree
Hide file tree
Showing 21 changed files with 432 additions and 193 deletions.
8 changes: 8 additions & 0 deletions .changeset/famous-geckos-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@moonwall/cli": patch
---

Bug Fixes
- [#377](https://github.com/Moonsong-Labs/moonwall/issues/377) Help menu Fixed
- [#379](https://github.com/Moonsong-Labs/moonwall/issues/379) Downloading without config file present, fixed
- [#370](https://github.com/Moonsong-Labs/moonwall/issues/370) Implemented download options for fetchArtifacts
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 20.11.1
cache: pnpm
- name: Setup Pages
uses: actions/configure-pages@v3
Expand All @@ -43,7 +43,7 @@ jobs:
pnpm docs:build
touch .vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist

Expand Down
72 changes: 36 additions & 36 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,41 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 20.11.1
cache: "pnpm"
- run: pnpm install
- run: pnpm run build

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 20.11.1
cache: "pnpm"
- run: pnpm install
- run: pnpm run lint

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 20.11.1
cache: "pnpm"
- run: pnpm install
- run: pnpm run fmt
Expand All @@ -53,13 +53,13 @@ jobs:
runs-on: ubuntu-latest
needs: ["build"]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 20.11.1
cache: "pnpm"
- uses: oven-sh/setup-bun@v1
with:
Expand All @@ -77,16 +77,16 @@ jobs:
runs-on: ubuntu-latest
needs: ["build"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: "latest"
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 20.11.1
cache: "pnpm"
- name: Build like before
run: |
Expand All @@ -112,16 +112,16 @@ jobs:
matrix:
suite: ["dev_test", "dev_multi", "dev_seq"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: "latest"
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 20.11.1
cache: "pnpm"
- name: Build like before
run: |
Expand All @@ -147,13 +147,13 @@ jobs:
matrix:
suite: ["chopsticks", "multi_chopsticks", "chopsticks_round"]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 20.11.1
cache: "pnpm"
- name: Build like before
run: |
Expand Down Expand Up @@ -185,13 +185,13 @@ jobs:
matrix:
suite: ["eth_test", "viem_test"]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 20.11.1
cache: "pnpm"
- name: Build like before
run: |
Expand All @@ -216,13 +216,13 @@ jobs:
matrix:
suite: ["zombie_test", "zombie_multi_para"]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 20.11.1
cache: "pnpm"
- uses: oven-sh/setup-bun@v1
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ jobs:
matrix:
package: ["cli", "util"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 20.11.1
cache: "pnpm"
- run: pnpm install
- run: pnpm run build
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 20.11.1
cache: "pnpm"
- run: pnpm install
- run: pnpm run build
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Description
![moonwall](./moonwall.png)
![moonwall](resource/moonwall.png)

Moonwall is a comprehensive blockchain test framework for Substrate-based networks

Expand Down Expand Up @@ -41,11 +41,11 @@ import { ALITH_ADDRESS } from "@moonwall/util";

- `pnpm moonwall` : This can be used if locally installed, and will launch the main menu..

- `pnpx @moonwall/cli run <ENV_NAME>` : To download and run the latest moonwall binary from npm.js repository, and run a network specified in your config file.
- `pnpm moonwall run <ENV_NAME>` : Run a network specified in your config file.

- `pnpm exec moonwall test <ENV_NAME>` : To run the locally compiled version of the binary, to start network and run tests against it.
- `pnpm moonwall test <ENV_NAME>` : Start network and run tests against it.

- `pnpm moonwall download <ARTIFACT NAME> <VERSION> <PATH>` : To run the locally compiled version of the binary, to download an artifact directly from github.
- `pnpm moonwall download <ARTIFACT NAME> <VERSION> <PATH>` : Download an artifact directly from github.


The combinations are endless, for more information you can see the pnpm docs [here](https://pnpm.io/cli/run).
Binary file removed moonwall.png
Binary file not shown.
3 changes: 3 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"@moonbeam-network/api-augment": "0.2700.0",
"@moonwall/types": "workspace:*",
"@moonwall/util": "workspace:*",
"@octokit/rest": "^20.0.2",
"@polkadot/api": "10.11.2",
"@polkadot/api-derive": "10.11.2",
"@polkadot/keyring": "12.6.2",
Expand Down Expand Up @@ -110,7 +111,9 @@
"@types/clear": "^0.1.4",
"@types/cli-progress": "3.11.5",
"@types/debug": "4.1.12",
"@types/inquirer": "^9.0.7",
"@types/node": "20.11.13",
"@types/semver": "^7.5.7",
"@types/ws": "^8.5.10",
"@types/yargs": "17.0.32",
"tsup": "8.0.1",
Expand Down
30 changes: 10 additions & 20 deletions packages/cli/src/cmds/entrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,42 @@ import "@moonbeam-network/api-augment";
import dotenv from "dotenv";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { fetchArtifact, deriveTestIds, generateConfig } from "../internal";
import { fetchArtifact, deriveTestIds, generateConfig, fetchArtifactArgs } from "../internal";
import { main } from "./main";
import { runNetworkCmd } from "./runNetwork";
import { testCmd } from "./runTests";
import { configSetup } from "../lib/configReader";
dotenv.config();

// Hack to expose config-path to all commands and fallback
const parsed = yargs(hideBin(process.argv))
.options({
configFile: {
type: "string",
alias: "c",
description: "path to MoonwallConfig file",
default: "./moonwall.config.json",
},
})
.parseSync();
process.env.MOON_CONFIG_PATH = parsed.configFile;
configSetup(process.argv);

yargs(hideBin(process.argv))
.wrap(null)
.usage("Usage: $0")
.version("2.0.0")
.options({
configFile: {
type: "string",
alias: "c",
description: "path to MoonwallConfig file",
default: "./moonwall.config.json",
default: "moonwall.config.json",
},
})
.middleware((argv) => {
process.env.MOON_CONFIG_PATH = argv.configFile;
})
.command("init", "Run tests for a given Environment", async () => {
await generateConfig();
})
.command(
.command<fetchArtifactArgs>(
"download <bin> [ver] [path]",
"Download x86 artifact from GitHub",
(yargs) => {
return yargs
.positional("bin", {
describe: "Name of artifact to download\n[ moonbeam | polkadot | *-runtime ]",
type: "string",
})
.positional("ver", {
describe: "Artifact version to download",
type: "string",
default: "latest",
})
.positional("path", {
Expand All @@ -59,7 +49,7 @@ yargs(hideBin(process.argv))
describe: "If file exists, should it be overwritten?",
type: "boolean",
alias: "d",
default: true,
default: false,
})
.option("output-name", {
describe: "Rename downloaded file to this name",
Expand All @@ -68,7 +58,7 @@ yargs(hideBin(process.argv))
});
},
async (argv) => {
await fetchArtifact(argv as any);
await fetchArtifact(argv);
}
)
.command(
Expand Down
Loading

0 comments on commit b15e00a

Please sign in to comment.