-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add OpenRPC API docs and associated JSON Schemas (#534)
# Description This pull request includes the following features: - [x] Add OpenRPC API document and JSON schema generator - [x] Generate schemas in CI - [x] Add OpenRPC API document - [x] Add document - [x] Add `rpc.discover` endpoint for service discovery - [x] Add JSON Schemas - [x] Workflow schema - [x] Receipt schema - [x] Receipt notification schema - [x] Health check schema - [x] Node info schema - [x] Metrics schema - [x] Network notifications - [x] Refactor network notifications with structs to better support JSON Schemas - [x] Add rendezvous and mDNS network notifications - [x] Update discovery tests to use notifications instead of timeouts - [x] Convert event cache to async implementation - [x] Update pre-commit hook to allow no newline at the end of JSON files - [x] Add `subscribe_network_events` test utility - [x] Update `dependabot_pr` GitHub action check for modified files ## Link to issue Closes #449 ## Type of change - [x] New feature (non-breaking change that adds functionality) - [x] Refactor (non-breaking change that updates existing functionality) - [x] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [x] This change requires a documentation update (document the OpenRPC API, API discovery endpoint, and schemas in README) - [x] Comments have been added/updated The network notifications and node info response contain breaking changes for Control Panel. ## Test plan (required) The following test suites were added or updated: - [x] Refactored [network notification tests](https://github.com/ipvm-wg/homestar/blob/b5ffd8181b09c585525be57c9e2bace86768bf76/homestar-runtime/src/event_handler/notification/network.rs#L2173-L2671) - [x] OpenRPC discover endpoint test - [x] Separated out node info test - [x] Refactored Rendezvous, mDNS, and connection tests to rely on new notifications - [x] Consolidated rendezvous connect and disconnect tests - [x] Consolidated mDNS connect and disconnect tests - [x] Consolidated connection and disconnection tests --------- Co-authored-by: Zeeshan Lakhani <[email protected]> Co-authored-by: bgins <[email protected]>
- Loading branch information
1 parent
803f983
commit a82d01d
Showing
67 changed files
with
9,517 additions
and
1,778 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: 🛡 Audit-Check | |
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
security-audit: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: 📄 Schemas | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
# branches: [main, "**"] | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
changes: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
rust: ${{ steps.filter.outputs.rust }} | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
- uses: dorny/paths-filter@v3 | ||
id: filter | ||
with: | ||
filters: | | ||
rust: | ||
- 'homestar-invocation/src/**' | ||
- 'homestar-runtime/src/**' | ||
- 'homestar-schemas/src/**' | ||
- 'homestar-workflow/src/**' | ||
schemas: | ||
needs: changes | ||
if: ${{ needs.changes.outputs.rust == 'true' }} | ||
env: | ||
SCCACHE_GHA_ENABLED: "true" | ||
RUSTC_WRAPPER: "sccache" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.HOMESTAR_UPDATE_TOKEN }} | ||
|
||
- name: Install Rust Toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Cache Project | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
shared-key: test-all-stable-ubuntu-latest | ||
save-if: ${{ github.event_name == 'push' }} | ||
|
||
- name: Sccache | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Run generate schemas | ||
run: cargo run -p homestar-schemas | ||
|
||
- name: Check for modified schemas | ||
id: git-check | ||
shell: bash | ||
run: echo modified=$(if [[ $(git diff homestar-runtime/schemas/) ]]; then echo "true"; else echo "false"; fi) >> $GITHUB_OUTPUT | ||
|
||
- name: Push changes | ||
if: steps.git-check.outputs.modified == 'true' | ||
run: | | ||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | ||
git commit -am "chore(schemas): update OpenRPC API doc and JSON schemas" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.