-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: refactor test、build depts (#216)
- use turbo build - use vitest replace jest - delete unuse config\dept * chore(deps): update dependency rollup to v4 * build: upgrade rollup4 * refactor: vitest replace jest * ci: add compatibility for Yarn 4 * chore: modify yarn.lock * chore: ignore unhandled vitest errors * style: compatible with yjs tsconfig * test: coverage testing with c8 --------- Co-authored-by: cycleccc <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
- Loading branch information
1 parent
1f42f9c
commit 99d4d3a
Showing
93 changed files
with
28,531 additions
and
20,693 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
# github actions 中文文档 https://docs.github.com/cn/actions/getting-started-with-github-actions | ||
|
||
name: coverage test | ||
name: coverage test | ||
|
||
on: | ||
push: | ||
|
@@ -18,22 +14,46 @@ jobs: | |
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
registry-url: https://registry.npmjs.com | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Build packages | ||
run: yarn build | ||
- name: Unit test | ||
run: yarn run test-c | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
# 检出代码库 | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# 设置 Node.js 版本 | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
registry-url: https://registry.npmjs.com | ||
|
||
# 启用 Corepack 以支持 Yarn 4 | ||
- name: Enable Corepack | ||
run: corepack enable | ||
|
||
# 准备 Yarn 4.x | ||
- name: Prepare Yarn | ||
run: corepack prepare [email protected] --activate | ||
|
||
# 安装依赖 | ||
- name: Install dependencies | ||
run: yarn install | ||
|
||
# 构建项目 | ||
- name: Build packages | ||
run: yarn build | ||
|
||
# 运行单元测试并生成覆盖率报告 | ||
- name: Unit test | ||
run: yarn run test-c | ||
|
||
# 上传覆盖率报告到 Codecov | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
- name: Upload test results to Codecov | ||
if: ${{ !cancelled() }} | ||
uses: codecov/test-results-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
# github actions 中文文档 https://docs.github.com/cn/actions/getting-started-with-github-actions | ||
|
||
name: Cypress tests | ||
|
||
on: | ||
|
@@ -31,21 +27,37 @@ on: | |
jobs: | ||
test-e2e: | ||
runs-on: ubuntu-latest | ||
container: | ||
container: | ||
image: cypress/browsers:latest | ||
options: --user 1001 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js 18 | ||
uses: actions/setup-node@v4 | ||
with: | ||
- uses: actions/checkout@v4 | ||
|
||
# 设置 Node.js 版本 | ||
- name: Use Node.js 18 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18' | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Build packages | ||
run: yarn build | ||
- uses: cypress-io/github-action@v6 | ||
with: | ||
browser: chrome | ||
start: yarn run example | ||
wait-on: 'http://localhost:8881/examples/default-mode.html' | ||
|
||
# 启用 Corepack | ||
- name: Enable Corepack | ||
run: corepack enable | ||
|
||
# 安装并激活 Yarn 4.x | ||
- name: Prepare Yarn | ||
run: corepack prepare [email protected] --activate | ||
|
||
# 安装项目依赖 | ||
- name: Install dependencies | ||
run: yarn install | ||
|
||
# 构建项目 | ||
- name: Build packages | ||
run: yarn build | ||
|
||
# 运行 Cypress 测试 | ||
- uses: cypress-io/github-action@v6 | ||
with: | ||
browser: chrome | ||
start: yarn run example | ||
wait-on: 'http://localhost:8881/examples/default-mode.html' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,18 +26,28 @@ jobs: | |
node-version: [18] | ||
|
||
steps: | ||
# 检出代码库 | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# 设置 Node.js 版本 | ||
- name: Setup Node ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
|
||
with: | ||
node-version: ${{ matrix.node-version }} | ||
registry-url: 'https://registry.npmjs.org/' | ||
|
||
# 启用 Corepack 以支持 Yarn 4 | ||
- name: Enable Corepack | ||
run: corepack enable | ||
|
||
# 准备 Yarn 4.x | ||
- name: Prepare Yarn | ||
run: corepack prepare [email protected] --activate | ||
|
||
# 加载依赖缓存 | ||
- name: Load cached dependencies | ||
uses: actions/[email protected] | ||
id: cache | ||
|
@@ -48,32 +58,27 @@ jobs: | |
/home/runner/.cache/Cypress | ||
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} | ||
|
||
# 安装依赖 | ||
- name: Install dependencies | ||
run: yarn install | ||
|
||
# - name: Load cached dependencies | ||
# uses: actions/[email protected] | ||
# id: cache | ||
# with: | ||
# path: | | ||
# **/node_modules | ||
# **/.turbo | ||
# /home/runner/.cache/Cypress | ||
# key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} | ||
|
||
- name: Install Dependencies | ||
# 构建项目 | ||
- name: Build packages | ||
run: yarn build | ||
|
||
# 运行单元测试 | ||
- name: Unit test | ||
run: yarn run test | ||
run: yarn run test | ||
|
||
# 运行 E2E 测试 | ||
- name: E2E test | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
browser: chrome | ||
start: yarn run example | ||
wait-on: 'http://localhost:8881/examples/default-mode.html' | ||
|
||
# 创建 Release PR 或发布稳定版本到 npm | ||
- name: Create Release PR or publish stable version to npm | ||
id: changesets | ||
uses: changesets/action@v1 | ||
|
@@ -85,4 +90,4 @@ jobs: | |
${{ github.ref_name == 'master' && 'chore(release): publish a new release version' || 'chore(release): publish a new pre-release version' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
# github actions 中文文档 https://docs.github.com/cn/actions/getting-started-with-github-actions | ||
|
||
name: unit test | ||
name: Unit Test | ||
|
||
on: | ||
push: | ||
|
@@ -29,19 +25,37 @@ on: | |
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
registry-url: https://registry.npmjs.com | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Build packages | ||
run: yarn build | ||
- name: Unit test | ||
run: yarn run test | ||
# 检出代码库 | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# 设置 Node.js 版本 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
registry-url: https://registry.npmjs.com | ||
|
||
# 启用 Corepack 以支持 Yarn 4 | ||
- name: Enable Corepack | ||
run: corepack enable | ||
|
||
# 准备 Yarn 4.x | ||
- name: Prepare Yarn | ||
run: corepack prepare [email protected] --activate | ||
|
||
# 安装依赖 | ||
- name: Install dependencies | ||
run: yarn install | ||
|
||
# 构建项目 | ||
- name: Build packages | ||
run: yarn build | ||
|
||
# 运行单元测试 | ||
- name: Unit test | ||
run: yarn run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
yarn lint:staged | ||
yarn lint:staged |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nodeLinker: node-modules | ||
|
||
npmRegistryServer: "https://registry.npmjs.org/" |
Oops, something went wrong.