Skip to content

Commit 107cd79

Browse files
Update readme from code (#1188)
### What Update readme using make target and add a CI job to check its updated. ### Why Noticed our readme is out of date with the code it is generated from.
1 parent 5667787 commit 107cd79

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/rust.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
complete:
1919
if: always()
20-
needs: [fmt, check-git-rev-deps, build-and-test, docs]
20+
needs: [fmt, check-git-rev-deps, build-and-test, docs, readme]
2121
runs-on: ubuntu-latest
2222
steps:
2323
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
@@ -132,6 +132,15 @@ jobs:
132132
- run: rustup install nightly
133133
- run: make doc
134134

135+
readme:
136+
runs-on: ubuntu-latest
137+
steps:
138+
- uses: actions/checkout@v3
139+
- uses: stellar/actions/rust-cache@main
140+
- run: rustup install nightly
141+
- run: make readme
142+
- run: git add -N . && git diff HEAD --exit-code
143+
135144
publish-dry-run:
136145
if: github.event_name == 'push' || startsWith(github.head_ref, 'release/')
137146
strategy:

soroban-sdk/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ See [soroban.stellar.org](https://soroban.stellar.org) for documentation.
88
### Examples
99

1010
```rust
11-
use soroban_sdk::{contractimpl, vec, BytesN, Env, Symbol, Vec};
11+
use soroban_sdk::{contract, contractimpl, vec, symbol_short, BytesN, Env, Symbol, Vec};
1212

13+
#[contract]
1314
pub struct HelloContract;
1415

1516
#[contractimpl]
@@ -21,6 +22,9 @@ impl HelloContract {
2122

2223
#[test]
2324
fn test() {
25+
# }
26+
# #[cfg(feature = "testutils")]
27+
# fn main() {
2428
let env = Env::default();
2529
let contract_id = env.register_contract(None, HelloContract);
2630
let client = HelloContractClient::new(&env, &contract_id);
@@ -29,6 +33,9 @@ fn test() {
2933

3034
assert_eq!(words, vec![&env, symbol_short!("Hello"), symbol_short!("Dev"),]);
3135
}
36+
# #[cfg(not(feature = "testutils"))]
37+
# fn main() { }
3238
```
3339

34-
More examples are available at <https://soroban.stellar.org/docs/category/how-to-guides>.
40+
More examples are available at <https://soroban.stellar.org/docs/category/basic-tutorials>
41+
and <https://soroban.stellar.org/docs/category/advanced-tutorials>.

0 commit comments

Comments
 (0)