mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-01-18 23:31:31 -08:00
81 lines
2.1 KiB
YAML
81 lines
2.1 KiB
YAML
name: Test
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: lts/*
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 'latest'
|
|
run_install: false
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
**/node_modules
|
|
~/.pnpm-store
|
|
~/.npm
|
|
key: test-${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
test-${{ runner.os }}-node-
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Run linting
|
|
run: pnpm run lint
|
|
continue-on-error: true
|
|
|
|
- name: Run unit tests
|
|
run: pnpm run test:unit
|
|
|
|
- name: Build plugins
|
|
run: pnpm run build:plugin
|
|
|
|
- name: Package for testing
|
|
run: pnpm run package
|
|
|
|
# Install minimal Linux dependencies for Electron GUI testing https://www.electronjs.org/docs/latest/tutorial/testing-on-headless-ci
|
|
- name: Install Linux GUI dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y xvfb
|
|
|
|
- name: Run e2e tests
|
|
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" pnpm run test:e2e
|
|
env:
|
|
CI: true
|
|
DISPLAY: :99
|
|
timeout-minutes: 15
|
|
|
|
# Upload test artifacts (screenshots, logs)
|
|
- name: Upload test artifacts
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: test-artifacts
|
|
path: |
|
|
logs/
|
|
cucumber-report.json
|
|
retention-days: 7
|
|
|
|
# Upload application logs
|
|
- name: Upload application logs
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: application-logs
|
|
path: |
|
|
~/.local/share/TidGi/
|
|
userData-dev/logs/
|
|
retention-days: 7
|
|
continue-on-error: true
|