Skip to content

Commit 2b00a88

Browse files
authored
Merge pull request project-chip#76 from ivmarkov/main
cargo fmt and clippy; build and test most features; publish actions
2 parents b73c65d + d2d5571 commit 2b00a88

File tree

19 files changed

+200
-77
lines changed

19 files changed

+200
-77
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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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@v3
22+
23+
- name: Fmt
24+
run: cargo fmt -- --check
25+
working-directory: tools/tlv
26+
27+
- name: Clippy
28+
run: cargo clippy --no-deps -- -Dwarnings
29+
working-directory: tools/tlv
30+
31+
- name: Build
32+
run: cargo build
33+
working-directory: tools/tlv
34+
35+
- name: Archive artifacts
36+
uses: actions/upload-artifact@v2
37+
with:
38+
name: tlv
39+
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@v3
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.

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# rs-matter: The Rust Implementation of Matter
22

3-
![experimental](https://img.shields.io/badge/status-Experimental-red) [![license](https://img.shields.io/badge/license-Apache2-green.svg)](https://raw.githubusercontent.com/project-chip/matter-rs/main/LICENSE)
4-
5-
[![Test Linux (OpenSSL)](https://github.com/project-chip/matter-rs/actions/workflows/test-linux-openssl.yml/badge.svg)](https://github.com/project-chip/matter-rs/actions/workflows/test-linux-openssl.yml)
6-
[![Test Linux (mbedTLS)](https://github.com/project-chip/matter-rs/actions/workflows/test-linux-mbedtls.yml/badge.svg)](https://github.com/project-chip/matter-rs/actions/workflows/test-linux-mbedtls.yml)
3+
![experimental](https://img.shields.io/badge/status-Experimental-red)
4+
[![license](https://img.shields.io/badge/license-Apache2-green.svg)](https://raw.githubusercontent.com/project-chip/matter-rs/main/LICENSE)
5+
[![CI](https://github.com/project-chip/matter-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/project-chip/matter-rs/actions/workflows/ci.yml)
6+
[![CI - TLV](https://github.com/project-chip/matter-rs/actions/workflows/ci-tlv-tool.yml/badge.svg)](https://github.com/project-chip/matter-rs/actions/workflows/ci-tlv-tool.yml)
7+
[![crates.io](https://img.shields.io/crates/v/rs-matter.svg)](https://crates.io/crates/rs-matter)
8+
[![Matrix](https://img.shields.io/matrix/matter-rs:matrix.org?label=join%20matrix&color=BEC5C9&logo=matrix)](https://matrix.to/#/#matter-rs:matrix.org)
79

810
## Build
911

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

0 commit comments

Comments
 (0)