From 5c47849875ffda0e10a85130d74440177a56124e Mon Sep 17 00:00:00 2001 From: Cyrix126 Date: Fri, 7 Jun 2024 10:52:32 +0200 Subject: [PATCH 1/5] feat: add CI for audit,fmt,test separated from build --- .github/workflows/audit.yml | 34 +++++++++++++++++++++++++++ .github/workflows/ci.yml | 2 -- .github/workflows/rust.yml | 47 +++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/audit.yml create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 0000000..ce0f227 --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,34 @@ +# This runs `cargo audit` on all dependencies (only if Cargo deps changed) + +name: Audit + +on: + push: + paths: + - '**/Cargo.toml' + - '**/Cargo.lock' + +env: + CARGO_TERM_COLOR: always + +jobs: + audit: + + runs-on: ubuntu-latest + + steps: + - name: Cache + uses: actions/cache@v3.2.3 + with: + path: | + ~/.cargo + target + key: audit + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install dependencies + run: cargo install cargo-audit --locked + - name: Audit + run: cargo audit + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24690b8..7ad6c4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,8 +44,6 @@ jobs: fi shell: bash - - name: Test - run: cargo test --release - name: Build run: | diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..347096c --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,47 @@ +name: Rust + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + fmt: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Format + run: cargo fmt --all --check + - name: Test + run: cargo test + # Run typo checker separately. + # This will fast-cancel other CI early if this fails. + typo: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Spell Check + uses: crate-ci/typos@master + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest] + steps: + - uses: actions/checkout@v4 + - name: Clippy (fail on warnings) + run: cargo clippy --workspace --all-features --all-targets -- -D warnings + - name: Check compilation + run: cargo check --all-features --verbose + - name: Tests + run: cargo test --all-features + - name: Documentation + run: cargo doc --workspace --all-features --no-deps From cb6c49d189a3dc72e26299832f62bf5d6a2a90de Mon Sep 17 00:00:00 2001 From: Cyrix126 Date: Fri, 7 Jun 2024 10:57:46 +0200 Subject: [PATCH 2/5] fix: run test only once --- .github/workflows/rust.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 347096c..c7fd509 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,8 +19,14 @@ jobs: submodules: recursive - name: Format run: cargo fmt --all --check + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest] + steps: - name: Test - run: cargo test + run: cargo test --all-features # Run typo checker separately. # This will fast-cancel other CI early if this fails. typo: @@ -38,10 +44,8 @@ jobs: steps: - uses: actions/checkout@v4 - name: Clippy (fail on warnings) - run: cargo clippy --workspace --all-features --all-targets -- -D warnings + run: cargo clippy --all-features --all-targets -- -D warnings - name: Check compilation run: cargo check --all-features --verbose - - name: Tests - run: cargo test --all-features - name: Documentation run: cargo doc --workspace --all-features --no-deps From b470a00f31540ed813e58056e78526111c48a3ed Mon Sep 17 00:00:00 2001 From: Cyrix126 Date: Fri, 7 Jun 2024 11:05:05 +0200 Subject: [PATCH 3/5] run checks in different CI --- .github/workflows/rust.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c7fd509..8ba0228 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -25,10 +25,9 @@ jobs: matrix: os: [macos-latest, ubuntu-latest] steps: + - uses: actions/checkout@v4 - name: Test run: cargo test --all-features - # Run typo checker separately. - # This will fast-cancel other CI early if this fails. typo: runs-on: ubuntu-latest steps: @@ -36,7 +35,7 @@ jobs: uses: actions/checkout@v4 - name: Spell Check uses: crate-ci/typos@master - build: + clippy: runs-on: ${{ matrix.os }} strategy: matrix: @@ -44,8 +43,22 @@ jobs: steps: - uses: actions/checkout@v4 - name: Clippy (fail on warnings) - run: cargo clippy --all-features --all-targets -- -D warnings + run: cargo clippy --all-features -- -D warnings + check: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest] + steps: + - uses: actions/checkout@v4 - name: Check compilation run: cargo check --all-features --verbose + doc: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest] + steps: + - uses: actions/checkout@v4 - name: Documentation - run: cargo doc --workspace --all-features --no-deps + run: cargo doc --all-features --no-deps From 160d0314d9c2f43e7e891d88b9638716c2fea3fe Mon Sep 17 00:00:00 2001 From: Cyrix126 Date: Fri, 7 Jun 2024 11:37:32 +0200 Subject: [PATCH 4/5] fix: do not check features --- .github/workflows/rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8ba0228..f758271 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,7 +27,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Test - run: cargo test --all-features + run: cargo test typo: runs-on: ubuntu-latest steps: @@ -43,7 +43,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Clippy (fail on warnings) - run: cargo clippy --all-features -- -D warnings + run: cargo clippy -- -D warnings check: runs-on: ${{ matrix.os }} strategy: @@ -52,7 +52,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Check compilation - run: cargo check --all-features --verbose + run: cargo check --verbose doc: runs-on: ${{ matrix.os }} strategy: @@ -61,4 +61,4 @@ jobs: steps: - uses: actions/checkout@v4 - name: Documentation - run: cargo doc --all-features --no-deps + run: cargo doc --no-deps From edcf87b0b1ddc0c72bd1d9b3bbc8a4c631f6beb3 Mon Sep 17 00:00:00 2001 From: Cyrix126 Date: Fri, 7 Jun 2024 11:40:54 +0200 Subject: [PATCH 5/5] fix: clippy warning --- src/app/panels/middle/xmrig.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/panels/middle/xmrig.rs b/src/app/panels/middle/xmrig.rs index 00e1356..239bcbf 100644 --- a/src/app/panels/middle/xmrig.rs +++ b/src/app/panels/middle/xmrig.rs @@ -175,7 +175,7 @@ impl Xmrig { ui.horizontal(|ui| { ui.add_sized( [text_width, text_edit], - Label::new(format!("Pause on active [0-255]:")), + Label::new("Pause on active [0-255]:".to_string()), ); ui.add_sized([width, text_edit], Slider::new(&mut self.pause, 0..=255)) .on_hover_text(format!("{} [{}] seconds.", XMRIG_PAUSE, self.pause));