Skip to content

Commit

Permalink
[Rust]:Add checks on rust code generation
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Gisondi <[email protected]>
  • Loading branch information
harlem88 committed Oct 5, 2023
1 parent fb45a7b commit f91f033
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/code-generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,29 @@ jobs:
unzip protoc-24.3-linux-x86_64.zip -d $HOME/.local
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: 1.59
override: true
components: clippy
- name: Remove Rust old code
run: (! test -f ./astarte-message-hub-proto/src/astarteplatform.msghub.rs) || rm ./astarte-message-hub-proto/src/astarteplatform.msghub.rs
working-directory: ./rust/rust-codegen
working-directory: ./rust/
- name: Generate Rust code with cargo build
run: cargo run -- --proto-directory ../../proto --out ../astarte-message-hub-proto/src/
working-directory: ./rust/rust-codegen
- name: cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings
working-directory: ./rust/astarte-message-hub-proto
- name: cargo doc
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: --cfg docsrs -D warnings
working-directory: ./rust/astarte-message-hub-proto
- name: cargo check
run: cargo check --all-features
env:
RUSTDOCFLAGS: -D warnings
working-directory: ./rust/astarte-message-hub-proto
- name: Upload Rust code
uses: actions/upload-artifact@v3
with:
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/rust-check-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
name: Check main.rs formatting

on:
pull_request:
push:
branches:
- master
- release-*
pull_request:

jobs:
fmt:
Expand All @@ -29,13 +32,7 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Add rustfmt
run: rustup component add rustfmt
uses: dtolnay/rust-toolchain@stable
- name: Check formatting
run: rustfmt --check ./src/main.rs
working-directory: ./rust/rust-codegen
4 changes: 1 addition & 3 deletions .github/workflows/rust-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: 1.59
override: true
- name: Publish astarte-message-hub-proto
run: cargo publish --token ${CRATES_TOKEN} --dry-run
env:
Expand Down

0 comments on commit f91f033

Please sign in to comment.