| |
| |
| |
|
|
| name: Test Rust |
|
|
| on: |
| push: |
| branches: |
| - v1 |
| - v2 |
| paths: |
| - '.github/workflows/test-rust.yml' |
| - 'plugins/*/src/**' |
| - '!plugins/*/src/api-iife.js' |
| - '**/Cargo.toml' |
| - '**/Cargo.lock' |
| pull_request: |
| branches: |
| - v1 |
| - v2 |
| paths: |
| - '.github/workflows/test-rust.yml' |
| - 'plugins/*/src/**' |
| - '!plugins/*/src/api-iife.js' |
| - '**/Cargo.toml' |
| - '**/Cargo.lock' |
|
|
| 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: actions/checkout@v4 |
| - uses: dorny/paths-filter@v2 |
| id: filter |
| with: |
| base: v2 |
| filters: | |
| tauri-plugin-autostart: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/autostart/** |
| tauri-plugin-cli: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/cli/** |
| tauri-plugin-clipboard-manager: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/clipboard-manager/** |
| tauri-plugin-deep-link: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/deep-link/** |
| tauri-plugin-dialog: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/dialog/** |
| - plugins/fs/** |
| tauri-plugin-fs: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/fs/** |
| tauri-plugin-geolocation: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/geolocation/** |
| tauri-plugin-global-shortcut: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/global-shortcut/** |
| tauri-plugin-opener: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/opener/** |
| tauri-plugin-haptics: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/haptics/** |
| tauri-plugin-http: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/http/** |
| - plugins/fs/** |
| tauri-plugin-localhost: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/localhost/** |
| tauri-plugin-log: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/log/** |
| tauri-plugin-notification: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/notification/** |
| tauri-plugin-os: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/os/** |
| tauri-plugin-persisted-scope: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/persisted-scope/** |
| - plugins/fs/** |
| tauri-plugin-positioner: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/positioner/** |
| tauri-plugin-process: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/process/** |
| tauri-plugin-shell: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/shell/** |
| tauri-plugin-single-instance: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/single-instance/** |
| tauri-plugin-sql: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/sql/** |
| tauri-plugin-store: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/store/** |
| tauri-plugin-stronghold: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/stronghold/** |
| tauri-plugin-updater: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/updater/** |
| tauri-plugin-upload: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/upload/** |
| tauri-plugin-websocket: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/websocket/** |
| tauri-plugin-window-state: |
| - .github/workflows/test-rust.yml |
| - Cargo.toml |
| - Cargo.lock |
| - plugins/window-state/** |
| |
| test: |
| needs: changes |
| if: ${{ needs.changes.outputs.packages != '[]' && needs.changes.outputs.packages != '' }} |
| strategy: |
| fail-fast: false |
| matrix: |
| package: ${{ fromJSON(needs.changes.outputs.packages) }} |
| platform: |
| - { |
| target: x86_64-pc-windows-msvc, |
| os: windows-latest, |
| runner: 'cargo', |
| command: 'test' |
| } |
| - { |
| target: x86_64-unknown-linux-gnu, |
| os: ubuntu-22.04, |
| runner: 'cargo', |
| command: 'test' |
| } |
| - { |
| target: aarch64-apple-darwin, |
| os: macos-latest, |
| runner: 'cargo', |
| command: 'test' |
| } |
| - { |
| target: aarch64-apple-ios, |
| os: macos-latest, |
| runner: 'cargo', |
| command: 'build' |
| } |
| - { |
| target: aarch64-linux-android, |
| os: ubuntu-latest, |
| runner: 'cross', |
| command: 'build' |
| } |
|
|
| runs-on: ${{ matrix.platform.os }} |
|
|
| steps: |
| - uses: actions/checkout@v4 |
|
|
| - name: install webkit2gtk |
| if: contains(matrix.platform.target, 'unknown-linux') |
| run: | |
| sudo apt-get update |
| sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev |
| |
| - uses: dtolnay/rust-toolchain@1.77.2 |
| with: |
| targets: ${{ matrix.platform.target }} |
|
|
| - uses: Swatinem/rust-cache@v2 |
| with: |
| key: cache-${{ matrix.package }}-${{ matrix.platform.target }} |
|
|
| - name: install cross |
| if: ${{ matrix.platform.runner == 'cross' }} |
| run: cargo +stable install cross --git https://github.com/cross-rs/cross |
|
|
| - name: test ${{ matrix.package }} |
| if: ${{ matrix.package != 'tauri-plugin-http' && matrix.package != 'tauri-plugin-dialog' }} |
| run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --all-features |
|
|
| - name: test ${{ matrix.package }} |
| if: ${{ matrix.package == 'tauri-plugin-http' || matrix.package == 'tauri-plugin-dialog' }} |
| run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets |
|
|