mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-24 21:40:48 +02:00
177 lines
6.2 KiB
YAML
177 lines
6.2 KiB
YAML
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
name: test plugins e2e
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- v2
|
|
paths:
|
|
- '.github/workflows/test-api-e2e.yml'
|
|
- 'packages/api-e2e/**'
|
|
- 'examples/api/**'
|
|
- 'plugins/*/guest-js/**'
|
|
- 'plugins/*/src/**'
|
|
- 'plugins/*/permissions/**'
|
|
- 'plugins/*/build.rs'
|
|
pull_request:
|
|
branches:
|
|
- v2
|
|
paths:
|
|
- '.github/workflows/test-api-e2e.yml'
|
|
- 'packages/api-e2e/**'
|
|
- 'examples/api/**'
|
|
- 'plugins/*/guest-js/**'
|
|
- 'plugins/*/src/**'
|
|
- 'plugins/*/permissions/**'
|
|
- 'plugins/*/build.rs'
|
|
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
CARGO_PROFILE_DEV_DEBUG: 0 # keeps the target folder small for better cache efficiency
|
|
MSEDGEDRIVER_TOOL_REV: 8c4b34f51b45f5cf08013366d703de464ab871d1
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ${{ matrix.platform.os }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- { name: Linux, os: ubuntu-latest }
|
|
- { name: Windows, os: windows-latest }
|
|
- { name: macOS, os: macos-latest }
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: install Rust stable
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: setup node
|
|
uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 'lts/*'
|
|
- uses: pnpm/action-setup@v6
|
|
with:
|
|
cache: true # the pnpm store, keyed by OS and lockfile hash and shared by every workflow
|
|
|
|
- name: install Linux dependencies
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
libwebkit2gtk-4.1-dev \
|
|
webkit2gtk-driver \
|
|
libgtk-3-dev \
|
|
libayatana-appindicator3-dev \
|
|
librsvg2-dev \
|
|
dbus \
|
|
xvfb \
|
|
fluxbox \
|
|
desktop-file-utils \
|
|
xdg-utils
|
|
|
|
# msedgedriver has to match the installed WebView2 runtime, so msedgedriver-tool
|
|
# downloads the right version at run time. The tool itself is built from a pinned git
|
|
# revision and kept in its own small cache entry (accessed by every Windows run, so it
|
|
# stays hot) instead of being rebuilt from source on every run.
|
|
- name: restore msedgedriver-tool (Windows)
|
|
if: runner.os == 'Windows'
|
|
id: msedgedriver-tool-cache
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: ${{ runner.tool_cache }}/msedgedriver-tool
|
|
key: msedgedriver-tool-${{ runner.os }}-${{ env.MSEDGEDRIVER_TOOL_REV }}
|
|
|
|
- name: install msedgedriver-tool (Windows)
|
|
if: runner.os == 'Windows' && steps.msedgedriver-tool-cache.outputs.cache-hit != 'true'
|
|
run: cargo install --git https://github.com/chippers/msedgedriver-tool --rev ${{ env.MSEDGEDRIVER_TOOL_REV }} --locked --root ${{ runner.tool_cache }}/msedgedriver-tool
|
|
|
|
- name: install msedgedriver (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
& "${{ runner.tool_cache }}/msedgedriver-tool/bin/msedgedriver-tool.exe"
|
|
$PWD.Path >> $env:GITHUB_PATH
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: ${{ matrix.platform.os }}
|
|
# Only `v2`/`v3` write to the cache: an entry saved from a pull request lives on its
|
|
# merge ref, where nothing else can restore it, and every write evicts an entry
|
|
# that other runs would have hit (10 GB repository limit, LRU eviction).
|
|
save-if: ${{ github.ref == 'refs/heads/v2' || github.ref == 'refs/heads/v3' }}
|
|
|
|
- name: install dependencies
|
|
run: pnpm i --frozen-lockfile
|
|
|
|
- name: build plugins
|
|
run: pnpm build
|
|
|
|
- name: run e2e tests (Linux)
|
|
if: runner.os == 'Linux'
|
|
timeout-minutes: 45
|
|
# A real window manager (fluxbox) is started so that window-state tests
|
|
# (size restore) behave, and a session D-Bus so the notification and
|
|
# clipboard plugins can reach their desktop services.
|
|
env:
|
|
E2E_SPEC_RETRIES: '1'
|
|
run: |
|
|
xvfb-run --auto-servernum -- dbus-run-session -- bash -c '
|
|
fluxbox >/dev/null 2>&1 &
|
|
sleep 1
|
|
pnpm test:api-e2e
|
|
'
|
|
|
|
- name: run e2e tests (Windows)
|
|
if: runner.os == 'Windows'
|
|
timeout-minutes: 45
|
|
shell: pwsh
|
|
# msedgedriver hands the app the `--remote-debugging-port` it attaches to through
|
|
# `WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS`, and WebView2 ignores that variable in an
|
|
# elevated process, which is what the runner gives us. gsudo runs the suite at medium
|
|
# integrity instead, and the workspace is opened up so the de-elevated process can use it.
|
|
# See https://github.com/tauri-apps/wry/issues/1782 and
|
|
# https://github.com/MicrosoftEdge/WebView2Feedback/issues/5645.
|
|
env:
|
|
E2E_SPEC_RETRIES: '1'
|
|
run: |
|
|
winget install gerardog.gsudo --accept-source-agreements --accept-package-agreements
|
|
icacls "$env:GITHUB_WORKSPACE" /grant "Everyone:(OI)(CI)F"
|
|
sudo --integrity Medium pnpm test:api-e2e
|
|
|
|
- name: run e2e tests (macOS)
|
|
if: runner.os == 'macOS' && env.CN_API_KEY != ''
|
|
timeout-minutes: 45
|
|
env:
|
|
CN_API_KEY: ${{ secrets.TAURI_E2E_CN_API_KEY }}
|
|
E2E_SPEC_RETRIES: '1'
|
|
# macOS has no native WebDriver for WKWebView, so the app is driven through the
|
|
# CrabNebula Webdriver (tauri-plugin-automation + test-runner-backend), which
|
|
# authenticates with CN_API_KEY. wdio.conf enables it automatically on darwin and
|
|
# builds the `.app` bundle it needs.
|
|
run: pnpm test:api-e2e
|
|
|
|
- name: collect app crash reports (macOS)
|
|
if: runner.os == 'macOS' && failure()
|
|
run: .scripts/ci/collect-macos-crash-reports.sh "$RUNNER_TEMP/crash-reports"
|
|
|
|
- name: upload app crash reports (macOS)
|
|
if: runner.os == 'macOS' && failure()
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: macos-crash-reports
|
|
path: ${{ runner.temp }}/crash-reports
|
|
if-no-files-found: ignore
|