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

CLI deployment pipeline #814

Merged
merged 45 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7c428db
(chore): ported wrappers CLI code
namesty Mar 30, 2022
2d8973f
(feat): added deploy manifest
namesty Mar 31, 2022
64da88c
(chore): removed wrappers cli files
namesty Apr 4, 2022
7ebc559
(fix): corrected deploy manifest format
namesty Apr 4, 2022
771dd14
(feat): added DeploymentManager
namesty Apr 4, 2022
d24571a
(chore): added message translations and deploy command
namesty Apr 4, 2022
09dfef8
(chore): removed deployment functionality from build command
namesty Apr 5, 2022
bbf5f42
(chore): changed manifest for 1:N publishing
namesty Apr 6, 2022
9ed601e
(chore): added IPFS deployer and ENS publisher
namesty Apr 6, 2022
30f3fa4
(chore): added CLI env caching for deployment packages
namesty Apr 6, 2022
273f745
(feat): implemented Publisher chain of responsibility
namesty Apr 6, 2022
277ec46
(wip): deploy command, using publisher chain and deployment steps
namesty Apr 6, 2022
8f81a99
(feat): modified steps into agnostic stages. Print methods. Working
namesty Apr 12, 2022
6e177a8
(chore): improved manifest formats and extensions
namesty Apr 14, 2022
37d109a
(feat): added manifest ext validation and logging
namesty Apr 14, 2022
0af8cfb
(chore): added e2e tests
namesty Apr 14, 2022
200bcec
Merge branch 'prealpha-dev' into namesty/670-wrappers-cli-deployment
namesty Apr 14, 2022
fd07e89
(chore): removed unused code. Improved IPFS deployer invalid URI err msg
namesty Apr 14, 2022
ae21ede
minor fixes
dOrgJelli Apr 18, 2022
1e2eb90
fix test
dOrgJelli Apr 18, 2022
09d65b4
test-env wrapper deploy changes init
dOrgJelli Apr 18, 2022
65a8f36
(fix): fixed filesystem URIs for IPFS deployer and load manifest todo
namesty Apr 19, 2022
7502f77
(wip): updated buildAndDeploy test method to use deploy command
namesty Apr 19, 2022
e2c318b
(chore): changed IPFS deployer impl to use http client package
namesty Apr 20, 2022
bd8f4a4
(fix): updated buildAndDeploy API function to use deploy command
namesty Apr 20, 2022
f421688
(chore): updated ethereum plugin tests
namesty Apr 20, 2022
25cbc51
(chore): updated buildAndDeployApi test usages
namesty Apr 20, 2022
27f5d24
(chore): updated buildAndDeployApi usages to web3apiclient tests
namesty Apr 20, 2022
d275d97
(fix): tweaked URI/CID parsing
namesty Apr 20, 2022
b5a4246
Merge branch 'prealpha-dev' into namesty/670-wrappers-cli-deployment
namesty Apr 20, 2022
8b70cd5
(chore): resolving ENS wrapper from rinkeby, instead of filesystem
namesty Apr 20, 2022
547795e
(fix): fixed CLI tests
namesty Apr 20, 2022
d08efd0
(chore): using ens wrapper for cli deploy tests ens registering
namesty Apr 20, 2022
2582d08
(fix): fixed buildAndDeploy signature in client env tests
namesty Apr 20, 2022
3686653
(chore): removed client usage for testEnv's deployment name registration
namesty Apr 22, 2022
fd3769e
Merge branch 'prealpha-dev' into namesty/670-wrappers-cli-deployment
namesty Apr 22, 2022
f73fb01
(fix): minor fixes for CLI tests
namesty Apr 22, 2022
f0ced86
fix http test
dOrgJelli Apr 23, 2022
6342caa
merge prealpha-dev
dOrgJelli Apr 23, 2022
e2cfabc
lint fix
dOrgJelli Apr 26, 2022
c4f339c
fix cli tests
dOrgJelli Apr 26, 2022
7c87bf2
fix dependencies:link script
dOrgJelli Apr 26, 2022
46c4be8
fix cli plugin tests
dOrgJelli Apr 26, 2022
e15e463
fix deploy tests
dOrgJelli Apr 26, 2022
a68db09
fixed client test
dOrgJelli Apr 26, 2022
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"reset": "yarn clean && yarn && yarn build",
"clean": "npx rimraf ./**/node_modules ./**/yarn.lock ./**/build ./**/coverage ./**/.w3",
"dependencies:install": "cd dependencies && yarn",
"dependencies:link": "cd packages/schema/bind && yarn link && cd ../../../dependencies && yarn link @web3api/schema-bind",
"dependencies:link": "cd packages/schema/bind && (yarn unlink || true) && yarn link && cd ../../../dependencies && yarn link @web3api/schema-bind",
"preinstall": "yarn dependencies:install",
"build": "yarn build:core && yarn dependencies:link && yarn build:plugins && yarn build:client && yarn build:cli",
"build:core": "lerna run build --no-private --ignore @web3api/*-plugin-js --ignore @web3api/cli* --ignore @web3api/react",
Expand Down
30 changes: 18 additions & 12 deletions packages/cli/lang/en.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
{
"commands_build_address": "ENS Address",
"commands_build_description": "Builds a Web3API and (optionally) uploads it to IPFS",
"commands_build_ensRegistry": "ENS Registry",
"commands_build_description": "Builds a Web3API",
"commands_build_error_manifestPathMissing": "{option} option missing {argument} argument",
"commands_build_error_manifestNotFound": "Manifest not found. Search paths used: {paths}",
"commands_build_error_outputDirMissingPath": "{option} option missing {argument} argument",
"commands_build_error_resolution": "ENS Resolution Failed",
"commands_build_error_testEnsAddressMissing": "{option} option missing {argument} argument",
"commands_build_error_testEnsNodeMissing": "{option} option requires the {required} option",
"commands_build_ethProvider": "Ethereum Provider",
"commands_build_keypressListener_exit": "Exit: [CTRL + C], [ESC], or [Q]",
"commands_build_keypressListener_watching": "Watching",
"commands_build_options_e": "Publish the package to a test ENS domain locally (requires --ipfs)",
"commands_build_options_e_address": "address",
"commands_build_options_e_domain": "domain",
"commands_build_options_h": "Show usage information",
"commands_build_options_m": "Path to the Web3API Build manifest file (default: {default})",
"commands_build_options_i": "Upload build results to an IPFS node (default: dev-server's node)",
"commands_build_options_i_node": "node",
"commands_build_options_o": "Output directory for build results (default: build/)",
"commands_build_options_o_path": "path",
"commands_build_options_options": "options",
"commands_build_options_t": "Use the development server's ENS instance",
"commands_build_options_w": "Automatically rebuild when changes are made (default: false)",
"commands_build_options_v": "Verbose output (default: false)",
"commands_build_uriViewers": "URI Viewers",
"commands_deploy_description": "Deploys/Publishes a Web3API",
"commands_deploy_options_options": "options",
"commands_deploy_options_o_path": "path",
"commands_deploy_options_o_string": "string",
"commands_deploy_options_h": "Show usage information",
"commands_deploy_options_m": "Path to the Web3API Deploy manifest file (default: {default})",
"commands_deploy_options_n": "Name of the deployment to execute",
"commands_deploy_options_c": "Argument for deployment's publish step, in case deploy step is absent",
"commands_deploy_options_v": "Verbose output (default: false)",
"commands_deploy_options_p": "Path to the build directory",
"commands_deploy_error_manifestPathMissing": "{option} option missing {argument} argument",
"commands_deploy_error_pathMissing": "{option} option missing {argument} argument",
"commands_deploy_error_nameMissing": "{option} option missing {argument} argument",
"commands_deploy_error_cidMissing": "{option} option missing {argument} argument",
"commands_codegen_description": "Auto-generate API Types",
"commands_codegen_error_domain": "domain",
"commands_codegen_error_optionMissingArgument": "{option} option missing {argument} argument",
Expand Down Expand Up @@ -189,6 +192,9 @@
"lib_helpers_manifest_loadError": "Failed to load manifest from {path}",
"lib_helpers_manifest_loadText": "Manifest loaded from {path}",
"lib_helpers_manifest_loadWarning": "Warnings loading manifest from {path}",
"lib_helpers_deployManifestExt_loadError": "Failed to load deploy manifest extension from {path}",
"lib_helpers_deployManifestExt_loadText": "Load manifest extension from {path}",
"lib_helpers_deployManifestExt_loadWarning": "No manifest extension found in {path}",
"lib_helpers_manifest_outputError": "Failed to output manifest to {path}",
"lib_helpers_manifest_outputText": "Manifest written to {path}",
"lib_helpers_manifest_outputWarning": "Warnings writing manifest to {path}",
Expand Down
31 changes: 19 additions & 12 deletions packages/cli/lang/es.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
{
"commands_build_address": "ENS Address",
"commands_build_description": "Builds a Web3API and (optionally) uploads it to IPFS",
"commands_build_ensRegistry": "ENS Registry",
"commands_build_description": "Builds a Web3API",
"commands_build_error_manifestPathMissing": "{option} option missing {argument} argument",
"commands_build_error_manifestNotFound": "Manifest not found. Search paths used: {paths}",
"commands_build_error_outputDirMissingPath": "{option} option missing {argument} argument",
"commands_build_error_resolution": "ENS Resolution Failed",
"commands_build_error_testEnsAddressMissing": "{option} option missing {argument} argument",
"commands_build_error_testEnsNodeMissing": "{option} option requires the {required} option",
"commands_build_ethProvider": "Ethereum Provider",
"commands_build_keypressListener_exit": "Exit: [CTRL + C], [ESC], or [Q]",
"commands_build_keypressListener_watching": "Watching",
"commands_build_options_e": "Publish the package to a test ENS domain locally (requires --ipfs)",
"commands_build_options_e_address": "address",
"commands_build_options_e_domain": "domain",
"commands_build_options_h": "Show usage information",
"commands_build_options_m": "Path to the Web3API Build manifest file (default: {default})",
"commands_build_options_i": "Upload build results to an IPFS node (default: dev-server's node)",
"commands_build_options_i_node": "node",

"commands_build_options_o": "Output directory for build results (default: build/)",
"commands_build_options_o_path": "path",
"commands_build_options_options": "options",
"commands_build_options_t": "Use the development server's ENS instance",
"commands_build_options_w": "Automatically rebuild when changes are made (default: false)",
"commands_build_options_v": "Verbose output (default: false)",
"commands_build_uriViewers": "URI Viewers",
"commands_deploy_description": "Deploys/Publishes a Web3API",
"commands_deploy_options_options": "options",
"commands_deploy_options_o_path": "path",
"commands_deploy_options_o_string": "string",
"commands_deploy_options_h": "Show usage information",
"commands_deploy_options_m": "Path to the Web3API Deploy manifest file (default: {default})",
"commands_deploy_options_n": "Name of the deployment to execute",
"commands_deploy_options_c": "Argument for deployment's publish step, in case deploy step is absent",
"commands_deploy_options_v": "Verbose output (default: false)",
"commands_deploy_options_p": "Path to the build directory",
"commands_deploy_error_manifestPathMissing": "{option} option missing {argument} argument",
"commands_deploy_error_pathMissing": "{option} option missing {argument} argument",
"commands_deploy_error_nameMissing": "{option} option missing {argument} argument",
"commands_deploy_error_cidMissing": "{option} option missing {argument} argument",
"commands_codegen_description": "Auto-generate API Types",
"commands_codegen_error_domain": "domain",
"commands_codegen_error_optionMissingArgument": "{option} option missing {argument} argument",
Expand Down Expand Up @@ -189,6 +193,9 @@
"lib_helpers_manifest_loadError": "Failed to load manifest from {path}",
"lib_helpers_manifest_loadText": "Manifest loaded from {path}",
"lib_helpers_manifest_loadWarning": "Warnings loading manifest from {path}",
"lib_helpers_deployManifestExt_loadError": "Failed to load deploy manifest extension from {path}",
"lib_helpers_deployManifestExt_loadText": "Deploy manifest extension loaded from {path}",
"lib_helpers_deployManifestExt_loadWarning": "No deploy manifest extension found in {path}",
"lib_helpers_manifest_outputError": "Failed to output manifest to {path}",
"lib_helpers_manifest_outputText": "Manifest written to {path}",
"lib_helpers_manifest_outputWarning": "Warnings writing manifest to {path}",
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"w3": "bin/w3"
},
"scripts": {
"build": "rimraf ./build && tsc --project tsconfig.build.json && yarn build:envs",
"build": "rimraf ./build && tsc --project tsconfig.build.json && yarn build:envs && yarn build:deployers",
"build:envs": "copyfiles ./src/lib/build-envs/**/**/* ./build/lib/build-envs/ -u 3",
"build:deployers": "copyfiles ./src/lib/deployers/**/web3api.deploy.ext.json ./build/lib/deployers -u 3",
"prebuild": "ts-node ./scripts/generateIntlTypes.ts",
"lint": "eslint --color -c ../../.eslintrc.js .",
"test": "cross-env TEST=true jest --passWithNoTests --runInBand --verbose",
Expand All @@ -40,6 +41,9 @@
"@web3api/schema-bind": "0.0.1-prealpha.74",
"@web3api/schema-compose": "0.0.1-prealpha.74",
"@web3api/schema-parse": "0.0.1-prealpha.74",
"ethers": "5.6.2",
"@ensdomains/ensjs": "2.0.1",
"content-hash": "2.5.2",
"assemblyscript": "0.19.1",
"axios": "0.21.2",
"chalk": "4.1.0",
Expand Down
36 changes: 1 addition & 35 deletions packages/cli/src/__tests__/e2e/build.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ w3 build [options]
Options:
-h, --help Show usage information
-m, --manifest-file <path> Path to the Web3API Build manifest file (default: web3api.yaml | web3api.yml)
-i, --ipfs [<node>] Upload build results to an IPFS node (default: dev-server's node)
-o, --output-dir <path> Output directory for build results (default: build/)
-e, --test-ens <[address,]domain> Publish the package to a test ENS domain locally (requires --ipfs)
-w, --watch Automatically rebuild when changes are made (default: false)
-v, --verbose Verbose output (default: false)

`;

describe("e2e tests for build command", () => {
const testCaseRoot = path.join(GetPathToCliTestFiles(), "api/build");
const testCaseRoot = path.join(GetPathToCliTestFiles(), "api/build-cmd");
const testCases =
fs.readdirSync(testCaseRoot, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
Expand Down Expand Up @@ -59,38 +57,6 @@ describe("e2e tests for build command", () => {
${HELP}`);
});

test("Should throw error for invalid params - testEns", async () => {
const { exitCode: code, stdout: output, stderr: error } = await runCLI(
{
args: ["build", "--test-ens"],
cwd: getTestCaseDir(0),
cli: w3Cli,
},
);

expect(code).toEqual(1);
expect(error).toBe("");
expect(clearStyle(output))
.toEqual(`--test-ens option missing <[address,]domain> argument
${HELP}`);
});

test("Should throw error for invalid params - ipfs", async () => {
const { exitCode: code, stdout: output, stderr: error } = await runCLI(
{
args: ["build", "--test-ens", "test.eth"],
cwd: getTestCaseDir(0),
cli: w3Cli,
},
);

expect(code).toEqual(1);
expect(error).toBe("");
expect(clearStyle(output))
.toEqual(`--test-ens option requires the --ipfs [<node>] option
${HELP}`);
});

test("Adds uuid-v4 suffix to build-env image if no build manifest specified", async () => {
const projectRoot = getTestCaseDir(0);
const project = new Web3ApiProject({
Expand Down
Loading