super-productivity/.github/workflows/plugin-tests.yml
Johannes Millan 33b91716b1
test: close critical E2E and CI coverage gaps (#9274)
* test(worklog): verify archived duration corrections persist

* ci(android): run JVM tests on pull requests

Run the Play and F-Droid debug JVM suites for Android-affecting changes while keeping a stable required-check status on unrelated PRs.\n\nCloses #8734

* test(supersync): run repair causality integration test

Include the PostgreSQL repair-causality regression in the CI integration script's explicit test list.\n\nCloses #8773

* ci(sync): close provider E2E path gaps

Select both real-provider suites for every persistent action owner and the client clock, date, and replay guards. Mirror the same coverage on master and release pushes.\n\nRefs #8733\nRefs #9262

* ci(android): run instrumentation tests on emulator

Use the AndroidX test runner and execute the Play debug instrumentation suite on an API 35 emulator for Android-affecting pull requests. This gates the on-device CursorWindow data-loss regression.\n\nRefs #8401\nRefs #9262

* ci(shared-schema): run package tests

* ci(plugins): discover test suites from manifests

Closes #8733

* test(boards): verify board creation persists

* test(migration): require legacy error recovery flow

* test(navigation): remove redundant route smoke

* test(keyboard): verify default shortcut behavior

* test(migration): verify error acknowledgement cleanup

* test(worklog): verify corrected time CSV export

* test(keyboard): verify remapped shortcut persistence

* test(recurring): verify occurrence and series removal

* test(mobile): add WebKit touch smoke

* test(pwa): verify persisted offline reload

* test(pwa): verify update activation

* test(performance): verify large-list row reuse

* test(webdav): cover split migration recovery

Exercise a real v2-to-v3 migration through WebDAV when the primary tombstone commits but its response is lost. Verify restart recovery, backup neutralization, pending-data survival, and the split-disabled no-write guard.
2026-07-24 10:57:29 +02:00

122 lines
4.6 KiB
YAML

name: Plugin Tests
on:
pull_request:
branches:
- master
- main
paths:
- 'packages/plugin-dev/**'
- 'packages/plugin-api/**'
- 'packages/vite-plugin/**'
- '.github/workflows/plugin-tests.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
detect-changes:
name: Detect plugin changes
runs-on: ubuntu-latest
outputs:
plugins: ${{ steps.detect.outputs.plugins }}
has-changes: ${{ steps.detect.outputs.has-changes }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
with:
persist-credentials: false
fetch-depth: 0
- id: detect
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
EVENT_NAME: ${{ github.event_name }}
run: |
set -euo pipefail
# Derive runnable suites from package manifests so new plugin tests
# cannot be omitted from CI.
PACKAGE_JSONS=(packages/plugin-dev/*/package.json)
jq empty "${PACKAGE_JSONS[@]}"
mapfile -t PLUGINS < <(
for package_json in "${PACKAGE_JSONS[@]}"; do
if jq -e '.scripts.test? | type == "string" and length > 0' "$package_json" > /dev/null; then
plugin_dir="${package_json%/package.json}"
printf '%s\n' "${plugin_dir##*/}"
fi
done
)
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
CHANGED=$(printf '%s\n' "${PLUGINS[@]}")
else
# Three-dot: changes on the PR branch only, ignoring commits that
# landed on master after the PR forked.
DIFF=$(git diff --name-only --no-renames "$BASE_SHA...$HEAD_SHA")
# Shared package or workflow change → run every plugin's tests.
if grep -qE '^packages/(plugin-api|vite-plugin)/|^\.github/workflows/plugin-tests\.yml$' <<< "$DIFF"; then
CHANGED=$(printf '%s\n' "${PLUGINS[@]}")
else
CHANGED=""
for p in "${PLUGINS[@]}"; do
if grep -q "^packages/plugin-dev/$p/" <<< "$DIFF"; then
CHANGED="${CHANGED}${p}"$'\n'
fi
done
fi
fi
JSON=$(printf '%s' "$CHANGED" | awk 'NF' | jq -R . | jq -sc .)
echo "Plugins to test: $JSON"
echo "plugins=$JSON" >> "$GITHUB_OUTPUT"
if [ "$JSON" = "[]" ]; then
echo 'has-changes=false' >> "$GITHUB_OUTPUT"
else
echo 'has-changes=true' >> "$GITHUB_OUTPUT"
fi
test:
name: Test ${{ matrix.plugin }}
needs: detect-changes
if: needs.detect-changes.outputs.has-changes == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
plugin: ${{ fromJson(needs.detect-changes.outputs.plugins) }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with:
node-version: 22
# work around for npm installs from git+https://github.com/johannesjo/J2M.git
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://git@github.com/
- name: Get npm cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node22-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node22-
# Mirror ci.yml: use `npm i` here, not `npm ci`. The root lockfile uses
# an `overrides.app-builder-lib.minimatch` pin that npm 10 (bundled with
# Node 22) considers out-of-sync, while npm 11 accepts it. `npm i`
# tolerates the drift without altering the lockfile on disk.
- name: Install root dependencies
run: npm i
# Plugins consume @super-productivity/plugin-api and vite-plugin via file:
# references that resolve to dist/. Build those before running plugin tests.
- name: Build shared packages
run: npm run build:packages
- name: Install plugin dependencies
working-directory: packages/plugin-dev/${{ matrix.plugin }}
run: npm ci
- name: Run plugin tests
working-directory: packages/plugin-dev/${{ matrix.plugin }}
run: npm test