From 9c747655d360d43e59119cdc857474b848bb0156 Mon Sep 17 00:00:00 2001 From: Mahmut Bulut Date: Sat, 5 Oct 2019 19:53:06 +0200 Subject: [PATCH 1/8] Add GitHub actions --- .github/clippy.yml | 12 -------- .github/workflows/ci.yml | 53 ++++++++++++++++++++++++++++++++++++ .github/workflows/clippy.yml | 20 ++++++++++++++ 3 files changed, 73 insertions(+), 12 deletions(-) delete mode 100644 .github/clippy.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/clippy.yml diff --git a/.github/clippy.yml b/.github/clippy.yml deleted file mode 100644 index cdf2bb4e..00000000 --- a/.github/clippy.yml +++ /dev/null @@ -1,12 +0,0 @@ -on: push -name: Clippy Check -jobs: - clippy_check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - run: rustup component add clippy - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..7a1f5a68 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,53 @@ +on: pull_request + +jobs: + build_and_test: + name: Build and test on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + + steps: + - uses: actions/checkout@master + + - name: Install nightly + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + + - name: check + uses: actions-rs/cargo@v1 + with: + command: check + args: --all --benches --bins --examples --tests + + - name: check unstable + uses: actions-rs/cargo@v1 + with: + command: check + args: --features unstable --all --benches --bins --examples --tests + + - name: tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --all --doc --features unstable + + check_fmt_and_docs: + name: Checking fmt and docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - name: setup + run: | + rustup default nightly + rustup component add rustfmt + rustc --version + - name: fmt + run: cargo fmt --all -- --check + + - name: Docs + run: cargo doc --features docs,unstable diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 00000000..f33cb5fa --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,20 @@ +on: pull_request + +name: Clippy Check +jobs: + clippy_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - id: component + uses: actions-rs/components-nightly@v1 + with: + component: clippy + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ steps.component.outputs.toolchain }} + override: true + - run: rustup component add clippy + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} From 0429068f91eb057c23e17aab891388dbcb34a1a6 Mon Sep 17 00:00:00 2001 From: Mahmut Bulut Date: Sat, 5 Oct 2019 19:57:46 +0200 Subject: [PATCH 2/8] Fix feature gate jobs --- .github/workflows/ci.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a1f5a68..db80af8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,17 +23,11 @@ jobs: command: check args: --all --benches --bins --examples --tests - - name: check unstable - uses: actions-rs/cargo@v1 - with: - command: check - args: --features unstable --all --benches --bins --examples --tests - - name: tests uses: actions-rs/cargo@v1 with: command: test - args: --all --doc --features unstable + args: --all --doc check_fmt_and_docs: name: Checking fmt and docs @@ -50,4 +44,4 @@ jobs: run: cargo fmt --all -- --check - name: Docs - run: cargo doc --features docs,unstable + run: cargo doc --features docs From 8668d5cc8b509c99f6392c2f4f7fe6451fa533b7 Mon Sep 17 00:00:00 2001 From: Mahmut Bulut Date: Sat, 5 Oct 2019 20:08:40 +0200 Subject: [PATCH 3/8] Use default stable rustfmt --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db80af8c..8dd64c68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: - name: setup run: | - rustup default nightly + rustup default stable rustup component add rustfmt rustc --version - name: fmt From bbabba41abc27eeba19a68494649d5c25ee71bca Mon Sep 17 00:00:00 2001 From: Mahmut Bulut Date: Sat, 5 Oct 2019 20:11:01 +0200 Subject: [PATCH 4/8] Fix cargo fmt errors --- benches/bench_one_for_one.rs | 9 +++------ examples/root_spv.rs | 4 ++-- examples/spawn_from_context.rs | 1 - src/lib.rs | 4 +++- src/macros.rs | 1 - src/supervisor.rs | 1 - tests/lib.rs | 6 ++---- tests/test_prelude.rs | 4 +--- 8 files changed, 11 insertions(+), 19 deletions(-) diff --git a/benches/bench_one_for_one.rs b/benches/bench_one_for_one.rs index 1f222de1..a1b1a88a 100644 --- a/benches/bench_one_for_one.rs +++ b/benches/bench_one_for_one.rs @@ -6,17 +6,14 @@ extern crate test; mod tests { use super::*; use bastion::bastion::Bastion; - + use bastion::config::BastionConfig; - - + use log::LevelFilter; - + use std::sync::Once; use std::{thread, time}; use test::Bencher; - - static INIT: Once = Once::new(); diff --git a/examples/root_spv.rs b/examples/root_spv.rs index 6fe678d5..78a6a8a4 100644 --- a/examples/root_spv.rs +++ b/examples/root_spv.rs @@ -3,7 +3,7 @@ use bastion::prelude::*; fn main() { Bastion::platform(); - let message = String::from("Some message to be passed"); + let message = String::from("a message"); Bastion::spawn( |context: BastionContext, msg: Box| { @@ -13,7 +13,7 @@ fn main() { _ => println!("other message type...") } - println!("root supervisor - spawn_at_root - 1"); + println!("spawned at root"); // Rebind to the system context.hook(); diff --git a/examples/spawn_from_context.rs b/examples/spawn_from_context.rs index 63de5c4f..e9755ddc 100644 --- a/examples/spawn_from_context.rs +++ b/examples/spawn_from_context.rs @@ -1,7 +1,6 @@ use bastion::prelude::*; use log::LevelFilter; - fn main() { let config = BastionConfig { log_level: LevelFilter::Debug, diff --git a/src/lib.rs b/src/lib.rs index fd9aed08..69a6d977 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,7 +26,9 @@ //! All up to you. And it should be up to you. //! -#![doc(html_logo_url = "https://raw.githubusercontent.com/bastion-rs/bastion/master/img/bastion-logo.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/bastion-rs/bastion/master/img/bastion-logo.png" +)] #[macro_use] extern crate log; diff --git a/src/macros.rs b/src/macros.rs index 475e0981..932bcd03 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -2,7 +2,6 @@ //! Macros to use in processes and defining the architecture of runtime. //! - /// /// Matches incoming messages to the process. /// Always have a `default` case to execute if unknown message arrives to the process. diff --git a/src/supervisor.rs b/src/supervisor.rs index 84317996..830a4fbf 100644 --- a/src/supervisor.rs +++ b/src/supervisor.rs @@ -296,7 +296,6 @@ impl Supervisor { } } - // FIXME: There might be discrepancy between passed self and referenced self. // Fix this with either passing reference without Box (lifetimes sigh!) // Or use channels to send back to the supervision tree. diff --git a/tests/lib.rs b/tests/lib.rs index 05e1c9f8..0500d67f 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -1,16 +1,14 @@ #[cfg(test)] mod tests { use bastion::bastion::Bastion; - + use bastion::config::BastionConfig; use bastion::context::BastionContext; use bastion::supervisor::SupervisionStrategy; use log::LevelFilter; - + use std::sync::Once; use std::{fs, thread, time}; - - static INIT: Once = Once::new(); diff --git a/tests/test_prelude.rs b/tests/test_prelude.rs index 42823e4e..dac440e2 100644 --- a/tests/test_prelude.rs +++ b/tests/test_prelude.rs @@ -3,11 +3,9 @@ mod tests { use bastion::prelude::*; use log::LevelFilter; - + use std::sync::Once; use std::{thread, time}; - - static INIT: Once = Once::new(); From f89e247b7d9bd57f76d1afbd49cac92d0e3ba46f Mon Sep 17 00:00:00 2001 From: Mahmut Bulut Date: Sat, 5 Oct 2019 20:12:03 +0200 Subject: [PATCH 5/8] Give name for the CI jobs --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8dd64c68..136f87d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,6 @@ on: pull_request +name: CI jobs: build_and_test: name: Build and test on ${{ matrix.os }} From 234552a78d32ee4e5a987795d183c26dd920176c Mon Sep 17 00:00:00 2001 From: Mahmut Bulut Date: Sat, 5 Oct 2019 20:16:18 +0200 Subject: [PATCH 6/8] Use cargo doc --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 136f87d2..30ae3ae6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,4 +45,4 @@ jobs: run: cargo fmt --all -- --check - name: Docs - run: cargo doc --features docs + run: cargo doc From 6018b96087d5eb8d75bb58b9e625113da3f074c7 Mon Sep 17 00:00:00 2001 From: Mahmut Bulut Date: Sat, 5 Oct 2019 20:41:49 +0200 Subject: [PATCH 7/8] Run all tests --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30ae3ae6..42b0a81e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --all --doc + args: --all check_fmt_and_docs: name: Checking fmt and docs From 75617e37cbc746ed802fd4f55bf8db4907a9dc98 Mon Sep 17 00:00:00 2001 From: Mahmut Bulut Date: Sat, 5 Oct 2019 20:48:29 +0200 Subject: [PATCH 8/8] Fix readme appveyor build tag --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a4705257..2ec299d9 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ Build Status (Windows) - - appveyor build status + + appveyor build status