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

CI Improvements #21

Merged
merged 8 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 6 additions & 50 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,14 @@
on:
push:
tags:
- '*'

jobs:
test:
name: Build and Test Project
runs-on: ubuntu-latest

env:
CARGO_TERM_COLORS: always

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy

- name: Setup Cargo Cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Setup Protobuf Compiler
uses: arduino/setup-protoc@v2

- name: Run Unit Tests
run: cargo test
on: workflow_dispatch

jobs:
publish:
name: Publish crate to crates.io
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Setup Protobuf Compiler
uses: arduino/setup-protoc@v2
- uses: actions/checkout@v4
- uses: arduino/setup-protoc@v2
- uses: dtolnay/rust-toolchain@stable
- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
67 changes: 32 additions & 35 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
name: CI

env:
CARGO_TERM_COLOR: always
MSRV: '1.70'

on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
branches:
- "main"
pull_request: {}

jobs:
test:

name: Test `cargo check/test/build` on ${{ matrix.os }}
runs-on: ubuntu-latest

env:
CARGO_TERM_COLOR: always
# Check Project for Clippy Lints and ensure that it is properly formatted
check:
name: Check clippy lints and format

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: taiki-e/install-action@protoc
- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy

- name: Setup Cargo Cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Setup Protobuf Compiler
uses: arduino/setup-protoc@v2
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Format
run: cargo fmt --all --check

# Run Unit tests for the project
test:
name: Run Tests

- name: Run Unit Tests
run: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@protoc
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Tests
run: cargo test --workspace --all-features --all-targets
File renamed without changes.
4 changes: 2 additions & 2 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
//! # })}
//! ```
mod capabilities;
mod client;
#[cfg(feature = "dangerous_configuration")]
#[cfg_attr(docsrs, doc(cfg(feature = "dangerous_configuration")))]
pub mod dangerous;
mod gnmi_client;

pub use client::{Client, ClientBuilder};
pub use gnmi_client::{Client, ClientBuilder};

pub use capabilities::{Capabilities, Encoding};
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
//! as well as various telemetry data.

#![cfg_attr(docsrs, feature(doc_cfg))]

mod auth;
pub mod client;
pub mod error;

#[allow(clippy::all)]
pub(crate) mod gen {
pub mod gnmi {
tonic::include_proto!("gnmi");
Expand Down