Skip to content

Commit 6d8dbc9

Browse files
committed
feat: Electron重构完成 (#2)
2 parents f9292b3 + 9edd42b commit 6d8dbc9

File tree

249 files changed

+117732
-17035
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

249 files changed

+117732
-17035
lines changed

.github/workflows/docker.yml

Lines changed: 10 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,17 @@
1-
name: Docker Build & Push
1+
name: Docker Build
2+
3+
# Electron 应用不需要 Docker 构建,此工作流保留用于文档目的
4+
# 如需 Docker 支持,可考虑使用 docker-electron 方案
25

36
on:
4-
push:
5-
branches:
6-
- main
7-
tags:
8-
- 'v*'
9-
paths:
10-
- 'src/**'
11-
- 'frontend/**'
12-
- 'static/**'
13-
- 'Dockerfile'
14-
- 'docker-compose.yml'
15-
- '.github/workflows/docker.yml'
16-
pull_request:
17-
branches:
18-
- main
19-
paths:
20-
- 'src/**'
21-
- 'frontend/**'
22-
- 'Dockerfile'
237
workflow_dispatch:
24-
inputs:
25-
push_image:
26-
description: 'Push image to registry'
27-
required: false
28-
default: 'false'
29-
type: boolean
30-
31-
env:
32-
REGISTRY: ghcr.io
33-
IMAGE_NAME: ${{ github.repository }}
348

359
jobs:
36-
build:
10+
docker-info:
11+
name: Docker Info
3712
runs-on: ubuntu-latest
38-
permissions:
39-
contents: read
40-
packages: write
41-
4213
steps:
43-
- name: Checkout repository
44-
uses: actions/checkout@v4
45-
46-
- name: Set up QEMU
47-
uses: docker/setup-qemu-action@v3
48-
49-
- name: Set up Docker Buildx
50-
uses: docker/setup-buildx-action@v3
51-
52-
- name: Log in to Container Registry
53-
if: github.event_name != 'pull_request'
54-
uses: docker/login-action@v3
55-
with:
56-
registry: ${{ env.REGISTRY }}
57-
username: ${{ github.actor }}
58-
password: ${{ secrets.GITHUB_TOKEN }}
59-
60-
- name: Extract metadata (tags, labels) for Docker
61-
id: meta
62-
uses: docker/metadata-action@v5
63-
with:
64-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
65-
tags: |
66-
# latest tag for main branch
67-
type=raw,value=latest,enable={{is_default_branch}}
68-
# version tag for releases
69-
type=semver,pattern={{version}}
70-
type=semver,pattern={{major}}.{{minor}}
71-
type=semver,pattern={{major}}
72-
# sha tag for all builds
73-
type=sha,prefix=
74-
75-
- name: Build and push Docker image
76-
id: build-push
77-
uses: docker/build-push-action@v5
78-
with:
79-
context: .
80-
platforms: linux/amd64,linux/arm64
81-
push: ${{ github.event_name != 'pull_request' || github.event.inputs.push_image == 'true' }}
82-
tags: ${{ steps.meta.outputs.tags }}
83-
labels: ${{ steps.meta.outputs.labels }}
84-
cache-from: type=gha
85-
cache-to: type=gha,mode=max
14+
- name: Info
15+
run: |
16+
echo "Electron 应用不需要 Docker 构建"
17+
echo "使用 electron-builder 直接构建各平台应用"
Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,63 @@
1-
name: Integration Tests
2-
3-
# 真实集成测试,依赖网络和 GitHub API
4-
# 定时运行 + 手动触发,不阻塞发布流程
1+
name: Integration Test
52

3+
# E2E 集成测试
64
on:
7-
schedule:
8-
- cron: '0 0 * * 0' # 每周日 00:00 运行
9-
workflow_dispatch: # 手动触发
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
9+
- master
10+
- feature/*
11+
paths:
12+
- 'src/**'
13+
- 'e2e/**'
14+
- 'package.json'
15+
pull_request:
16+
branches:
17+
- main
18+
- master
19+
paths:
20+
- 'src/**'
21+
- 'e2e/**'
22+
- 'package.json'
23+
24+
env:
25+
NODE_VERSION: '20'
1026

1127
jobs:
12-
integration-test:
13-
name: Run integration tests
28+
e2e-test:
29+
name: E2E Tests
1430
runs-on: ubuntu-latest
15-
timeout-minutes: 30
16-
1731
steps:
1832
- uses: actions/checkout@v4
1933

20-
- name: Set up Python
21-
uses: actions/setup-python@v5
34+
- name: Set up Node.js
35+
uses: actions/setup-node@v4
2236
with:
23-
python-version: '3.11'
24-
cache: 'pip'
37+
node-version: ${{ env.NODE_VERSION }}
38+
cache: 'npm'
2539

2640
- name: Install dependencies
27-
run: |
28-
python -m pip install --upgrade pip
29-
pip install -e ".[dev]"
41+
run: npm install --force
42+
43+
- name: Install Playwright
44+
run: npx playwright install --with-deps
3045

31-
- name: Run integration tests
32-
run: |
33-
pytest tests/ -v -m integration --tb=short
46+
- name: Build application
47+
run: npm run build:fast
3448
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Run E2E tests
52+
run: npx playwright test
53+
54+
- name: Upload test results
55+
if: always()
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: e2e-test-results
59+
path: |
60+
test-results/
61+
playwright-report/
62+
e2e-report/
63+
retention-days: 7

0 commit comments

Comments
 (0)