Skip to content

Commit e92738b

Browse files
authored
Docs build improvements (#683)
* Rationalize dependencies * update package lock * Add watch script * Update readme * Fix broken links and update quickstart * Fix watch parameter * Include README in watched files * Make build script build everything * Fix ci * spellcheck
1 parent 8234ae2 commit e92738b

File tree

8 files changed

+201
-1886
lines changed

8 files changed

+201
-1886
lines changed

.github/workflows/deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
with:
2525
node-version: '22'
2626
- run: npm ci
27-
- run: npm run build
27+
- run: npm run build:spec
2828
- run: npm run build:docs
2929
- name: Deploy to GitHub Pages
3030
uses: peaceiris/actions-gh-pages@v4

.github/workflows/test-deploy.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
pull_request:
55
branches:
66
- main
7-
# Review gh actions docs if you want to further define triggers, paths, etc
8-
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
97
workflow_dispatch:
108

119
jobs:
@@ -28,5 +26,5 @@ jobs:
2826
run: npm install --frozen-lockfile
2927
- name: Test build website
3028
run: |
31-
npm run build
29+
npm run build:spec
3230
npm run build:docs

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
with:
1313
node-version: 22
1414
- run: npm ci
15-
- run: npm run build
15+
- run: npm run build:spec
1616
- run: npm run lint
1717
- name: Set up Go 1.x
1818
uses: actions/setup-go@v5

README.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ in [test-gen][test-gen]
1919
The specification itself is written in [OpenRPC][openrpc]. Refer to the OpenRPC
2020
specification and the JSON schema [specification][json-schema] to get started.
2121

22-
### Building
22+
### Updating the specs
2323

24+
#### Compiling
2425
The specification is split into multiple files to improve readability. The
2526
spec can be compiled into a single document as follows:
2627

@@ -33,11 +34,26 @@ Build successful.
3334
This will output the file `openrpc.json` in the root of the project. This file
3435
will have all schema `#ref`s resolved.
3536

36-
#### Testing
37+
#### Building the docs
38+
39+
Once you've updated something in the spec, you can use the docs generation tools
40+
to view the updated specs locally.
41+
42+
```console
43+
$ npm run build:docs
44+
$ npm run watch
45+
```
46+
47+
The `watch` command starts a local webserver serving the docs in-browser at
48+
`http://0.0.0.0:8000` and it rebuilds when you update something in the specs.
49+
Please reload the page to see your changes.
50+
51+
### Testing
3752

3853
There are several mechanisms for testing specification contributions and client
3954
conformance.
4055

56+
#### Linting
4157
First is the [OpenRPC validator][validator]. It performs some basic syntactic
4258
checks on the generated specification.
4359

@@ -47,13 +63,21 @@ $ npm run lint
4763
OpenRPC spec validated successfully.
4864
```
4965

66+
#### Spec tests
5067
Next is `speccheck`. This tool validates the test cases in the `tests`
51-
directory against the specification.
68+
directory against the specification. There are two npm scripts to simplify this.
69+
70+
```console
71+
$ npm run build:test
72+
$ npm run test
73+
all passing.
74+
```
75+
76+
or
5277

5378
```console
5479
$ go install github.com/lightclient/rpctestgen/cmd/speccheck@latest
5580
$ speccheck -v
56-
all passing.
5781
```
5882

5983
If you get an error that says: `speccheck: command not found`,
@@ -63,6 +87,8 @@ If you get an error that says: `speccheck: command not found`,
6387
$ export PATH=$HOME/go/bin:$PATH
6488
```
6589

90+
#### Spelling
91+
6692
The spell checker ensures the specification is free of spelling errors.
6793

6894
```console
@@ -75,8 +101,9 @@ pyspelling is a wrapper around either [Aspell](http://aspell.net/) or
75101
[Hunspell](https://hunspell.github.io/). You'll need to install
76102
one of those before running `pyspelling`.
77103

104+
#### Hive tests
78105
Finally, the test cases in the `tests/` directory may be run against individual
79-
execution client using the [`hive`] simulator [`rpc-compat`][rpc-compat].
106+
execution client using the [`hive`][hive] simulator [`rpc-compat`][rpc-compat].
80107
Please see the documentation in the aforementioned repositories for more
81108
information.
82109

docs/reference/quickstart.md

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ in [test-gen][test-gen]
1919
The specification itself is written in [OpenRPC][openrpc]. Refer to the OpenRPC
2020
specification and the JSON schema [specification][json-schema] to get started.
2121

22-
### Building
22+
### Updating the specs
2323

24+
#### Compiling
2425
The specification is split into multiple files to improve readability. The
2526
spec can be compiled into a single document as follows:
2627

@@ -33,11 +34,26 @@ Build successful.
3334
This will output the file `openrpc.json` in the root of the project. This file
3435
will have all schema `#ref`s resolved.
3536

36-
#### Testing
37+
#### Building the docs
38+
39+
Once you've updated something in the spec, you can use the docs generation tools
40+
to view the updated specs locally.
41+
42+
```console
43+
$ npm run build:docs
44+
$ npm run watch
45+
```
46+
47+
The `watch` command starts a local webserver serving the docs in-browser at
48+
`http://0.0.0.0:8000` and it rebuilds when you update something in the specs.
49+
Please reload the page to see your changes.
50+
51+
### Testing
3752

3853
There are several mechanisms for testing specification contributions and client
3954
conformance.
4055

56+
#### Linting
4157
First is the [OpenRPC validator][validator]. It performs some basic syntactic
4258
checks on the generated specification.
4359

@@ -47,13 +63,21 @@ $ npm run lint
4763
OpenRPC spec validated successfully.
4864
```
4965

66+
#### Spec tests
5067
Next is `speccheck`. This tool validates the test cases in the `tests`
51-
directory against the specification.
68+
directory against the specification. There are two npm scripts to simplify this.
69+
70+
```console
71+
$ npm run build:test
72+
$ npm run test
73+
all passing.
74+
```
75+
76+
or
5277

5378
```console
5479
$ go install github.com/lightclient/rpctestgen/cmd/speccheck@latest
5580
$ speccheck -v
56-
all passing.
5781
```
5882

5983
If you get an error that says: `speccheck: command not found`,
@@ -63,6 +87,8 @@ If you get an error that says: `speccheck: command not found`,
6387
$ export PATH=$HOME/go/bin:$PATH
6488
```
6589

90+
#### Spelling
91+
6692
The spell checker ensures the specification is free of spelling errors.
6793

6894
```console
@@ -75,8 +101,9 @@ pyspelling is a wrapper around either [Aspell](http://aspell.net/) or
75101
[Hunspell](https://hunspell.github.io/). You'll need to install
76102
one of those before running `pyspelling`.
77103

104+
#### Hive tests
78105
Finally, the test cases in the `tests/` directory may be run against individual
79-
execution client using the [`hive`] simulator [`rpc-compat`][rpc-compat].
106+
execution client using the [`hive`][hive] simulator [`rpc-compat`][rpc-compat].
80107
Please see the documentation in the aforementioned repositories for more
81108
information.
82109

@@ -104,16 +131,17 @@ $ npm run graphql:validate
104131

105132
## License
106133

107-
This repository is licensed under [CC0](LICENSE).
134+
This repository is licensed under [CC0][license].
108135

109136

110137
[playground]: https://ethereum.github.io/execution-apis/api-documentation/
111138
[openrpc]: https://open-rpc.org
112139
[validator]: https://open-rpc.github.io/schema-utils-js/functions/validateOpenRPCDocument.html
113140
[graphql-schema]: http://graphql-schema.ethdevops.io/?url=https://raw.githubusercontent.com/ethereum/execution-apis/main/graphql.json
114141
[eip-1767]: https://eips.ethereum.org/EIPS/eip-1767
115-
[contributors-guide]: docs/reference/contributors-guide.md
142+
[contributors-guide]: ../contributors-guide
116143
[json-schema]: https://json-schema.org
117144
[hive]: https://github.com/ethereum/hive
118145
[rpc-compat]: https://github.com/ethereum/hive/tree/master/simulators/ethereum/rpc-compat
119-
[test-gen]: docs/reference/tests.md
146+
[test-gen]: ../tests
147+
[license]: https://github.com/ethereum/execution-apis/blob/main/LICENSE

docs/reference/tests.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The Execution API has a comprehensive test suite to verify conformance of
44
clients. The tests in this repository are loaded into the [`hive`][hive] test
55
simulator [`rpc-compat`][rpc-compat] and validated against every major client.
66

7-
The test suite is run daily and results are always available [here][hivetests2]
7+
The test suite is run daily and results are always available [here][hivetests]
88
under the tag `rpc-compat`.
99

1010
To learn more about the `rpc-compat` simulator, please see its
@@ -68,6 +68,6 @@ A good final verification of tests is to run them in the hive simulator
6868
simulator can be found with there.
6969

7070
[hive]: https://github.com/ethereum/hive
71-
[hivetests2]: https://hivetests2.ethdevops.io
71+
[hivetests]: https://hive.ethpandaops.io
7272
[rpc-compat]: https://github.com/ethereum/hive/tree/master/simulators/ethereum/rpc-compat
7373
[rpctestgen]: https://github.com/lightclient/rpctestgen

0 commit comments

Comments
 (0)