-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add rustfmt and Github CI #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build: | ||
strategy: | ||
matrix: | ||
toolchain: [ stable, beta ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What MSRV will the VSS client support? Can we start enforcing it here in CI from the getgo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't gotten a chance to look into that, when i do, will start enforcing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Mind creating a tracking issue for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created : #4
Well, it would avoid the additional |
dc423af
to
0715f27
Compare
build: | ||
strategy: | ||
matrix: | ||
toolchain: [ stable, beta ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Mind creating a tracking issue for it?
.github/workflows/build.yml
Outdated
- name: Checkout source code | ||
uses: actions/checkout@v2 | ||
- name: Install Protobuf compiler (protoc) | ||
uses: arduino/setup-protoc@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we can't just simply run sudo apt-get update && sudo apt-get -y install protobuf-compiler
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think that one is platform agnostic, but i think we could replace with simpler command above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, mod one comment.
profile: minimal | ||
- name: Build on Rust ${{ matrix.toolchain }} | ||
run: cargo build --verbose --color always | ||
- name: Check formatting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably also want to add another step enforcing buildable docs for the public API, i.e.,
cargo check --release
cargo doc --release
In combination with adding
#![deny(missing_docs)]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
To your lib.rs
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
For now adding only broken_intra_doc_links and private_intra_doc_links
Some of the auto-generated code doesn't comply with all the checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mh, but isn't that simply a function of the docs missing in https://github.com/lightningdevkit/vss-server/blob/main/app/src/main/proto/vss.proto? Should they be added there rather than omitting the check here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"for now",
will add it eventually. I can add at warn level for now.
(already have some changes in pipeline for proto file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright!
profile: minimal | ||
- name: Build on Rust ${{ matrix.toolchain }} | ||
run: cargo build --verbose --color always | ||
- name: Check formatting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright!
// cargo build && OUT_DIR=../target/tmp/ cargo test generate_protos -- --exact | ||
// ``` | ||
#[test] | ||
#[ignore] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite sure why we have this test case here? Seems this should be part of (a) build
script rather than live in the tests
folder? Also we probably don't want to use ignore
and have the user uncomment it, but rather use a cfg(..)
for this. This also breaks a simple cargo test
for me:
> cargo test
Compiling prost v0.11.9
Compiling regex-syntax v0.7.1
Compiling vss-accessor v0.1.0 (/Users/ero/workspace/vss-rust-client/vss-accessor)
Compiling reqwest v0.11.17
Compiling prost-types v0.11.9
Compiling regex v1.8.1
Compiling prost-build v0.11.9
error: environment variable `OUT_DIR` not defined
--> vss-accessor/tests/generate_protos.rs:22:19
|
22 | fs::copy(concat!(env!("OUT_DIR"), "/org.vss.rs"), "src/generated-src/org.vss.rs").unwrap();
| ^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `vss-accessor` due to previous error
warning: build failed, waiting for other jobs to finish...
exit 101
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i earlier had this in build.rs, on feedback had moved it to test which runs optionally.
but i think build.rs with conditional build is the right approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM!
Only one formatting nit and one question. Should be good to go after that though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we checking in the generated sources if we're downloading and building them from a specific server commit? Just to have clear versioning of the proto file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes and people felt more comfortable with static generated code over generated code for every build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought we discussed this already hence this PR was branched out and created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
No description provided.