Skip to content

Commit 92b2492

Browse files
committed
cargo fmt and clippy; build and test most features; publish actions
1 parent b73c65d commit 92b2492

File tree

18 files changed

+191
-73
lines changed

18 files changed

+191
-73
lines changed

.github/workflows/build-tlv-tool.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/ci-tlv-tool.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CITLVTool
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: "20 7 * * *"
10+
workflow_dispatch:
11+
12+
env:
13+
CARGO_TERM_COLOR: always
14+
15+
jobs:
16+
build_tlv_tool:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
- name: Fmt
24+
run: cd tools/tlv; cargo fmt -- --check
25+
26+
- name: Clippy
27+
run: cd tools/tlv; cargo clippy --no-deps -- -Dwarnings
28+
29+
- name: Build
30+
run: cd tools/tlv; cargo build
31+
32+
- name: Archive artifacts
33+
uses: actions/upload-artifact@v2
34+
with:
35+
name: tlv
36+
path: tools/tlv/target/debug/tlv

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: "50 6 * * *"
10+
workflow_dispatch:
11+
12+
env:
13+
rust_toolchain: nightly-2023-07-01
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
CARGO_TERM_COLOR: always
16+
17+
jobs:
18+
build_and_test:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
crypto-backend: ['rustcrypto', 'mbedtls', 'openssl']
23+
features: ['', 'alloc', 'os']
24+
toolchain: ['stable', 'nightly']
25+
26+
steps:
27+
- name: Rust
28+
if: matrix.toolchain == 'nightly'
29+
uses: dtolnay/rust-toolchain@v1
30+
with:
31+
toolchain: ${{ env.rust_toolchain }}
32+
components: rustfmt, clippy, rust-src
33+
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
37+
- name: Fmt
38+
run: cargo +${{ matrix.toolchain == 'nightly' && env.rust_toolchain || 'stable'}} fmt -- --check
39+
40+
- name: Clippy
41+
run: cargo +${{ matrix.toolchain == 'nightly' && env.rust_toolchain || 'stable'}} clippy --no-deps --no-default-features --features ${{matrix.crypto-backend}},${{matrix.features}},${{ matrix.toolchain == 'nightly' && 'nightly' || ''}} -- -Dwarnings
42+
43+
- name: Build
44+
run: cargo +${{ matrix.toolchain == 'nightly' && env.rust_toolchain || 'stable'}} build --no-default-features --features ${{matrix.crypto-backend}},${{matrix.features}},${{ matrix.toolchain == 'nightly' && 'nightly' || ''}}
45+
46+
- name: Test
47+
if: matrix.features == 'os'
48+
run: cargo +${{ matrix.toolchain == 'nightly' && env.rust_toolchain || 'stable'}} test --no-default-features --features ${{matrix.crypto-backend}},${{matrix.features}},${{ matrix.toolchain == 'nightly' && 'nightly' || ''}} -- --test-threads=1
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: PublishDryRun
2+
3+
on: workflow_dispatch
4+
5+
env:
6+
CRATE_NAME: rs-matter
7+
8+
jobs:
9+
publish_dry_run:
10+
name: PublishDryRun
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: PublishDryRun
17+
run: cargo publish -p rs-matter --dry-run
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: PublishMacrosDryRun
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
publish_macros_dry_run:
7+
name: PublishMacrosDryRun
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
13+
- name: PublishDryRun-Macros
14+
run: cargo publish -p rs-matter-macros --dry-run
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: PublishMacros
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
publish_macros:
7+
name: PublishMacros
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
13+
- name: Login
14+
run: cargo login ${{ secrets.crates_io_token }}
15+
16+
- name: Publish-Macros
17+
run: cargo publish -p rs-matter-macros

.github/workflows/publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish
2+
3+
on: workflow_dispatch
4+
5+
env:
6+
CRATE_NAME: rs-matter
7+
8+
jobs:
9+
publish:
10+
name: Publish
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Login
17+
run: cargo login ${{ secrets.crates_io_token }}
18+
19+
- name: Publish
20+
run: cargo publish -p rs-matter
21+
22+
- name: Get the crate version from cargo
23+
run: |
24+
version=$(cd rs-matter; cargo metadata --format-version=1 --no-deps | jq -r ".packages[] | select(.name == \"${{env.CRATE_NAME}}\") | .version")
25+
echo "crate_version=$version" >> $GITHUB_ENV
26+
echo "${{env.CRATE_NAME}} version: $version"
27+
28+
- name: Tag the new release
29+
uses: rickstaa/action-create-tag@v1
30+
with:
31+
tag: v${{env.crate_version}}
32+
message: "Release v${{env.crate_version}}"

.github/workflows/test-linux.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

examples/onoff_light/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn run() -> Result<(), Error> {
133133
let mut mdns_runner = pin!(mdns.run(&stack, &mut mdns_buffers));
134134

135135
let mut buffers = RunBuffers::new();
136-
let mut runner = matter.run(
136+
let runner = matter.run(
137137
&stack,
138138
&mut buffers,
139139
CommissioningData {
@@ -157,10 +157,10 @@ fn run() -> Result<(), Error> {
157157
#[cfg(not(all(feature = "std", not(target_os = "espidf"))))]
158158
let mut psm_runner = pin!(core::future::pending());
159159

160-
let mut runner = select3(&mut runner, &mut mdns_runner, &mut psm_runner);
160+
let runner = select3(&mut runner, &mut mdns_runner, &mut psm_runner);
161161

162162
#[cfg(feature = "std")]
163-
async_io::block_on(&mut runner).unwrap()?;
163+
async_io::block_on(runner).unwrap()?;
164164

165165
// NOTE (no_std): For no_std, replace with your own more efficient no_std executor,
166166
// because the executor used below is a simple busy-loop poller

rs-matter-macros/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
name = "rs-matter-macros"
33
version = "0.1.0"
44
edition = "2021"
5+
authors = ["Kedar Sovani <[email protected]>"]
6+
description = "Native Rust implementation of the Matter (Smart-Home) ecosystem - Proc-macros"
7+
repository = "https://github.com/project-chip/matter-rs"
8+
readme = "README.md"
9+
keywords = ["matter", "smart", "smart-home", "IoT", "ESP32"]
10+
categories = ["embedded", "network-programming"]
511
license = "Apache-2.0"
612

713
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

0 commit comments

Comments
 (0)