name: Lint Rust on: push: branches: - v1 - v2 paths: - ".github/workflows/lint-rust.yml" - "plugins/*/src/**" - "**/Cargo.toml" pull_request: branches: - v1 - v2 paths: - ".github/workflows/lint-rust.yml" - "plugins/*/src/**" - "**/Cargo.toml" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: changes: runs-on: ubuntu-latest permissions: pull-requests: read outputs: packages: ${{ steps.filter.outputs.changes }} steps: - uses: dorny/paths-filter@v2 id: changes with: filters: .github/filters.yml clippy: needs: changes runs-on: ubuntu-latest strategy: fail-fast: false matrix: package: ${{ fromJSON(needs.changes.outputs.packages) }} steps: - uses: actions/checkout@v3 - name: install webkit2gtk and libudev for [authenticator] run: | sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libudev-dev - name: Install clippy with stable toolchain uses: dtolnay/rust-toolchain@stable with: components: clippy - uses: Swatinem/rust-cache@v2 - name: create dummy dist working-directory: examples/api run: mkdir dist - name: clippy ${{ matrix.package }} if: matrix.package != 'tauri-plugin-sql' run: cargo clippy --package ${{ matrix.package }} --all-targets -- -D warnings - name: clippy ${{ matrix.package }} --all-features if: ${{ !contains(fromJSON('["tauri-plugin-http", "tauri-plugin-upload", "tauri-plugin-updater", "tauri-plugin-webspcket", "tauri-plugin-sql"]'), matrix.package) }} run: cargo clippy --package ${{ matrix.package }} --all-targets --all-features -- -D warnings - name: clippy ${{ matrix.package }} mysql if: matrix.package == 'tauri-plugin-sql' run: cargo clippy --package ${{ matrix.package }} --all-targets --features mysql -- -D warnings - name: clippy ${{ matrix.package }} postgres if: matrix.package == 'tauri-plugin-sql' run: cargo clippy --package ${{ matrix.package }} --all-targets --features postgres -- -D warnings fmt: runs-on: ubuntu-latest strategy: fail-fast: false steps: - uses: actions/checkout@v3 - name: Install rustfmt with nightly toolchain uses: dtolnay/rust-toolchain@nightly with: components: rustfmt - name: Check formatting run: cargo fmt --all -- --check