-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Move book examples into standalone projects. Include them in book via mdbook preprocessor. #766
Move book examples into standalone projects. Include them in book via mdbook preprocessor. #766
Conversation
@@ -39,7 +31,7 @@ Here are the contents of the only Sway file in the project, and the main entry p | |||
script; | |||
|
|||
fn main() { | |||
|
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.
Woops, my editor's setup to remove trailing whitespace automatically when writing the buffer
|
||
// Generate Rust bindings from our contract JSON ABI | ||
// FIXME: Incorrect path, see https://github.com/FuelLabs/fuels-rs/issues/94 | ||
abigen!(MyContract, "./examples/hello_world/my-contract-abi.json"); |
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.
We might need to resolve FuelLabs/fuels-rs#94 before landing this, as this path might be confusing for newcomers reading through the book.
Related to FuelLabs#544. Follows the example set in FuelLabs#731. Tested with `mdbook serve`. Also adds the `hello_world` and `subcurrency` examples to the Sway workspace so that we can test both projects under CI.
82a5a56
to
db4d278
Compare
If you're going to update the workspace or Manifest file deps, then you can update the lockfile in the same PR. That being said, I'm actually against putting the examples in the workspace because that would modify the lockfile. We had to remove examples from |
Aghhhhh I see, that makes sense. Things get tricky when you build the thing you use to build things in the same repo 😂
Sounds good - I'm in the middle of writing a little rust "script" that runs |
This script walks the examples directory and, for every directory containing a `forc.toml` file, runs `forc build` for that directory. Examples that encounter a failure of some kind have their `stdout` and `stderr` piped through so we can easily identify cause of failure in CI. This also removes the examples from the workspace. Currently unsure whether or not the added CI pass to install `forc` will result in `forc` actually being available on the PATH in the CI worker, but will find out soon. Still need to work out how to run `forc test` for each project without having cargo complain about building within the parent sway workspace.
e74a1e3
to
3fd37fa
Compare
Currently, it's tricky to get an idea of how many successes/failures there were without combing through the stdout/stderr. This adds a little summary to the end that looks something like this: ``` Build all examples summary: [✓]: /home/mindtree/programming/rust/fuel/sway/examples/fizzbuzz succeeded! [✓]: /home/mindtree/programming/rust/fuel/sway/examples/hello_world succeeded! [x]: /home/mindtree/programming/rust/fuel/sway/examples/wallet_smart_contract failed! [✓]: /home/mindtree/programming/rust/fuel/sway/examples/subcurrency succeeded! 3 successes, 1 failure ```
75f7d3f
to
ee5984a
Compare
OK, I think this is just about ready to go! Testing I think it's best to leave the example testing (i.e. running
Currently the |
I'd say just comment out the offending lines and add a comment to the effect of "storage not yet implement, see this here PR, and here's how it would look if it were implemented." That way all examples at least compile. |
This example should be updated after FuelLabs#646 lands.
Currently it takes CI another 7 mins to build and install forc from scratch. This should allow `cargo` to re-use the artifacts it has already built during the sway building and testing steps earlier in the CI job.
Okydoke, I had to comment out a large portion of the wallet example, but I've left a |
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.
Generally LGTM, left some nits
@sezna good catch, should be addressed now! |
Closes #544, follows the example set in #731.
This also adds all examples to the Sway workspace so that we can test both projects under CI. Doing so means the
Cargo.lock
for the workspace requires an update, but I haven't included it yet to reduce noise in the PR. @adlerjohn shall I add theCargo.lock
changes as a final commit in this PR? Or do you generally update the lock file separately?TODO
hello_world
fizzbuzz
wallet_smart_contract
forc build
is ran for each example in CI.