From 865e052b07d32f109d76338411125f8572e0de81 Mon Sep 17 00:00:00 2001 From: Victor Dudochkin Date: Mon, 12 Apr 2021 11:21:20 +0700 Subject: [PATCH 1/6] Codecov and other changes --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/codecov.yml | 9 +++++ .github/workflows/audit.yaml | 17 ++++++++ .github/workflows/coverage.yaml | 49 +++++++++++++++++++++++ .github/workflows/tests.yml | 27 +++++++++++++ Cargo.toml | 10 ++--- README.md | 20 +++++---- src/barchart.rs | 4 +- src/gaugechart.rs | 4 +- src/linechart.rs | 4 +- src/piechart.rs | 4 +- src/radarchart.rs | 4 +- 13 files changed, 132 insertions(+), 24 deletions(-) create mode 100644 .github/codecov.yml create mode 100644 .github/workflows/audit.yaml create mode 100644 .github/workflows/coverage.yaml create mode 100644 .github/workflows/tests.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index af039b6..d845929 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -15,4 +15,4 @@ It would be nice to have screenshot or result image uploaded Some minimal reproduce code is highly recommended **Version Information** -Please give us what version you are using. If you are pulling `Plotters` directly from git repo, please mention this as well +Please give us what version you are using. If you are pulling `YMC` directly from git repo, please mention this as well diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index cbf5a68..6b3f659 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,6 +1,6 @@ --- name: Feature request -about: Suggest an idea to Plotter maintainers +about: Suggest an idea to YMC maintainers title: "[Feature Request]" labels: feature request assignees: '' diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000..f2cf6e4 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,9 @@ +comment: + layout: "diff, flags, files" + require_changes: true + +coverage: + status: + project: + default: + informational: true diff --git a/.github/workflows/audit.yaml b/.github/workflows/audit.yaml new file mode 100644 index 0000000..e0c79d5 --- /dev/null +++ b/.github/workflows/audit.yaml @@ -0,0 +1,17 @@ +name: Security audit +on: + pull_request: + push: + branches: + - master + schedule: + - cron: '0 0 * * 0' + +jobs: + security_audit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml new file mode 100644 index 0000000..340704c --- /dev/null +++ b/.github/workflows/coverage.yaml @@ -0,0 +1,49 @@ +name: Test coverage + +#on: +# push: +# branches: +# - main +# pull_request: + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: full + +jobs: + coverage: + name: Coverage + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + profile: minimal + default: true + + - name: Restore cache + uses: Swatinem/rust-cache@v1 + + - name: Run cargo-tarpaulin + uses: actions-rs/tarpaulin@v0.1 + with: + args: '--all-features --run-types Doctests,Tests' + timeout: 120 + + - name: Upload to codecov.io + uses: codecov/codecov-action@239febf655bba88b16ff5dea1d3135ea8663a1f9 + with: + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Archive code coverage results + uses: actions/upload-artifact@v2 + with: + name: code-coverage-report + path: cobertura.xml + retention-days: 30 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..6893c69 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,27 @@ +name: Tests + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose + + 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/Cargo.toml b/Cargo.toml index 54616ec..87676c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ maintenance = { status = "actively-developed" } [features] banner = [] button = [] -barchart = ["ux-animate", "ux-dataflow", "ux-charts", "ux-charts/web"] +barchart = ["ux-animate", "ux-dataflow", "ux-charts"] card = [] charts = ["barchart", "gaugechart", "linechart", "piechart", "radarchart"] checkbox = [] @@ -30,17 +30,17 @@ dialog = [] drawer = [] fab = [] formfield = [] -gaugechart = ["ux-animate", "ux-dataflow", "ux-charts", "ux-charts/web"] +gaugechart = ["ux-animate", "ux-dataflow", "ux-charts"] icon-button-toggle = [] icon-button = [] icon = [] image-list = [] -linechart = ["ux-animate", "ux-dataflow", "ux-charts", "ux-charts/web"] +linechart = ["ux-animate", "ux-dataflow", "ux-charts"] linear-progress = [] list = [] menu = [] -piechart = ["ux-animate", "ux-dataflow", "ux-charts", "ux-charts/web"] -radarchart = ["ux-animate", "ux-dataflow", "ux-charts", "ux-charts/web"] +piechart = ["ux-animate", "ux-dataflow", "ux-charts"] +radarchart = ["ux-animate", "ux-dataflow", "ux-charts"] radio = [] select = [] slider = [] diff --git a/README.md b/README.md index 0a410ac..edb8cf6 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ -# YEW Material Components +#
+[![](https://dudochkin-victor.github.io/assets/yew-components/logo.svg)](#top) +# YEW Material Components + [![API Docs][docrs-badge]][docrs-url] [![Crates.io][crates-badge]][crates-url] +[![Code coverage][codecov-badge]][codecov-url] +[![Tests][tests-badge]][tests-url] [![MPL-2.0 licensed][license-badge]][license-url] [![Gitter chat][gitter-badge]][gitter-url] -[![Rustc Version 1.45+][rust-badge]][rust-url] [![loc][loc-badge]][loc-url]
@@ -16,11 +20,13 @@ [crates-url]: https://crates.io/crates/ymc [license-badge]: https://img.shields.io/badge/license-MPL--2.0-blue.svg?style=flat-square [license-url]: https://github.com/angular-rust/yew-components/blob/master/LICENSE -[gitter-badge]: https://img.shields.io/gitter/room/angular_rust/angular_rust.svg?style=flat-square +[gitter-badge]: https://img.shields.io/gitter/room/angular_rust/community.svg?style=flat-square [gitter-url]: https://gitter.im/angular_rust/community -[rust-badge]: https://img.shields.io/badge/rustc-1.45-lightgrey.svg?style=flat-square -[rust-url]: https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html -[loc-badge]: https://tokei.rs/b1/github/angular-rust/yew-components?category=code +[tests-badge]: https://img.shields.io/github/workflow/status/angular-rust/yew-components/tests?label=tests&logo=github&style=flat-square +[tests-url]: https://github.com/angular-rust/yew-components/actions/workflows/tests.yml +[codecov-badge]: https://img.shields.io/codecov/c/github/angular-rust/yew-components?logo=codecov&style=flat-square&token=OWZIWBTGII +[codecov-url]: https://codecov.io/gh/angular-rust/yew-components +[loc-badge]: https://img.shields.io/tokei/lines/github/angular-rust/yew-components?style=flat-square [loc-url]: https://github.com/angular-rust/yew-components Material Design Components for the Yew framework. @@ -129,7 +135,7 @@ These components respect the theming applied to Material Design Components using We believe the wider community can create better code. The first tool for improving the community is to tell the developers about the project by giving it a star. More stars - more members. - ![Star a repo](https://dudochkin-victor.github.io/assets/star-me-wide.svg) + [![](https://dudochkin-victor.github.io/assets/star-me-wide.svg)](https://github.com/angular-rust/yew-components#top) Angular Rust is a community effort and we welcome all kinds of contributions, big or small, from developers of all backgrounds. We want the Angular Rust community to be a fun and friendly place, so please review our [Code of Conduct](CODE_OF_CONDUCT.md) to learn what behavior will not be tolerated. diff --git a/src/barchart.rs b/src/barchart.rs index 6b29e9d..1cbf152 100644 --- a/src/barchart.rs +++ b/src/barchart.rs @@ -3,7 +3,7 @@ #![allow(unused_imports)] use super::to_option; -use animate::WebCanvas; +use animate::Canvas; use charts::{BarChart as BarChartComponent, BarChartOptions, Chart}; use dataflow::*; use wasm_bindgen::prelude::*; @@ -114,7 +114,7 @@ impl Component for BarChart { chart.resize(800., 400.); - let ctx = WebCanvas::new(cr); // overhead + let ctx = Canvas::new(cr); // overhead chart.draw(&ctx); // let element = self.node_ref.cast::().unwrap(); diff --git a/src/gaugechart.rs b/src/gaugechart.rs index 83e3adc..afc131c 100644 --- a/src/gaugechart.rs +++ b/src/gaugechart.rs @@ -3,7 +3,7 @@ #![allow(unused_imports)] use super::to_option; -use animate::WebCanvas; +use animate::Canvas; use charts::{Chart, GaugeChart as GaugeChartComponent, GaugeChartOptions}; use dataflow::*; use wasm_bindgen::prelude::*; @@ -110,7 +110,7 @@ impl Component for GaugeChart { chart.resize(800., 400.); - let ctx = WebCanvas::new(cr); // overhead + let ctx = Canvas::new(cr); // overhead chart.draw(&ctx); // let element = self.node_ref.cast::().unwrap(); // if self.props.checked { diff --git a/src/linechart.rs b/src/linechart.rs index c0a2f31..384ac0f 100644 --- a/src/linechart.rs +++ b/src/linechart.rs @@ -3,7 +3,7 @@ #![allow(unused_imports)] use super::to_option; -use animate::WebCanvas; +use animate::Canvas; use charts::{Chart, LineChart as LineChartComponent, LineChartOptions}; use dataflow::*; use wasm_bindgen::prelude::*; @@ -112,7 +112,7 @@ impl Component for LineChart { chart.resize(800., 400.); - let ctx = WebCanvas::new(cr); // overhead + let ctx = Canvas::new(cr); // overhead chart.draw(&ctx); // let element = self.node_ref.cast::().unwrap(); // if self.props.checked { diff --git a/src/piechart.rs b/src/piechart.rs index 673949a..ce75250 100644 --- a/src/piechart.rs +++ b/src/piechart.rs @@ -3,7 +3,7 @@ #![allow(unused_imports)] use super::to_option; -use animate::WebCanvas; +use animate::Canvas; use charts::{Chart, PieChart as PieChartComponent, PieChartOptions}; use dataflow::*; use wasm_bindgen::prelude::*; @@ -115,7 +115,7 @@ impl Component for PieChart { chart.resize(800., 400.); - let ctx = WebCanvas::new(cr); // overhead + let ctx = Canvas::new(cr); // overhead chart.draw(&ctx); // let element = self.node_ref.cast::().unwrap(); // if self.props.checked { diff --git a/src/radarchart.rs b/src/radarchart.rs index 41826ac..3ac6524 100644 --- a/src/radarchart.rs +++ b/src/radarchart.rs @@ -3,7 +3,7 @@ #![allow(unused_imports)] use super::to_option; -use animate::WebCanvas; +use animate::Canvas; use charts::{Chart, RadarChart as RadarChartComponent, RadarChartOptions}; use dataflow::*; use wasm_bindgen::prelude::*; @@ -110,7 +110,7 @@ impl Component for RadarChart { chart.resize(800., 400.); - let ctx = WebCanvas::new(cr); // overhead + let ctx = Canvas::new(cr); // overhead chart.draw(&ctx); // let element = self.node_ref.cast::().unwrap(); // if self.props.checked { From 9785123e5548a046623975635f8a5201c7e06f00 Mon Sep 17 00:00:00 2001 From: Victor Dudochkin Date: Sat, 24 Apr 2021 05:12:50 +0700 Subject: [PATCH 2/6] UX Animate update --- .cargo/config | 5 +++++ Cargo.toml | 6 +++--- src/barchart.rs | 2 +- src/gaugechart.rs | 2 +- src/linechart.rs | 2 +- src/piechart.rs | 2 +- src/radarchart.rs | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 .cargo/config diff --git a/.cargo/config b/.cargo/config new file mode 100644 index 0000000..62c846f --- /dev/null +++ b/.cargo/config @@ -0,0 +1,5 @@ +[build] +target = "wasm32-unknown-unknown" + +[target.'cfg(target_arch = "wasm32")'] +runner = 'wasm-bindgen-test-runner' \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 87676c1..836a034 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -98,9 +98,9 @@ wee_alloc = { version = "0.4", optional = true } yew = "0.17" yew-router = "0.14" -ux-dataflow = { version = "0.1", optional = true } -ux-animate = { version = "0.1", optional = true } -ux-charts = { version = "0.1", optional = true } +ux-dataflow = { version = "0.1.1", optional = true } +ux-animate = { version = "0.1.2", optional = true } +ux-charts = { version = "0.1.2", optional = true } [dev-dependencies] wasm-bindgen-test = "0.3" diff --git a/src/barchart.rs b/src/barchart.rs index 1cbf152..d3a9b22 100644 --- a/src/barchart.rs +++ b/src/barchart.rs @@ -114,7 +114,7 @@ impl Component for BarChart { chart.resize(800., 400.); - let ctx = Canvas::new(cr); // overhead + let ctx = Canvas::new(&cr); // overhead chart.draw(&ctx); // let element = self.node_ref.cast::().unwrap(); diff --git a/src/gaugechart.rs b/src/gaugechart.rs index afc131c..24c1eb8 100644 --- a/src/gaugechart.rs +++ b/src/gaugechart.rs @@ -110,7 +110,7 @@ impl Component for GaugeChart { chart.resize(800., 400.); - let ctx = Canvas::new(cr); // overhead + let ctx = Canvas::new(&cr); // overhead chart.draw(&ctx); // let element = self.node_ref.cast::().unwrap(); // if self.props.checked { diff --git a/src/linechart.rs b/src/linechart.rs index 384ac0f..b15ea9a 100644 --- a/src/linechart.rs +++ b/src/linechart.rs @@ -112,7 +112,7 @@ impl Component for LineChart { chart.resize(800., 400.); - let ctx = Canvas::new(cr); // overhead + let ctx = Canvas::new(&cr); // overhead chart.draw(&ctx); // let element = self.node_ref.cast::().unwrap(); // if self.props.checked { diff --git a/src/piechart.rs b/src/piechart.rs index ce75250..56ae389 100644 --- a/src/piechart.rs +++ b/src/piechart.rs @@ -115,7 +115,7 @@ impl Component for PieChart { chart.resize(800., 400.); - let ctx = Canvas::new(cr); // overhead + let ctx = Canvas::new(&cr); // overhead chart.draw(&ctx); // let element = self.node_ref.cast::().unwrap(); // if self.props.checked { diff --git a/src/radarchart.rs b/src/radarchart.rs index 3ac6524..028ed6d 100644 --- a/src/radarchart.rs +++ b/src/radarchart.rs @@ -110,7 +110,7 @@ impl Component for RadarChart { chart.resize(800., 400.); - let ctx = Canvas::new(cr); // overhead + let ctx = Canvas::new(&cr); // overhead chart.draw(&ctx); // let element = self.node_ref.cast::().unwrap(); // if self.props.checked { From 86e2a693c8a9b8c87e023dde4286b700f64f0ef4 Mon Sep 17 00:00:00 2001 From: Victor Dudochkin Date: Sat, 24 Apr 2021 05:26:41 +0700 Subject: [PATCH 3/6] Workflow --- .github/workflows/coverage.yaml | 2 ++ .github/workflows/tests.yml | 34 +++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 340704c..950c0e7 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -24,6 +24,8 @@ jobs: uses: actions-rs/toolchain@v1 with: toolchain: nightly + target: wasm32-unknown-unknown + override: true profile: minimal default: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6893c69..71a5fbf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,18 +8,40 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + target: wasm32-unknown-unknown + override: true + profile: minimal + default: true + + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose clippy_check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + target: wasm32-unknown-unknown + override: true + profile: minimal + default: true + - run: rustup component add clippy - uses: actions-rs/clippy-check@v1 with: From 1af393c34ee60853e0f03a5ddfbdaa8f92a4ebed Mon Sep 17 00:00:00 2001 From: Victor Dudochkin Date: Sat, 24 Apr 2021 06:23:52 +0700 Subject: [PATCH 4/6] Regression change --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 836a034..14d25a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,7 +99,7 @@ yew = "0.17" yew-router = "0.14" ux-dataflow = { version = "0.1.1", optional = true } -ux-animate = { version = "0.1.2", optional = true } +ux-animate = { version = "0.1.3", optional = true } ux-charts = { version = "0.1.2", optional = true } [dev-dependencies] From 800a3462b415b169979201850feeb06bc9190ab6 Mon Sep 17 00:00:00 2001 From: Victor Dudochkin Date: Sat, 24 Apr 2021 06:33:47 +0700 Subject: [PATCH 5/6] Test Runner --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 71a5fbf..607f583 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,6 +22,8 @@ jobs: - name: Build run: cargo build --verbose + - name: Install test runner + run: cargo install wasm-bindgen-cli - name: Run tests run: cargo test --verbose From 9ca4fe6893301a15d05fc181f38984f1bd3fd92a Mon Sep 17 00:00:00 2001 From: Victor Dudochkin Date: Sat, 24 Apr 2021 06:42:19 +0700 Subject: [PATCH 6/6] Facade --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index edb8cf6..cf1f0a7 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ [license-url]: https://github.com/angular-rust/yew-components/blob/master/LICENSE [gitter-badge]: https://img.shields.io/gitter/room/angular_rust/community.svg?style=flat-square [gitter-url]: https://gitter.im/angular_rust/community -[tests-badge]: https://img.shields.io/github/workflow/status/angular-rust/yew-components/tests?label=tests&logo=github&style=flat-square +[tests-badge]: https://img.shields.io/github/workflow/status/angular-rust/yew-components/Tests?label=tests&logo=github&style=flat-square [tests-url]: https://github.com/angular-rust/yew-components/actions/workflows/tests.yml [codecov-badge]: https://img.shields.io/codecov/c/github/angular-rust/yew-components?logo=codecov&style=flat-square&token=OWZIWBTGII [codecov-url]: https://codecov.io/gh/angular-rust/yew-components