Skip to content
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

Merged
merged 1 commit into from
Jul 12, 2023
Merged

Add rustfmt and Github CI #2

merged 1 commit into from
Jul 12, 2023

Conversation

G8XSU
Copy link
Collaborator

@G8XSU G8XSU commented Apr 26, 2023

No description provided.

Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems this is based on #1?

Can we maybe instead rebase #1 on this to avoid the additional cargo fmt commit that is somewhat out-of-place here?

build:
strategy:
matrix:
toolchain: [ stable, beta ]
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Contributor

@tnull tnull May 4, 2023

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created : #4

@G8XSU
Copy link
Collaborator Author

G8XSU commented May 2, 2023

Regarding basing everything on #2, i don't think it matters much. will have to reorder and rebase every PR.
Once #1 is merged, rebased changes should be easy.

Currently commits are just in the order in which work was done.

@tnull
Copy link
Contributor

tnull commented May 3, 2023

Regarding basing everything on #2, i don't think it matters much. will have to reorder and rebase every PR. Once #1 is merged, rebased changes should be easy.

Currently commits are just in the order in which work was done.

Well, it would avoid the additional cargo fmt commit. Also I don't believe CI is actually running currently, so it would be nice to first land the new CI scripts and then have CI run on the actual code changes.

build:
strategy:
matrix:
toolchain: [ stable, beta ]
Copy link
Contributor

@tnull tnull May 4, 2023

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?

- name: Checkout source code
uses: actions/checkout@v2
- name: Install Protobuf compiler (protoc)
uses: arduino/setup-protoc@v1
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Contributor

@tnull tnull left a 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
Copy link
Contributor

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.

Copy link
Collaborator Author

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.

Copy link
Contributor

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?

Copy link
Collaborator Author

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)

Copy link
Contributor

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
Copy link
Contributor

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]
Copy link
Contributor

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

Copy link
Collaborator Author

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.

.github/workflows/build.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@tnull tnull left a 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.

vss-accessor/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, makes sense.

Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@G8XSU G8XSU merged commit fe4f654 into lightningdevkit:main Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants