-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (52 loc) · 1.36 KB
/
main.yml
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
name: CI
# 触发工作流程的事件
on:
push:
branches: [master]
pull_request:
branches: [master]
# 按顺序运行作业
jobs:
npm_pub:
# 指定的运行器环境
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7.25.0
run_install: |
- recursive: false
# 执行构建步骤
- name: 构建
run: pnpm build
# 发布
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
codecov:
if: github.actor != 'dependabot[bot]'
# 指定的运行器环境
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7.25.0
run_install: |
- recursive: false
# 生成测试覆盖率
- name: Run Test Coverage
run: npx vitest --coverage
# 生成pr报告
- name: Report Coverage
if: always() # Also generate the report if tests are failing
uses: davelosert/vitest-coverage-report-action@v1
with:
vite-config-path: ./vitest.config.ts
# 上传到codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
directory: coverage
token: ${{ secrets.CODECOV_TOKEN }}