From 76246e32f2a7b42ce979a6f079587a2dc05bbe9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20Stu=CC=88rmer?=
Date: Fri, 4 Oct 2024 18:12:10 +0200
Subject: [PATCH 1/9] add simple contribution notes
---
CONTRIBUTING.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
README.md | 13 +++++++++++++
2 files changed, 63 insertions(+)
create mode 100644 CONTRIBUTING.md
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..ee6151a
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,50 @@
+# Welcome to ZigBee in Rust
+
+This is a **FOSS** (free and open-source software) and lives from contributions of the community.
+
+There are many ways to contribute:
+
+ * 📣 Spread the project or its apps to the world
+ * ✍️ Writing tutorials and blog posts
+ * 📝 Create or update the documentation
+ * 🐛 Submit bug reports
+ * 💡 Adding ideas and feature requests to Discussions
+ * 👩🎨 Create designs or UX flows
+ * 🧑💻 Contribute code or review PRs
+
+
+## 📜 Ground Rules
+
+A community like this should be **open**, **considerate** and **respectful**.
+
+Behaviours that reinforce these values contribute to a positive environment, and include:
+
+ * **Being open**. Members of the community are open to collaboration.
+ * **Focusing on what is best for the community**. We're respectful of the processes set forth in the community, and we work within them.
+ * **Acknowledging time and effort**. We're respectful and thoughtful when addressing the efforts of others, keeping in mind that often times the labor was completed simply for the good of the community.
+ * **Being respectful of differing viewpoints and experiences**. We're receptive to constructive comments and criticism, as the experiences and skill sets of other members contribute to the whole of our efforts.
+ * **Showing empathy towards other community members**. We're attentive in our communications, whether in person or online, and we're tactful when approaching differing views.
+ * **Being considerate**. Members of the community are considerate of their peers.
+ * **Being respectful**. We're respectful of others, their positions, their skills, their commitments, and their efforts.
+ * **Gracefully accepting constructive criticism**. When we disagree, we are courteous in raising our issues.
+ * **Using welcoming and inclusive language**. We're accepting of all who wish to take part in our activities, fostering an environment where anyone can participate and everyone can make a difference.
+
+
+## 🧑💻 Code Contribution
+
+To contribute code to the repository, you don't need any permissions.
+First start by forking the repository, clone and checkout your clone and start coding.
+When you're happy with your changes, create Atomic commits on a **new feature branch** and push it to ***your*** fork.
+
+Atomic commits will make it easier to track down regressions. Also, it enables the ability to cherry-pick or revert a change if needed.
+
+1. Fork it (https://github.com/thebino/zigbee-rs/fork)
+2. Create a new feature branch (`git checkout -b feature/fooBar`)
+3. Commit your changes (`git commit -am 'Add some fooBar'`)
+4. Push to the branch (`git push origin feature/fooBar`)
+5. Create a new Pull Request
+
+## 💾 Technology
+
+The project is written in [Rust](https://rust-lang.org/) and using `no_std`
+
diff --git a/README.md b/README.md
index 9e8e3ad..5d0596c 100644
--- a/README.md
+++ b/README.md
@@ -16,3 +16,16 @@ It enables these devices to connect and communicate with each other, allowing fo
Outline of the ZigBee Stack Architecture
+## 🏛️ License
+
+Licensed under either of:
+
+- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
+- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
+
+## 🧩 Contribution
+
+This is a free and open project and lives from contributions of the community.
+
+See our [Contribution Guide](CONTRIBUTING.md)
+
From 872fd7cacd9491484c8761accf76657b64665a10 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20Stu=CC=88rmer?=
Date: Fri, 4 Oct 2024 18:13:04 +0200
Subject: [PATCH 2/9] adjust rust badge
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 5d0596c..ed4035d 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
[![GitHub contributors](https://img.shields.io/github/contributors/thebino/zigbee-rs?color=success&style=for-the-badge)](https://github.com/thebino/zigbee-rs/graphs/contributors)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/thebino/zigbee-rs/ci.yaml?style=for-the-badge)
![ZigBee](https://img.shields.io/badge/zigbee-22.1.0-blue?color=4285F4&logo=zigbee&style=for-the-badge)
-![Rust](https://img.shields.io/badge/rust-2021-orange?color=E45928&logo=rust&style=for-the-badge)
+![Rust](https://img.shields.io/badge/rust-2018-orange?color=E45928&logo=rust&style=for-the-badge)
The ZigBee protocol stack to integrate ZigBee communication into an application.
From 3777b72bfc62ae3508d338f9cea076bd291b9320 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20Stu=CC=88rmer?=
Date: Sun, 6 Oct 2024 06:31:45 +0200
Subject: [PATCH 3/9] add test coverage to CI
---
.github/workflows/ci.yaml | 58 +++++++++++++++++++++++++++++++++++++--
1 file changed, 55 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 432698b..821e768 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -12,6 +12,8 @@ env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CARGO_TERM_VERBOSE: 'true'
+ RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort
+ RUSTDOCFLAGS: -Cpanic=abort
jobs:
build:
@@ -30,11 +32,61 @@ jobs:
# uses: obi1kenobi/cargo-semver-checks-action@v2
- name: Install Rust
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: ${{ matrix.toolchain }}
+ override: true
+
+ - name: Cache dependencies
+ uses: actions/cache@v2
+ env:
+ cache-name: cache-dependencies
+ with:
+ path: |
+ ~/.cargo/.crates.toml
+ ~/.cargo/.crates2.json
+ ~/.cargo/bin
+ ~/.cargo/registry/index
+ ~/.cargo/registry/cache
+ target
+ key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }}
- name: Build
run: cargo build --verbose
-
+
- name: Test
- run: cargo test --verbose
+ run: cargo test -- -Z unstable-options --format json --report-time | tee test_results_debug.json
+ env: # See https://github.com/johnterickson/cargo2junit/issues/79
+ RUSTC_BOOTSTRAP: 1
+
+ - name: Build Release
+ run: cargo build --release --verbose
+
+ - name: Test release
+ run: cargo test --release -- -Z unstable-options --format json --report-time | tee test_results_release.json
+ env: # See https://github.com/johnterickson/cargo2junit/issues/79
+ RUSTC_BOOTSTRAP: 1
+
+ - name: Generate test result and coverage report
+ run: |
+ cargo install cargo2junit grcov;
+ cargo test $CARGO_OPTIONS -- -Z unstable-options --format json | cargo2junit > results.xml;
+ zip -0 ccov.zip `find . \( -name "zigbee-rs*.gc*" \) -print`;
+ grcov ccov.zip -s . -t lcov --llvm --ignore-not-existing --ignore "/*" --ignore "tests/*" -o lcov.info;
+
+ - name: Upload test results
+ uses: EnricoMi/publish-unit-test-result-action@v1
+ with:
+ check_name: Test Results
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ files: results.xml
+
+ - name: Publish Test Report Release
+ uses: mikepenz/action-junit-report@v3
+ if: always()
+ with:
+ comment: true
+ report_paths: 'test_results_release.xml'
+ check_title_template: ${{ matrix.name }} release
From 051502c5b9c1fd32cf01e3db11454a62464c38d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20Stu=CC=88rmer?=
Date: Sun, 6 Oct 2024 06:35:31 +0200
Subject: [PATCH 4/9] remove z flags
---
.github/workflows/ci.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 821e768..b765903 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -12,7 +12,7 @@ env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CARGO_TERM_VERBOSE: 'true'
- RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort
+ RUSTFLAGS: -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort
RUSTDOCFLAGS: -Cpanic=abort
jobs:
From 37f7146c0845f2e5ff32862b2b4641cc8746bc19 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20Stu=CC=88rmer?=
Date: Sun, 6 Oct 2024 06:38:47 +0200
Subject: [PATCH 5/9] re-add -Zpanig_abort_tests
---
.github/workflows/ci.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index b765903..4857c92 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -12,7 +12,7 @@ env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CARGO_TERM_VERBOSE: 'true'
- RUSTFLAGS: -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort
+ RUSTFLAGS: -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort
RUSTDOCFLAGS: -Cpanic=abort
jobs:
From 1b2b6afaf9191d41d5d52bee97728276598175fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20Stu=CC=88rmer?=
Date: Sun, 6 Oct 2024 06:57:23 +0200
Subject: [PATCH 6/9] run tests only on nightly
---
.github/workflows/ci.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 4857c92..f7450dd 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -56,6 +56,7 @@ jobs:
run: cargo build --verbose
- name: Test
+ if: matrix.toolchain == 'nightly'
run: cargo test -- -Z unstable-options --format json --report-time | tee test_results_debug.json
env: # See https://github.com/johnterickson/cargo2junit/issues/79
RUSTC_BOOTSTRAP: 1
@@ -64,6 +65,7 @@ jobs:
run: cargo build --release --verbose
- name: Test release
+ if: matrix.toolchain == 'nightly'
run: cargo test --release -- -Z unstable-options --format json --report-time | tee test_results_release.json
env: # See https://github.com/johnterickson/cargo2junit/issues/79
RUSTC_BOOTSTRAP: 1
From 4f64bed1bd53413d234c10e7e082e1793a69856e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20Stu=CC=88rmer?=
Date: Sun, 6 Oct 2024 07:04:53 +0200
Subject: [PATCH 7/9] run nightly only
---
.github/workflows/ci.yaml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index f7450dd..88d432d 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -21,9 +21,9 @@ jobs:
strategy:
matrix:
toolchain:
- - stable
+ # - stable
- beta
- - nightly
+ # - nightly
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -56,7 +56,7 @@ jobs:
run: cargo build --verbose
- name: Test
- if: matrix.toolchain == 'nightly'
+ # if: matrix.toolchain == 'nightly'
run: cargo test -- -Z unstable-options --format json --report-time | tee test_results_debug.json
env: # See https://github.com/johnterickson/cargo2junit/issues/79
RUSTC_BOOTSTRAP: 1
@@ -65,7 +65,7 @@ jobs:
run: cargo build --release --verbose
- name: Test release
- if: matrix.toolchain == 'nightly'
+ # if: matrix.toolchain == 'nightly'
run: cargo test --release -- -Z unstable-options --format json --report-time | tee test_results_release.json
env: # See https://github.com/johnterickson/cargo2junit/issues/79
RUSTC_BOOTSTRAP: 1
From 1eab23ef4b5c34fdfdfe9919fe3c167b4d0b4be4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20Stu=CC=88rmer?=
Date: Sun, 6 Oct 2024 07:05:43 +0200
Subject: [PATCH 8/9] run nightly only
---
.github/workflows/ci.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 88d432d..9e9ccd4 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -22,8 +22,8 @@ jobs:
matrix:
toolchain:
# - stable
- - beta
- # - nightly
+ # - beta
+ - nightly
steps:
- name: Checkout
uses: actions/checkout@v4
From 53a10a2afa946b1c2c7be76b7035f6bd2d500665 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20Stu=CC=88rmer?=
Date: Sun, 6 Oct 2024 07:16:06 +0200
Subject: [PATCH 9/9] add test
---
src/lib.rs | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/lib.rs b/src/lib.rs
index e0eccfa..069bfe7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,7 +2,18 @@
//!
//! ZigBee is a protocol stack based on the ZigBee specification 22 1.0
//!
-mod lib {
+pub fn add(a: i32, b: i32) -> i32 {
+ a + b
+}
+
+#[cfg(test)]
+mod tests {
+ // Note this useful idiom: importing names from outer (for mod tests) scope.
+ use super::*;
+ #[test]
+ fn test_add() {
+ assert_eq!(add(1, 2), 3);
+ }
}