From ed1169aef62cf1163f2cf1c2dc0b38bb8819fe8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C3=B6lfchen?= <115360611+W-lfchen@users.noreply.github.com> Date: Mon, 26 Aug 2024 18:18:22 +0200 Subject: [PATCH 1/4] ci: use clippy; abort run on failure --- .github/workflows/build.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 98a89a25..501ec861 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,7 @@ on: env: CARGO_TERM_COLOR: always + RUSTFLAGS: "-Dwarnings" jobs: build: @@ -31,15 +32,15 @@ jobs: - name: Check formatting run: cargo fmt -- --check - - name: Check with default features - run: cargo check - name: Run tests run: cargo test + - name: Check with default features + run: cargo clippy - name: Check x11 only - run: cargo check --no-default-features --features=x11 + run: cargo clippy --no-default-features --features=x11 - name: Check wayland only - run: cargo check --no-default-features --features=wayland + run: cargo clippy --no-default-features --features=wayland - name: Check no-backend - run: cargo check --no-default-features + run: cargo clippy --no-default-features From 8127b4e82cb59e0b20462f9940d961afa5db0dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C3=B6lfchen?= <115360611+W-lfchen@users.noreply.github.com> Date: Mon, 26 Aug 2024 18:45:29 +0200 Subject: [PATCH 2/4] fix: disable warnings when building without x11 or wayland support --- crates/eww/src/window_initiator.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/eww/src/window_initiator.rs b/crates/eww/src/window_initiator.rs index f2dc5599..28e3698b 100644 --- a/crates/eww/src/window_initiator.rs +++ b/crates/eww/src/window_initiator.rs @@ -12,15 +12,20 @@ use yuck::config::{ use crate::window_arguments::WindowArguments; /// This stores all the information required to create a window and is created -/// via combining information from the [`WindowDefinition`] and the [`WindowInitiator`] +/// via combining information from the [`WindowDefinition`] and the [`WindowInitiator`]. #[derive(Debug, Clone)] pub struct WindowInitiator { + // it would be more efficient to make everything work when not using x11 or wayland instead of simply disabling the warning. + // however, this is probably not worth the effort since i don't think anyonre is seriously building eww without backend support for either x11 or wayland + #[cfg_attr(not(any(feature = "wayland", feature = "x11")), allow(dead_code))] pub backend_options: BackendWindowOptions, pub geometry: Option, pub local_variables: HashMap, pub monitor: Option, pub name: String, + #[cfg_attr(not(any(feature = "wayland", feature = "x11")), allow(dead_code))] pub resizable: bool, + #[cfg_attr(not(any(feature = "wayland", feature = "x11")), allow(dead_code))] pub stacking: WindowStacking, } From c5570e44f89bd20198c8f98a8c27921199c27d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C3=B6lfchen?= <115360611+W-lfchen@users.noreply.github.com> Date: Wed, 28 Aug 2024 10:48:19 +0200 Subject: [PATCH 3/4] ci: don't run pages workflow on forks Co-authored-by: Josiah Hilden --- .github/workflows/gh-pages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 98858073..ab9b0f59 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -13,6 +13,7 @@ jobs: build: name: Build mdBook runs-on: ubuntu-latest + if: github.repository == 'elkowar/eww' steps: # Checkout - uses: actions/checkout@master From d4e52c4675f8c816446a9d659e9882c5c4aafe91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C3=B6lfchen?= <115360611+W-lfchen@users.noreply.github.com> Date: Wed, 28 Aug 2024 10:51:04 +0200 Subject: [PATCH 4/4] style: apply yamlfmt --- .github/workflows/build.yml | 74 +++++++++++++++------------------- .github/workflows/gh-pages.yml | 69 +++++++++++++++---------------- 2 files changed, 65 insertions(+), 78 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 501ec861..09a9b36d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,46 +1,36 @@ name: build - on: - push: - branches: [master] - pull_request: - branches: [master] - + push: + branches: [master] + pull_request: + branches: [master] env: - CARGO_TERM_COLOR: always - RUSTFLAGS: "-Dwarnings" - + CARGO_TERM_COLOR: always + RUSTFLAGS: "-Dwarnings" jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Install dependencies - run: sudo apt-get update && sudo apt-get install libgtk-3-dev libgtk-layer-shell-dev libdbusmenu-gtk3-dev - - - uses: actions/checkout@v4 - - - name: Setup rust - uses: dtolnay/rust-toolchain@stable - with: - components: clippy,rustfmt - - - name: Load rust cache - uses: Swatinem/rust-cache@v2 - - - name: Setup problem matchers - uses: r7kamura/rust-problem-matchers@v1 - - - name: Check formatting - run: cargo fmt -- --check - - - name: Run tests - run: cargo test - - - name: Check with default features - run: cargo clippy - - name: Check x11 only - run: cargo clippy --no-default-features --features=x11 - - name: Check wayland only - run: cargo clippy --no-default-features --features=wayland - - name: Check no-backend - run: cargo clippy --no-default-features + build: + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install libgtk-3-dev libgtk-layer-shell-dev libdbusmenu-gtk3-dev + - uses: actions/checkout@v4 + - name: Setup rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy,rustfmt + - name: Load rust cache + uses: Swatinem/rust-cache@v2 + - name: Setup problem matchers + uses: r7kamura/rust-problem-matchers@v1 + - name: Check formatting + run: cargo fmt -- --check + - name: Run tests + run: cargo test + - name: Check with default features + run: cargo clippy + - name: Check x11 only + run: cargo clippy --no-default-features --features=x11 + - name: Check wayland only + run: cargo clippy --no-default-features --features=wayland + - name: Check no-backend + run: cargo clippy --no-default-features diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index ab9b0f59..9dd7073a 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,39 +1,36 @@ name: Build and deploy Github pages on: - push: - branches: - - master - paths: - - "docs/**" - - "gen-docs.ts" - - "crates/eww/src/widgets/widget_definitions.rs" - - "crates/eww/src/config/inbuilt.rs" - - ".github/workflows/**" + push: + branches: + - master + paths: + - "docs/**" + - "gen-docs.ts" + - "crates/eww/src/widgets/widget_definitions.rs" + - "crates/eww/src/config/inbuilt.rs" + - ".github/workflows/**" jobs: - build: - name: Build mdBook - runs-on: ubuntu-latest - if: github.repository == 'elkowar/eww' - steps: - # Checkout - - uses: actions/checkout@master - - # Build widget documentation - - name: Use deno to build widget documentation - uses: denoland/setup-deno@main - with: - deno-version: "v1.x" - - run: deno run --allow-read --allow-write gen-docs.ts ./crates/eww/src/widgets/widget_definitions.rs ./crates/eww/src/config/inbuilt.rs - - # Build & deploy - - name: build mdBook page - uses: peaceiris/actions-mdbook@v1 - with: - mdbook-version: '0.4.8' - - run: mdbook build docs - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs/book/ + build: + name: Build mdBook + runs-on: ubuntu-latest + if: github.repository == 'elkowar/eww' + steps: + # Checkout + - uses: actions/checkout@master + # Build widget documentation + - name: Use deno to build widget documentation + uses: denoland/setup-deno@main + with: + deno-version: "v1.x" + - run: deno run --allow-read --allow-write gen-docs.ts ./crates/eww/src/widgets/widget_definitions.rs ./crates/eww/src/config/inbuilt.rs + # Build & deploy + - name: build mdBook page + uses: peaceiris/actions-mdbook@v1 + with: + mdbook-version: '0.4.8' + - run: mdbook build docs + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs/book/