Skip to content
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
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
updates:
- package-ecosystem: github-actions
directories:
- /
- /.github/actions/*
schedule:
interval: weekly
groups:
github-actions-deps:
patterns:
- '*'
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
groups:
cargo-deps:
patterns:
- '*'
38 changes: 38 additions & 0 deletions .github/workflows/auto-reviewer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Auto Reviewer

on:
pull_request:
types: [opened, labeled]

jobs:
auto-reviewer:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'dependencies')
permissions:
pull-requests: write

steps:
- name: Add reviewers for Github Actions dependencies
if: contains(github.event.pull_request.labels.*.name, 'github_actions')
uses: actions/github-script@v8
with:
script: |
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
reviewers: ['fvacek', 'syyyr']
});

- name: Add reviewers for Rust dependencies
if: contains(github.event.pull_request.labels.*.name, 'rust')
uses: actions/github-script@v8
with:
script: |
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
reviewers: ['fvacek', 'j4r0u53k', 'syyyr']
});

75 changes: 75 additions & 0 deletions .github/workflows/check-version-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# vim: sw=2
name: Misc

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: write
pull-requests: read

jobs:
check-version-bump:
name: Check version bump
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Check version bump
id: version-check
continue-on-error: ${{startsWith(github.head_ref, 'dependabot/')}}
uses: silicon-heaven/rust-check-version-bump@v1.0.1

- name: Check if Cargo.lock was changed
continue-on-error: ${{startsWith(github.head_ref, 'dependabot/')}}
run: |
cargo update --workspace
if ! git diff --exit-code; then
echo "Error: No version bump detected in Cargo.lock"
exit 1
fi

- name: Fetch Dependabot metadata
id: dependabot-metadata
if: steps.version-check.outcome == 'failure'
uses: dependabot/fetch-metadata@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}

- name: Checkout code
if: steps.version-check.outcome == 'failure'
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{github.head_ref}}

- name: Bump version
if: steps.version-check.outcome == 'failure'
run: |
echo "Bumping version by patch"
cargo install cargo-bump
cargo bump patch
cargo update --workspace

- name: Commit changes
if: steps.version-check.outcome == 'failure'
run: |
git diff
git config --global user.name "Login will be determined by the Github API based on the creator of the token"
git config --global user.email ""
git commit -am '[dependabot-skip] Bump version'

- name: Push changes
if: steps.version-check.outcome == 'failure'
uses: Asana/push-signed-commits@v1
with:
github-token: ${{secrets.DEPENDABOT_GITHUB_TOKEN}}
local_branch_name: ${{github.head_ref}}
remote_branch_name: ${{github.head_ref}}
43 changes: 35 additions & 8 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,55 @@ on:

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"

permissions:
# For syyyr/rust-pycobertura-action
pull-requests: write

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
os: [ubuntu-latest, windows-latest]
toolchain: [stable, nightly]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install system dependencies
run: sudo apt-get install -y libudev-dev pkg-config
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev pkg-config

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain }}
components: clippy
override: true

- name: Clippy
run: cargo clippy --all-targets --all-features
- name: Build
run: cargo build --all-targets --all-features
- name: Run tests
run: cargo test --all-targets --all-features

- name: Build and Install Binary
run: |
mkdir -p ${{github.workspace}}/install
cargo install --path '${{github.workspace}}' --root '${{github.workspace}}/install' --target ${{ matrix.target }} --locked
cargo install --all-features --path '${{github.workspace}}' --root '${{github.workspace}}/install' --target ${{ matrix.target }} --locked
shell: bash

- name: Upload Artifact
Expand Down Expand Up @@ -84,16 +103,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install system dependencies
run: sudo apt-get install -y libudev-dev pkg-config
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev pkg-config

- name: Generate coverage
uses: silicon-heaven/rust-pycobertura-action@v2.0.0
with:
project_name: shvcall

check-version-bump:
name: Check version bump
upload-crates-io:
name: Publish crates on crates.io
if: github.ref == 'refs/heads/master'
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Check version bump
uses: silicon-heaven/rust-check-version-bump@v1.0.0
- name: Checkout code
uses: actions/checkout@v6

- run: |
cargo login <<< "${{secrets.CRATES_IO_TOKEN}}"
cargo publish
34 changes: 14 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[package]
name = "shvcall"
version = "3.9.2"
description = "CLI utility to invoke remote SHV RPC calls"
license = "MIT"
repository = "https://github.com/silicon-heaven/shvcall-rs"
version = "3.9.3"
edition = "2024"

[[bin]]
Expand All @@ -12,8 +15,8 @@ serial = ["dep:serialport"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
shvproto = { git = "https://github.com/silicon-heaven/libshvproto-rs.git", tag = "3.6.22" }
shvrpc = { git = "https://github.com/silicon-heaven/libshvrpc-rs.git", tag = "6.0.0" }
shvproto = "3.6.28"
shvrpc = "7.1.5"
futures = "0.3.29"
smol = "2"
log = "0.4.20"
Expand Down
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use futures::future::{pending, select};
use futures_time::task::sleep_until;
use smol::io::{AsyncBufReadExt, BufReader};
use smol::net::{TcpListener, TcpStream};
#[cfg(not(target_os = "windows"))]
use smol::net::unix::UnixStream;
use smol::Unblock;
use clap::Parser;
Expand All @@ -19,6 +20,7 @@ use shvrpc::client::LoginParams;
use shvrpc::framerw::{FrameReader, FrameWriter};
use shvrpc::rpcframe::RpcFrame;
use shvrpc::rpcmessage::{RpcError, RqId, SeqNo};
#[cfg(not(target_os = "windows"))]
use shvrpc::serialrw::{SerialFrameReader, SerialFrameWriter};
use shvrpc::streamrw::{StreamFrameReader, StreamFrameWriter};
use shvrpc::util::login_from_url;
Expand Down Expand Up @@ -183,6 +185,7 @@ async fn login(url: &Url, user_agent: String) -> shvrpc::Result<(BoxedFrameReade
let frame_writer: BoxedFrameWriter = Box::new(StreamFrameWriter::new(bwr));
(frame_reader, frame_writer)
}
#[cfg(not(target_os = "windows"))]
"unix" => {
let stream = UnixStream::connect(url.path()).await?;
let (reader, writer) = stream.split();
Expand All @@ -192,6 +195,9 @@ async fn login(url: &Url, user_agent: String) -> shvrpc::Result<(BoxedFrameReade
let frame_writer: BoxedFrameWriter = Box::new(StreamFrameWriter::new(bwr));
(frame_reader, frame_writer)
}
#[cfg(target_os = "windows")]
"unix" => panic!("'unix schema is not supported on Windows'"),
#[cfg(not(target_os = "windows"))]
"unixs" => {
let stream = UnixStream::connect(url.path()).await?;
let (reader, writer) = stream.split();
Expand All @@ -202,6 +208,8 @@ async fn login(url: &Url, user_agent: String) -> shvrpc::Result<(BoxedFrameReade
reset_session = true;
(frame_reader, frame_writer)
}
#[cfg(target_os = "windows")]
"unixs" => panic!("'unix schema is not supported on Windows'"),
#[cfg(feature = "serial")]
"serial" => {
let port_name = url.path();
Expand Down