test: add electron test (#1840)

This commit is contained in:
Himself65
2023-04-24 18:53:36 -05:00
committed by GitHub
parent 9c94d05dd8
commit d3ce90e721
18 changed files with 212 additions and 33 deletions

View File

@@ -17,16 +17,6 @@ jobs:
uses: ./.github/actions/setup-node
- run: yarn lint --max-warnings=0
install-all:
name: Install All Dependencies
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v3
- name: Install All Dependencies
uses: ./.github/actions/setup-node
build-storybook:
name: Build Storybook
runs-on: ubuntu-latest
@@ -44,6 +34,23 @@ jobs:
path: ./packages/component/storybook-static
if-no-files-found: error
build-electron:
name: Build @affine/electron
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Build Electron
working-directory: apps/electron
run: yarn exec ts-node-esm ./scripts/build-ci.mts
- name: Upload Ubuntu desktop artifact
uses: actions/upload-artifact@v3
with:
name: affine-ubuntu
path: ./apps/electron/dist
build:
name: Build @affine/web
runs-on: ubuntu-latest
@@ -230,6 +237,48 @@ jobs:
path: ./test-results
if-no-files-found: ignore
dekstop-test:
name: Desktop Test
runs-on: ubuntu-latest
environment: development
needs: [build, build-electron]
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
playwright-install: true
- name: Download Ubuntu desktop artifact
uses: actions/download-artifact@v3
with:
name: affine-ubuntu
path: ./apps/electron/dist
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: next-js
path: ./apps/web/.next
- name: Generate static files
run: yarn export
working-directory: ./apps/web
- name: Move static files to electron
run: mv ./apps/web/out ./apps/electron/resources/web-static
- name: Run desktop tests
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test
working-directory: apps/electron
- name: Upload test results
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: test-results-e2e-${{ matrix.shard }}
path: ./test-results
if-no-files-found: ignore
unit-test:
name: Unit Test
runs-on: ubuntu-latest