Skip to content

Commit

Permalink
[Rust]:Add the proto generated code
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Gisondi <[email protected]>
  • Loading branch information
harlem88 committed Oct 9, 2023
1 parent 04b1a05 commit 789f822
Show file tree
Hide file tree
Showing 6 changed files with 571 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# SPDX-License-Identifier: Apache-2.0

name: commit-codegen
name: check-codegen

on:
workflow_call:
Expand All @@ -27,27 +27,12 @@ permissions:

jobs:
commit:
name: Commit and push generated code
name: Check generated code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Commit the generated code
- name: Check the generated code
run: |
git config user.name github-actions
git config user.email [email protected]
git add ./python
git diff --staged --quiet || git commit -s -m "[Python]: Add generated code"
mv ./rust-dist/astarteplatform.msghub.rs ./rust/astarte-message-hub-proto/src/astarteplatform.msghub.rs
git add ./rust/astarte-message-hub-proto/src/astarteplatform.msghub.rs
git diff --staged --quiet || git commit -s -m "[Rust]: Add generated code"
- name: Create pull request
uses: peter-evans/create-pull-request@v5
with:
title: Update generated code
base: master
labels: automated-pr
branch: update-code-gen
delete-branch: true
signoff: true
git --no-pager diff --no-index -- ./rust-dist/astarteplatform.msghub.rs ./rust/astarte-message-hub-proto/src/astarteplatform.msghub.rs
11 changes: 4 additions & 7 deletions .github/workflows/code-generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,9 @@ jobs:
rust-code-generation:
needs: [ reuse ]
uses: ./.github/workflows/rust-code-generation.yaml
check-codegen:
needs: [ python-code-generation, rust-code-generation ]
uses: ./.github/workflows/check-code-generation.yaml
rust-code-check:
needs: [ rust-code-generation ]
needs: [ check-codegen ]
uses: ./.github/workflows/rust-code-check.yaml
commit-codegen:
# if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs: [ python-code-generation, rust-code-check ]
permissions:
contents: write
uses: ./.github/workflows/commit-code-generation.yaml
16 changes: 0 additions & 16 deletions .github/workflows/rust-code-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ jobs:
toolchain: [ stable ]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: rust-dist
path: rust/astarte-message-hub-proto/src
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
Expand All @@ -74,10 +70,6 @@ jobs:
- uses: actions/checkout@v4
- name: Install nightly
uses: dtolnay/rust-toolchain@nightly
- uses: actions/download-artifact@v3
with:
name: rust-dist
path: rust/astarte-message-hub-proto/src
- name: cargo doc
run: cargo doc --no-deps --all-features
env:
Expand All @@ -92,10 +84,6 @@ jobs:
uses: dtolnay/rust-toolchain@stable
- name: cargo install cargo-hack
uses: taiki-e/install-action@cargo-hack
- uses: actions/download-artifact@v3
with:
name: rust-dist
path: rust/astarte-message-hub-proto/src
# intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4
- name: cargo hack
run: cargo hack --feature-powerset check
Expand All @@ -114,9 +102,5 @@ jobs:
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.msrv }}
- uses: actions/download-artifact@v3
with:
name: rust-dist
path: rust/astarte-message-hub-proto/src
- name: cargo +${{ matrix.msrv }} check
run: cargo check --all-features --package astarte-message-hub-proto
2 changes: 1 addition & 1 deletion .github/workflows/rust-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.59
toolchain: stable
- name: Publish astarte-message-hub-proto
run: cargo publish --token ${CRATES_TOKEN} --dry-run
env:
Expand Down
4 changes: 4 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ Source: https://github.com/astarte-platform/astarte-message-hub-proto
Files: python/astarteplatform/msghub/*
Copyright: SECO Mind Srl
License: CC0-1.0

Files: rust/astarte-message-hub-proto/src/astarteplatform.msghub.rs
Copyright: SECO Mind Srl
License: Apache-2.0
Loading

0 comments on commit 789f822

Please sign in to comment.