Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

ci: test coverage reporting (#407)

白熱9c20ea17d31e
diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml
new file mode 100644
index 0000000000..5826421cc3
--- /dev/null
+++ b/.github/workflows/ci-lint.yml
@@ -0,0 +1,64 @@
+name: 🩺 CI Lint
+
+on:
+ push:
+ branches: [main, dev]
+ pull_request:
+ branches: [main, dev]
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ env:
+ TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
+ TURBO_TEAM: ${{ vars.TURBO_TEAM }}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Install Node.js
+ uses: actions/setup-node@v3
+ with:
+ node-version: 16
+
+ - name: Install pnpm
+ uses: pnpm/action-setup@v2
+ with:
+ version: 8
+ run_install: false
+
+ - name: Get pnpm store directory
+ shell: bash
+ run: |
+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
+
+ - name: Setup pnpm cache
+ uses: actions/cache@v3
+ with:
+ path: ${{ env.STORE_PATH }}
+ key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
+ restore-keys: |
+ ${{ runner.os }}-pnpm-store-
+
+ - name: Setup ESLint cache
+ uses: actions/cache@v3
+ with:
+ path: .eslintcache
+ key: |
+ ${{ runner.os }}-eslint-${{ hashFiles('.eslintrc.cjs') }}
+ restore-keys: |
+ ${{ runner.os }}-eslint-
+
+ - name: Install dependencies
+ run: pnpm install
+
+ - name: 🧼 Type checking
+ run: npx tsc --noEmit
+
+ - name: 🌡️ Run ESLint
+ run: pnpm run lint
diff --git a/.github/workflows/ci-preview.yml b/.github/workflows/ci-preview.yml
index a5ab58e9ff..b2501f813e 100644
--- a/.github/workflows/ci-preview.yml
+++ b/.github/workflows/ci-preview.yml
@@ -1,115 +1,115 @@
name: 📦 CI Preview
on:
- pull_request:
- branches: [main, dev]
+ pull_request:
+ branches: [main, dev]
permissions:
- contents: read
- pull-requests: write
+ contents: read
+ pull-requests: write
jobs:
- build:
- if: github.repository == 'dream-num/univer'
- runs-on: ubuntu-latest
-
- env:
- TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
- TURBO_TEAM: ${{ vars.TURBO_TEAM }}
-
- steps:
- - name: Checkout
- uses: actions/checkout@v3
-
- - name: Install Node.js
- uses: actions/setup-node@v3
- with:
- node-version: 16
-
- - name: Install pnpm
- uses: pnpm/action-setup@v2
- with:
- version: 8
- run_install: false
-
- - name: Get pnpm store directory
- shell: bash
- run: |
- echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
-
- - name: Setup pnpm cache
- uses: actions/cache@v3
- with:
- path: ${{ env.STORE_PATH }}
- key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
- restore-keys: |
- ${{ runner.os }}-pnpm-store-
-
- - name: Install dependencies
- run: pnpm install
-
- - name: 📦 Build
- run: pnpm run build
-
- - name: 📦 Build demo
- run: pnpm run build:demo
-
- - name: 🚀 Deploy to Vercel
- uses: amondnet/vercel-action@v25
- id: vercel-action
- with:
- vercel-token: ${{ secrets.VERCEL_TOKEN }}
- vercel-org-id: ${{ secrets.ORG_ID}}
- vercel-project-id: ${{ secrets.PROJECT_ID}}
-
- - name: 👾 Discord Notification
- uses: sarisia/actions-status-discord@v1
- if: ${{ success() }}
- with:
- webhook: ${{ secrets.DISCORD_WEBHOOK }}
- status: ${{ job.status }}
- description: |
- CI Pipeline: Success 🏆
- **[View Deployment]**
- - [Doc](${{ steps.vercel-action.outputs.preview-url }}/doc/)
- - [Sheet](${{ steps.vercel-action.outputs.preview-url }}/sheet/)
- - [Slide](${{ steps.vercel-action.outputs.preview-url }}/slide/)
- nofail: false
- nodetail: false
- color: 0x00b894
- username: GitHub Actions
-
- - name: 👾 Discord Notification
- uses: sarisia/actions-status-discord@v1
- if: ${{ failure() }}
- with:
- webhook: ${{ secrets.DISCORD_WEBHOOK }}
- status: ${{ job.status }}
- description: |
- CI Pipeline: Unsuccessful 📛
- **[View PR]**
- [click here](${{ github.event.pull_request.html_url }})
- nofail: false
- nodetail: false
- color: 0xd63031
- username: GitHub Actions
-
- - name: 🧽 Find And Delete Comment
- uses: peter-evans/find-comment@v2
- id: fc
- with:
- issue-number: ${{ github.event.pull_request.number }}
- comment-author: 'github-actions[bot]'
- body-includes: View Deployment
-
- - name: 📝 Create or update comment
- uses: peter-evans/create-or-update-comment@v3
- with:
- comment-id: ${{ steps.fc.outputs.comment-id }}
- issue-number: ${{ github.event.pull_request.number }}
- body: |
- **[View Deployment]**
- - [📝 Doc](${{ steps.vercel-action.outputs.preview-url }}/doc/)
- - [📊 Sheet](${{ steps.vercel-action.outputs.preview-url }}/sheet/)
- - [📽️ Slide](${{ steps.vercel-action.outputs.preview-url }}/slide/)
- edit-mode: replace
+ build:
+ if: github.repository == 'dream-num/univer'
+ runs-on: ubuntu-latest
+
+ env:
+ TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
+ TURBO_TEAM: ${{ vars.TURBO_TEAM }}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Install Node.js
+ uses: actions/setup-node@v3
+ with:
+ node-version: 16
+
+ - name: Install pnpm
+ uses: pnpm/action-setup@v2
+ with:
+ version: 8
+ run_install: false
+
+ - name: Get pnpm store directory
+ shell: bash
+ run: |
+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
+
+ - name: Setup pnpm cache
+ uses: actions/cache@v3
+ with:
+ path: ${{ env.STORE_PATH }}
+ key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
+ restore-keys: |
+ ${{ runner.os }}-pnpm-store-
+
+ - name: Install dependencies
+ run: pnpm install
+
+ - name: 📦 Build
+ run: pnpm run build
+
+ - name: 📦 Build demo
+ run: pnpm run build:demo
+
+ - name: 🚀 Deploy to Vercel
+ uses: amondnet/vercel-action@v25
+ id: vercel-action
+ with:
+ vercel-token: ${{ secrets.VERCEL_TOKEN }}
+ vercel-org-id: ${{ secrets.ORG_ID}}
+ vercel-project-id: ${{ secrets.PROJECT_ID}}
+
+ - name: 👾 Discord Notification
+ uses: sarisia/actions-status-discord@v1
+ if: ${{ success() }}
+ with:
+ webhook: ${{ secrets.DISCORD_WEBHOOK }}
+ status: ${{ job.status }}
+ description: |
+ CI Pipeline: Success 🏆
+ **[View Deployment]**
+ - [Doc](${{ steps.vercel-action.outputs.preview-url }}/doc/)
+ - [Sheet](${{ steps.vercel-action.outputs.preview-url }}/sheet/)
+ - [Slide](${{ steps.vercel-action.outputs.preview-url }}/slide/)
+ nofail: false
+ nodetail: false
+ color: 0x00b894
+ username: GitHub Actions
+
+ - name: 👾 Discord Notification
+ uses: sarisia/actions-status-discord@v1
+ if: ${{ failure() }}
+ with:
+ webhook: ${{ secrets.DISCORD_WEBHOOK }}
+ status: ${{ job.status }}
+ description: |
+ CI Pipeline: Unsuccessful 📛
+ **[View PR]**
+ [click here](${{ github.event.pull_request.html_url }})
+ nofail: false
+ nodetail: false
+ color: 0xd63031
+ username: GitHub Actions
+
+ - name: 🧽 Find And Delete Comment
+ uses: peter-evans/find-comment@v2
+ id: fc
+ with:
+ issue-number: ${{ github.event.pull_request.number }}
+ comment-author: 'github-actions[bot]'
+ body-includes: View Deployment
+
+ - name: 📝 Create or update comment
+ uses: peter-evans/create-or-update-comment@v3
+ with:
+ comment-id: ${{ steps.fc.outputs.comment-id }}
+ issue-number: ${{ github.event.pull_request.number }}
+ body: |
+ ## View Deployment
+ | 📝 Doc | 📊 Sheet | 📽️ Slide |
+ | --- | --- | --- |
+ | [🔗 Preview link](${{ steps.vercel-action.outputs.preview-url }}/doc/) | [🔗 Preview link](${{ steps.vercel-action.outputs.preview-url }}/sheet/) | [🔗 Preview link](${{ steps.vercel-action.outputs.preview-url }}/slide/) |
+ edit-mode: replace
diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml
index 81731c00c7..a62d046a87 100644
--- a/.github/workflows/ci-test.yml
+++ b/.github/workflows/ci-test.yml
@@ -1,67 +1,58 @@
name: 🧪 CI Test
on:
- push:
- branches: [main, dev]
- pull_request:
- branches: [main, dev]
+ push:
+ branches: [main, dev]
+ pull_request:
+ branches: [main, dev]
permissions:
- contents: read
+ contents: read
+ pull-requests: write
jobs:
- build:
- runs-on: ubuntu-latest
-
- env:
- TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
- TURBO_TEAM: ${{ vars.TURBO_TEAM }}
-
- steps:
- - name: Checkout
- uses: actions/checkout@v3
-
- - name: Install Node.js
- uses: actions/setup-node@v3
- with:
- node-version: 16
-
- - name: Install pnpm
- uses: pnpm/action-setup@v2
- with:
- version: 8
- run_install: false
-
- - name: Get pnpm store directory
- shell: bash
- run: |
- echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
-
- - name: Setup pnpm cache
- uses: actions/cache@v3
- with:
- path: ${{ env.STORE_PATH }}
- key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
- restore-keys: |
- ${{ runner.os }}-pnpm-store-
-
- - name: Setup ESLint cache
- uses: actions/cache@v3
- with:
- path: .eslintcache
- key: |
- ${{ runner.os }}-eslint-${{ hashFiles('.eslintrc.cjs') }}
- restore-keys: |
- ${{ runner.os }}-eslint-
-
- - name: Install dependencies
- run: pnpm install
-
- - name: 🩺 Run Test
- run: pnpm run test
-
- - name: 🌡️ Run ESLint
- run: pnpm run lint
-
- - name: 🧼 Type checking
- run: npx tsc --noEmit
+ build:
+ runs-on: ubuntu-latest
+
+ env:
+ TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
+ TURBO_TEAM: ${{ vars.TURBO_TEAM }}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Install Node.js
+ uses: actions/setup-node@v3
+ with:
+ node-version: 16
+
+ - name: Install pnpm
+ uses: pnpm/action-setup@v2
+ with:
+ version: 8
+ run_install: false
+
+ - name: Get pnpm store directory
+ shell: bash
+ run: |
+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
+
+ - name: Setup pnpm cache
+ uses: actions/cache@v3
+ with:
+ path: ${{ env.STORE_PATH }}
+ key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
+ restore-keys: |
+ ${{ runner.os }}-pnpm-store-
+
+ - name: Install dependencies
+ run: pnpm install
+
+ - name: 🩺 Run test
+ run: pnpm run coverage
+
+ - name: 🧬 Report coverage
+ uses: codecov/codecov-action@v3
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
diff --git a/README-zh.md b/README-zh.md
index b1c423659b..5ee33e58a5 100644
--- a/README-zh.md
+++ b/README-zh.md
@@ -1,5 +1,7 @@
# Univer
+[![codecov](https://codecov.io/gh/dream-num/univer/graph/badge.svg?token=aPfyW2pIMN)](https://codecov.io/gh/dream-num/univer)
+
简体中文 | [English](./README.md)
## 介绍
diff --git a/README.md b/README.md
index 133a54890d..3096963eba 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
# Univer
+[![codecov](https://codecov.io/gh/dream-num/univer/graph/badge.svg?token=aPfyW2pIMN)](https://codecov.io/gh/dream-num/univer)
+
English | [简体中文](./README-zh.md)
## Introduction
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 0000000000..410f064be2
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,4 @@
+coverage:
+ status:
+ project: false
+ patch: false