mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
184 lines
6.4 KiB
YAML
184 lines
6.4 KiB
YAML
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
name: Lint Rust
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- v1
|
|
- v2
|
|
paths:
|
|
- '.github/workflows/lint-rust.yml'
|
|
- 'plugins/*/src/**'
|
|
- '!plugins/*/src/api-iife.js'
|
|
- '**/Cargo.toml'
|
|
pull_request:
|
|
branches:
|
|
- v1
|
|
- v2
|
|
paths:
|
|
- '.github/workflows/lint-rust.yml'
|
|
- 'plugins/*/src/**'
|
|
- '!plugins/*/src/api-iife.js'
|
|
- '**/Cargo.toml'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
changes:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: read
|
|
outputs:
|
|
packages: ${{ steps.filter.outputs.changes }}
|
|
saver: ${{ steps.saver.outputs.saver }}
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: dorny/paths-filter@v2
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
tauri-plugin-autostart:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/autostart/**
|
|
tauri-plugin-cli:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/cli/**
|
|
tauri-plugin-clipboard-manager:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/clipboard-manager/**
|
|
tauri-plugin-deep-link:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/deep-link/**
|
|
tauri-plugin-dialog:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/dialog/**
|
|
- plugins/fs/**
|
|
tauri-plugin-fs:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/fs/**
|
|
tauri-plugin-geolocation:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/geolocation/**
|
|
tauri-plugin-global-shortcut:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/global-shortcut/**
|
|
tauri-plugin-opener:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/opener/**
|
|
tauri-plugin-haptics:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/haptics/**
|
|
tauri-plugin-http:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/http/**
|
|
- plugins/fs/**
|
|
tauri-plugin-localhost:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/localhost/**
|
|
tauri-plugin-log:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/log/**
|
|
tauri-plugin-notification:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/notification/**
|
|
tauri-plugin-os:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/os/**
|
|
tauri-plugin-persisted-scope:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/persisted-scope/**
|
|
- plugins/fs/**
|
|
tauri-plugin-positioner:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/positioner/**
|
|
tauri-plugin-process:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/process/**
|
|
tauri-plugin-shell:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/shell/**
|
|
tauri-plugin-single-instance:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/single-instance/**
|
|
tauri-plugin-sql:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/sql/**
|
|
tauri-plugin-store:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/store/**
|
|
tauri-plugin-stronghold:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/stronghold/**
|
|
tauri-plugin-updater:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/updater/**
|
|
tauri-plugin-upload:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/upload/**
|
|
tauri-plugin-websocket:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/websocket/**
|
|
tauri-plugin-window-state:
|
|
- .github/workflows/lint-rust.yml
|
|
- plugins/window-state/**
|
|
|
|
# Every package job for a platform restores the same rust-cache entry, and exactly one
|
|
# of them saves it (see the `save-if` of the rust-cache step). Prefer the packages whose
|
|
# dependency tree covers most of the other plugins' dependencies, so the entry is as
|
|
# useful as possible for the packages that did not save it.
|
|
- name: pick the package that saves the cache
|
|
id: saver
|
|
env:
|
|
PACKAGES: ${{ steps.filter.outputs.changes }}
|
|
run: |
|
|
saver="$(jq -rn --argjson packages "${PACKAGES:-[]}" '
|
|
["tauri-plugin-upload", "tauri-plugin-sql", "tauri-plugin-updater", "tauri-plugin-single-instance"]
|
|
| map(select(. as $p | $packages | index($p) != null))
|
|
| first // $packages[0] // empty
|
|
')"
|
|
echo "saver=$saver" >> "$GITHUB_OUTPUT"
|
|
|
|
clippy:
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.packages != '[]' && needs.changes.outputs.packages != '' }}
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
package: ${{ fromJSON(needs.changes.outputs.packages) }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: install webkit2gtk
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev
|
|
|
|
- name: Install clippy with stable toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
# One entry shared by every package job (the default key is per job, not per
|
|
# matrix entry), only written from `v2`/`v3` and by a single package job; see
|
|
# test-rust.yml for the reasoning.
|
|
save-if: ${{ (github.ref == 'refs/heads/v2' || github.ref == 'refs/heads/v3') && matrix.package == needs.changes.outputs.saver }}
|
|
|
|
- name: clippy ${{ matrix.package }}
|
|
run: cargo clippy --package ${{ matrix.package }} --all-targets -- -D warnings
|
|
|
|
- name: clippy ${{ matrix.package }} --all-features
|
|
if: matrix.package != 'tauri-plugin-dialog'
|
|
run: cargo clippy --package ${{ matrix.package }} --all-targets --all-features -- -D warnings
|