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

Move docs code examples to real projects #544

Closed
adlerjohn opened this issue Dec 31, 2021 · 0 comments · Fixed by #766
Closed

Move docs code examples to real projects #544

adlerjohn opened this issue Dec 31, 2021 · 0 comments · Fixed by #766
Assignees
Labels
ci good first issue Good for newcomers The Sway Book Everything to do with the Sway Book

Comments

@adlerjohn
Copy link
Contributor

Whole-code examples in the docs should be moved to a directory with full projects (and potentially tests), and added to CI to at least build. Then the code can be included using {{ #include }}.

@adlerjohn adlerjohn added The Sway Book Everything to do with the Sway Book and removed documentation labels Jan 24, 2022
@mitchmindtree mitchmindtree self-assigned this Feb 10, 2022
mitchmindtree added a commit to mitchmindtree/sway that referenced this issue Feb 10, 2022
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.
mitchmindtree added a commit to mitchmindtree/sway that referenced this issue Feb 10, 2022
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.
mitchmindtree added a commit that referenced this issue Feb 15, 2022
… mdbook preprocessor. (#766)

* Extract `hello_world` example from the book into a standalone project

Related to #544.
Follows the example set in #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.

* Fix hello_world example project name in forc manifest

* Move fizzbuzz and wallet_smart_contract examples to standalone projects

* Add `build-all-examples` script and associated CI passes

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.

* Add a clear build summary at the end of `build-all-examples`

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
```

* Set build-all-examples script version to 0.0.0

* Exclude examples from workspace, Fix hello_world test harness path

* Temporarily comment out storage related code in wallet example

This example should be updated after #646 lands.

* Install forc with `--debug` to share build artifacts

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.

* Change author field in examples from mindtree -> Fuel Labs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci good first issue Good for newcomers The Sway Book Everything to do with the Sway Book
Projects
Archived in project
2 participants