Repository navigation
83 lines (79 loc) · 2.4 KB
/
Copy pathci.yml
File metadata and controls
83 lines (79 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Flexmodel UI CI
# 可手动触发选择:只跑测试、只构建镜像、或两者都跑。
# push / PR 默认只跑测试(lint + 类型检查)。
# 镜像版本号取自 VERSION 文件:${VERSION}、${VERSION}.${run_number} 等
name: Flexmodel UI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
inputs:
run_tests:
description: "执行测试(lint + 类型检查 + E2E)"
type: boolean
default: true
run_build:
description: "执行构建并推送 Docker 镜像"
type: boolean
default: false
jobs:
ui-test:
name: UI tests (lint + type-check)
runs-on: ubuntu-latest
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.run_tests == 'true' }}
steps:
- uses: actions/checkout@v5
with:
submodules: 'recursive'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Type check
run: npx tsc --noEmit
ui-e2e:
name: UI E2E tests (Playwright)
runs-on: ubuntu-latest
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.run_tests == 'true' }}
steps:
- uses: actions/checkout@v5
with:
submodules: 'recursive'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Install dependencies
run: npm ci
- name: Install Playwright browser
run: npx playwright install --with-deps chromium
- name: Run E2E tests
env:
CI: 'true'
run: npx playwright test
- name: Upload Playwright report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 14
- name: Upload Playwright traces
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: playwright-traces
path: test-results/
retention-days: 7