-
Notifications
You must be signed in to change notification settings - Fork 98
feat: dfx deploy command #1007
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
feat: dfx deploy command #1007
Changes from 4 commits
57db120
122cb47
5b691e1
61a0ca0
97a80cb
c361f29
4e90254
b7c9401
e160408
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| actor { | ||
| public func greet(name : Text) : async Text { | ||
| return "Bună, " # name # "!"; | ||
| }; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| actor { | ||
| public func greet(name : Text) : async Text { | ||
| return "Ciao, " # name # "!"; | ||
| }; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| actor { | ||
| public func greet(name : Text) : async Text { | ||
| return "Olá, " # name # "!"; | ||
| }; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/usr/bin/env bats | ||
|
|
||
| load utils/_ | ||
|
|
||
| setup() { | ||
| # We want to work from a temporary directory, different for every test. | ||
| cd $(mktemp -d -t dfx-e2e-XXXXXXXX) | ||
| export RUST_BACKTRACE=1 | ||
|
|
||
| dfx_new hello | ||
| dfx_start | ||
| } | ||
|
|
||
| teardown() { | ||
| dfx_stop | ||
| } | ||
|
|
||
| @test "deploy from a fresh project" { | ||
| install_asset greet | ||
| assert_command dfx deploy | ||
|
|
||
| assert_command dfx canister call hello greet '("Banzai")' | ||
| assert_eq '("Hello, Banzai!")' | ||
| } | ||
|
|
||
| @test "deploy a canister without dependencies" { | ||
| install_asset greet | ||
| assert_command dfx deploy hello | ||
| assert_match 'Deploying: hello' | ||
| assert_not_match 'hello_assets' | ||
| } | ||
|
|
||
| @test "deploy a canister with dependencies" { | ||
| install_asset greet | ||
| assert_command dfx deploy hello_assets | ||
| assert_match 'Deploying: hello hello_assets' | ||
| } | ||
|
|
||
| @test "deploy a canister with non-circular shared dependencies" { | ||
| install_asset transitive_deps_canisters | ||
| assert_command dfx deploy canister_f | ||
| assert_match 'Deploying: canister_a canister_f canister_g canister_h' | ||
| } | ||
|
|
||
| @test "report an error on attempt to deploy a canister with circular dependencies" { | ||
| install_asset transitive_deps_canisters | ||
| assert_command_fail dfx deploy canister_d | ||
| assert_match 'canister_d -> canister_e -> canister_d' | ||
| } | ||
|
|
||
| @test "if already registered, try to upgrade then install" { | ||
| install_asset greet | ||
| assert_command dfx canister create --all | ||
|
|
||
| assert_command dfx deploy | ||
| assert_match 'attempting install' | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| use crate::lib::environment::Environment; | ||
| use crate::lib::error::DfxResult; | ||
| use crate::lib::message::UserMessage; | ||
| use crate::lib::operations::canister::deploy_canisters; | ||
| use crate::lib::provider::create_agent_environment; | ||
| use clap::{App, Arg, ArgMatches, SubCommand}; | ||
|
|
||
| pub fn construct() -> App<'static, 'static> { | ||
| SubCommand::with_name("deploy") | ||
| .about(UserMessage::DeployCanister.to_str()) | ||
| .arg( | ||
| Arg::with_name("canister_name") | ||
| .takes_value(true) | ||
| .help(UserMessage::DeployCanisterName.to_str()) | ||
| .required(false), | ||
| ) | ||
| .arg( | ||
| Arg::with_name("network") | ||
| .help(UserMessage::CanisterComputeNetwork.to_str()) | ||
| .long("network") | ||
| .takes_value(true), | ||
| ) | ||
| } | ||
|
|
||
| pub fn exec(env: &dyn Environment, args: &ArgMatches<'_>) -> DfxResult { | ||
| let env = create_agent_environment(env, args)?; | ||
|
|
||
| let canister = args.value_of("canister_name"); | ||
|
|
||
| deploy_canisters(&env, canister) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,6 +100,10 @@ user_message!( | |
| OptionValue => "Specifies the new value to set. If you don't specify a value, the command displays the current value of the option from the configuration file.", | ||
| OptionFormat => "Specifies the format of the output. By default, it uses JSON.", | ||
|
lsgunnlsgunn marked this conversation as resolved.
Outdated
|
||
|
|
||
| // dfx deploy | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lsgunnlsgunn could you review these messages please? |
||
| DeployCanister => "Deployes all or specific canisters from the code in your project. By default, all canisters are deployed.", | ||
|
This conversation was marked as resolved.
Outdated
|
||
| DeployCanisterName => "Specifies the canister name. If none specified, deploys all canisters.", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specifies the name of the canister you want to deploy. If you don’t specify a canister name, all canisters defined in the dfx.json file are deployed. |
||
|
|
||
| // dfx identity mod | ||
| ManageIdentity => "Manages identities used to communicate with the Internet Computer network. Setting an identity enables you to test user-based access controls.", | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3