-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of up-streamer-rust
- Loading branch information
1 parent
a01d093
commit 5a8e33e
Showing
20 changed files
with
4,759 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# ******************************************************************************** | ||
# Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
# | ||
# See the NOTICE file(s) distributed with this work for additional | ||
# information regarding copyright ownership. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Apache License Version 2.0 which is available at | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# *******************************************************************************/ | ||
|
||
name: Build checks and tests | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
paths: | ||
- "up-streamer/src/**" | ||
- "Cargo.*" | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.ref }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: cargo fmt | ||
working-directory: ${{github.workspace}} | ||
run: cargo fmt -- --check | ||
- name: cargo clippy | ||
working-directory: ${{github.workspace}} | ||
run: cargo clippy --all-targets -- -W warnings -D warnings | ||
|
||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- name: Install dependencies | ||
run: | | ||
cargo install cargo-all-features | ||
- name: Show toolchain information | ||
working-directory: ${{github.workspace}} | ||
run: | | ||
rustup toolchain list | ||
cargo --version | ||
- name: cargo-check all possible feature combinations | ||
run: | | ||
cargo check-all-features | ||
- name: cargo-test all possible feature combinations | ||
run: | | ||
cargo test-all-features | ||
coverage: | ||
name: Collect coverage info | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- name: Install dependencies | ||
run: | | ||
cargo install cargo-tarpaulin | ||
- name: Show toolchain information | ||
working-directory: ${{github.workspace}} | ||
run: | | ||
rustup toolchain list | ||
cargo --version | ||
- name: Run tests to collect code coverage information | ||
run: | | ||
# enable nightly features so that we can also include Doctests | ||
RUSTC_BOOTSTRAP=1 cargo tarpaulin -o xml -o lcov -o html --doc --tests --all-features | ||
- name: Upload coverage report (xml) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Test Coverage Results (xml) | ||
path: cobertura.xml | ||
- name: Upload coverage report (lcov) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Test Coverage Results (lcov) | ||
path: lcov.info | ||
- name: Upload coverage report (html) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Test Coverage Results (html) | ||
path: tarpaulin-report.html | ||
|
||
build-docs: | ||
name: Build documentation | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Create Documentation | ||
working-directory: ${{github.workspace}} | ||
run: RUSTDOCFLAGS=-Dwarnings cargo doc -p up-streamer --no-deps |
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,17 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
target/ | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb | ||
|
||
# cargo-tarpaulin | ||
cobertura.xml | ||
lcov.info | ||
tarpaulin-report.html | ||
|
||
.idea/ |
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,35 @@ | ||
# Contributing to Eclipse uProtocol | ||
|
||
Thanks for your interest in this project. Contributions are welcome! | ||
|
||
Please refer to the main [CONTRIBUTING](https://github.com/eclipse-uprotocol/.github/blob/main/CONTRIBUTING.adoc) resource for Eclipse uProtocol to get most of the general overview. | ||
|
||
The following is from [`up-rust`](https://github.com/eclipse-uprotocol/up-rust) project and is specific to Rust development for uProtocol. | ||
|
||
## Setting up a development environment | ||
|
||
You can use any development environment you like to contribute to `up-streamer-rust`. However, it is mandatory to use the Rust linter ('[clippy](<https://github.com/rust-lang/rust-clippy>)') for any pull requests you do. | ||
To set up VSCode to run clippy per default every time you save your code, have a look here: [How to use Clippy in VS Code with rust-analyzer?](https://users.rust-lang.org/t/how-to-use-clippy-in-vs-code-with-rust-analyzer/41881) | ||
|
||
Similarly, the project requests that markdown is formatted and linted properly - to help with this, it is recommended to use [markdown linters](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint). | ||
|
||
During development, before submitting a PR, you can use `./tools/fmt_clippy_doc.sh` to run these checks on the workspace. | ||
|
||
There also exists a helper script in ./tools to generate test results and test code coverage reports. These reports are placed in the `./target/tarpaulin` directory. If you use VSCode with the [Coverage Gutters](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters) extension, you can enable display of code coverage information with these settings: | ||
|
||
``` json | ||
"coverage-gutters.coverageBaseDir": "**", | ||
"coverage-gutters.coverageFileNames": [ | ||
"target/tarpaulin/lcov.info", | ||
], | ||
``` | ||
|
||
## DevContainer | ||
|
||
All of these prerequisites are made available as a VSCode devcontainer, configured at the usual place (`.devcontainer`). | ||
|
||
## Contact | ||
|
||
Contact the project developers via the project's "dev" list. | ||
|
||
<https://accounts.eclipse.org/mailing-list/uprotocol-dev> |
Oops, something went wrong.