Skip to content

Commit

Permalink
CI Checks (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
ansermino authored Oct 2, 2024
1 parent 784f6b2 commit ba43bbd
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 20 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint

on:
pull_request:

jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Print toolchain version
run: rustup show active-toolchain

- name: Run fmt
run: make lint

clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Print toolchain version
run: rustup show active-toolchain

- name: Run clippy
run: make clippy
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Test

on:
pull_request:

env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: sccache
CC: sccache clang
CXX: sccache clang++

jobs:
test:
name: build-and-test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Print toolchain version
run: rustup show active-toolchain

- name: Setup sccache
uses: mozilla-actions/[email protected]
timeout-minutes: 5
continue-on-error: true

- name: Build
run: make check

- name: Test
run: make test
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,16 @@ release:
cargo build --release

install:
cargo install
cargo install

lint:
cargo fmt --all --check

clippy:
cargo clippy --all-targets --quiet --no-deps

test:
cargo test

check:
cargo check
2 changes: 1 addition & 1 deletion misc/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[`method-list.json`](./method-list.json) is a JSON list of all the methods to be
included in the Common Node API.

It is used by `tool openrpc select` to generate the final schema from source
It is used by `cna-tool openrpc select` to generate the final schema from source
schemas in [`/schemas`](../schemas/).
8 changes: 4 additions & 4 deletions src/test-suite/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# `test-suite`
# `cna-test-suite`

```
Filecoin RPC test suite
Usage: test-suite <COMMAND>
Usage: cna-test-suite <COMMAND>
Commands:
list Print each test as a line of JSON to stdout
run Run the tests, loading the given config file
```
## `test-suite` `list`
## `cna-test-suite` `list`

```
Print each test as a line of JSON to stdout
Usage: list
```
## `test-suite` `run`
## `cna-test-suite` `run`

```
Run the tests, loading the given config file
Expand Down
5 changes: 3 additions & 2 deletions src/test-suite/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ mod harness {

#[test]
fn doc() {
expect_test::expect_file!["../README.md"]
.assert_eq(&util::markdown(&<Args as clap::CommandFactory>::command()));
expect_test::expect_file!["../README.md"].assert_eq(&cna_util::markdown(
&<Args as clap::CommandFactory>::command(),
));
}
18 changes: 9 additions & 9 deletions src/tool/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# `tool`
# `cna-tool`

```
Utilities for creating, interacting with, and testing against the Filecoin Common Node API
Usage: tool <COMMAND>
Usage: cna-tool <COMMAND>
Commands:
openrpc Subcommands related to processing OpenRPC documents
csv2json Interpret stdin as a `delimiter`-separated series of lines, with a header, and print JSON
json-rpc Subcommands for interacting with JSON-RPC endpoints
```
## `tool` `openrpc`
## `cna-tool` `openrpc`

```
Subcommands related to processing OpenRPC documents
Expand All @@ -23,7 +23,7 @@ Commands:
select Interpret `select` as a json document of methods to include in `openrpc`
```
### `tool` `openrpc` `validate`
### `cna-tool` `openrpc` `validate`

```
Performs validation of the spec, including FIP-specific validation.
Expand All @@ -44,7 +44,7 @@ Arguments:
<SPEC>
```
### `tool` `openrpc` `select`
### `cna-tool` `openrpc` `select`

```
Interpret `select` as a json document of methods to include in `openrpc`.
Expand All @@ -68,7 +68,7 @@ Options:
Specify a new version for the schema
```
## `tool` `csv2json`
## `cna-tool` `csv2json`

```
Interpret stdin as a `delimiter`-separated series of lines, with a header, and print JSON
Expand All @@ -80,7 +80,7 @@ Options:
[default: "\t"]
```
## `tool` `json-rpc`
## `cna-tool` `json-rpc`

```
Subcommands for interacting with JSON-RPC endpoints
Expand All @@ -92,7 +92,7 @@ Commands:
play Receive's stdin's concatenated JSON summaries of JSON-RPC dialogue (as output by the `json-rpc capture` command)
```
### `tool` `json-rpc` `capture`
### `cna-tool` `json-rpc` `capture`

```
Start a HTTP server, forwarding all requests to a single URI.
Expand All @@ -117,7 +117,7 @@ Options:
The remote URI to forward requests to
```
### `tool` `json-rpc` `play`
### `cna-tool` `json-rpc` `play`

```
Receive's stdin's concatenated JSON summaries of JSON-RPC dialogue (as output by the `json-rpc capture` command).
Expand Down
5 changes: 3 additions & 2 deletions src/tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ impl FromStr for Header {

#[test]
fn doc() {
expect_test::expect_file!["../README.md"]
.assert_eq(&util::markdown(&<Args as clap::CommandFactory>::command()));
expect_test::expect_file!["../README.md"].assert_eq(&cna_util::markdown(
&<Args as clap::CommandFactory>::command(),
));
}
2 changes: 1 addition & 1 deletion src/tool/tests/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use assert_cmd::Command;
#[test]
fn openrpc_select_is_up_to_date() -> anyhow::Result<()> {
let repo_root = concat!(env!("CARGO_MANIFEST_DIR"), "/../..");
let stdout = Command::cargo_bin("tool")?
let stdout = Command::cargo_bin("cna-tool")?
.args(["openrpc", "select"])
.args([
"schemas/forest-6ba5c966097-path-v0.json",
Expand Down

0 comments on commit ba43bbd

Please sign in to comment.