From f84fbe459f901e8affa4c9162e80a83c7d1d0bbd Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 3 Apr 2023 10:01:59 -0300 Subject: [PATCH] chore(cli): cherry pick #6603, fix webkit2gtk version --- tooling/cli/src/info/env_system.rs | 6 +-- .../plugin/.github/workflows/audit.yml | 2 +- .../plugin/.github/workflows/clippy.yml | 20 ++++----- .../plugin/.github/workflows/format.yml | 20 ++++----- .../plugin/.github/workflows/test.yml | 43 +++++++++++++++++++ 5 files changed, 65 insertions(+), 26 deletions(-) create mode 100644 tooling/cli/templates/plugin/.github/workflows/test.yml diff --git a/tooling/cli/src/info/env_system.rs b/tooling/cli/src/info/env_system.rs index 87a572166..543268930 100644 --- a/tooling/cli/src/info/env_system.rs +++ b/tooling/cli/src/info/env_system.rs @@ -125,7 +125,7 @@ fn pkg_conf_version(package: &str) -> Option { target_os = "netbsd" ))] fn webkit2gtk_ver() -> Option { - pkg_conf_version("webkit2gtk-4.0") + pkg_conf_version("webkit2gtk-4.1") } #[cfg(any( target_os = "linux", @@ -230,11 +230,11 @@ pub fn items() -> Vec { || { Some( webkit2gtk_ver() - .map(|v| (format!("webkit2gtk-4.0: {v}"), Status::Success)) + .map(|v| (format!("webkit2gtk-4.1: {v}"), Status::Success)) .unwrap_or_else(|| { ( format!( - "webkit2gtk-4.0: {}\nVisit {} to learn more about tauri prerequisites", + "webkit2gtk-4.1: {}\nVisit {} to learn more about tauri prerequisites", "not installed".red(), "https://tauri.app/v1/guides/getting-started/prerequisites".cyan() ), diff --git a/tooling/cli/templates/plugin/.github/workflows/audit.yml b/tooling/cli/templates/plugin/.github/workflows/audit.yml index 319ba10a3..352a6da28 100644 --- a/tooling/cli/templates/plugin/.github/workflows/audit.yml +++ b/tooling/cli/templates/plugin/.github/workflows/audit.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/audit-check@v1 + - uses: rustsec/audit-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} permissions: diff --git a/tooling/cli/templates/plugin/.github/workflows/clippy.yml b/tooling/cli/templates/plugin/.github/workflows/clippy.yml index 4ebd1343c..f8b742c45 100644 --- a/tooling/cli/templates/plugin/.github/workflows/clippy.yml +++ b/tooling/cli/templates/plugin/.github/workflows/clippy.yml @@ -18,20 +18,18 @@ jobs: steps: - uses: actions/checkout@v3 - - name: install webkit2gtk + + - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y webkit2gtk-4.1 + - name: Install clippy with stable toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true - components: clippy - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --manifest-path=Cargo.toml --all-targets --all-features -- -D warnings - name: clippy + components: clippy + + - uses: Swatinem/rust-cache@v2 + + - run: cargo clippy --manifest-path=Cargo.toml --all-targets --all-features -- -D warnings {{{{/raw}}}} diff --git a/tooling/cli/templates/plugin/.github/workflows/format.yml b/tooling/cli/templates/plugin/.github/workflows/format.yml index 44ba831ae..c031d6238 100644 --- a/tooling/cli/templates/plugin/.github/workflows/format.yml +++ b/tooling/cli/templates/plugin/.github/workflows/format.yml @@ -17,16 +17,14 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v3 - - name: Install rustfmt with stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - uses: actions/checkout@v3 + + - name: Install rustfmt with stable toolchain + uses: dtolnay/rust-toolchain@stable + with: components: rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --manifest-path=Cargo.toml --all -- --check + + - uses: Swatinem/rust-cache@v2 + + - run: cargo fmt --manifest-path=Cargo.toml --all -- --check {{{{/raw}}}} diff --git a/tooling/cli/templates/plugin/.github/workflows/test.yml b/tooling/cli/templates/plugin/.github/workflows/test.yml new file mode 100644 index 000000000..3b4999657 --- /dev/null +++ b/tooling/cli/templates/plugin/.github/workflows/test.yml @@ -0,0 +1,43 @@ +{{{{raw}}}} +name: Test + +on: + push: + branches: + - main + pull_request: + branches: + - main + - dev + paths-ignore: + - 'webview-src/**' + - 'webview-dist/**' + - 'examples/**' + +jobs: + build-and-test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - uses: actions/checkout@v3 + + - name: Install stable toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - name: Install Linux dependencies + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y webkit2gtk-4.1 + + - uses: Swatinem/rust-cache@v2 + + - name: Run tests + run: cargo test --manifest-path=Cargo.toml --release +{{{{/raw}}}}