dapr-rust-sdk #747
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
name: dapr-rust-sdk | |
on: | |
schedule: | |
- cron: '8 8 * * *' | |
push: | |
branches: | |
- main | |
- release-* | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- main | |
- release-* | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
PROTOC_VERSION: 24.4 | |
RUSTFLAGS: "-D warnings" | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: clippy, rustfmt | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
version: ${{ env.PROTOC_VERSION }} | |
- uses: actions/checkout@v4 | |
- name: cargo fmt | |
run: cargo fmt -- --check --color ${{ env.CARGO_TERM_COLOR }} | |
- name: cargo clippy | |
run: cargo clippy | |
build: | |
name: Build on rust-${{ matrix.rust-version}} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rust-version: | |
- "stable" | |
- "nightly" | |
- "1.78.0" # MSRV | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust-version }} | |
components: clippy, rustfmt | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
version: ${{ env.PROTOC_VERSION }} | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: cargo build --workspace --all-targets --all-features | |
- name: Run Tests | |
run: cargo test --workspace --all-targets --all-features | |
test-docs-sdk: | |
name: Docs SDK | |
runs-on: ubuntu-latest | |
env: | |
RUSTDOCFLAGS: -Dwarnings | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: dtolnay/install@cargo-docs-rs | |
- run: cargo docs-rs -p dapr | |
test-docs-macros: | |
name: Docs Macros | |
runs-on: ubuntu-latest | |
env: | |
RUSTDOCFLAGS: -Dwarnings | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: dtolnay/install@cargo-docs-rs | |
- run: cargo docs-rs -p dapr-macros | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: [test-docs-sdk, test-docs-macros, lint, build] | |
if: startswith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: clippy, rustfmt | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
version: ${{ env.PROTOC_VERSION }} | |
- uses: actions/checkout@v4 | |
- name: cargo publish dapr-macros | |
run: cargo publish --manifest-path dapr-macros/Cargo.toml --token ${{ env.CARGO_TOKEN }} | |
- name: cargo publish dapr | |
run: cargo publish --manifest-path dapr/Cargo.toml --token ${{ env.CARGO_TOKEN }} |