Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: ant-design
open_collective: ant-design
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ updates:
time: "21:00"
timezone: Asia/Shanghai
open-pull-requests-limit: 10
groups:
npm-dependencies:
patterns:
- "*"

- package-ecosystem: github-actions
directory: "/"
Expand All @@ -17,3 +21,7 @@ updates:
time: "21:00"
timezone: Asia/Shanghai
open-pull-requests-limit: 10
groups:
github-actions:
patterns:
- "*"
43 changes: 43 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "CodeQL"

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
schedule:
- cron: "36 13 * * 3"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [javascript-typescript]

steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Initialize CodeQL
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
with:
category: "/language:${{ matrix.language }}"
70 changes: 13 additions & 57 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,24 @@
name: CI
name: ✅ test

on:
push:
branches: [master]
branches: [main]
pull_request:
branches: [master]
branches: [main]

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master

- uses: actions/setup-node@v1
with:
node-version: '12'

- name: cache package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}

- name: create package-lock.json
run: npm i --package-lock-only

- name: hack for singe file
run: |
if [ ! -d "package-temp-dir" ]; then
mkdir package-temp-dir
fi
cp package-lock.json package-temp-dir

- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: install
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci
permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master

- name: restore cache from package-lock.json
uses: actions/cache@v2
- uses: actions/checkout@v7
with:
path: package-temp-dir
key: lock-${{ github.sha }}

- name: restore cache from node_modules
uses: actions/cache@v2
persist-credentials: false
- uses: actions/setup-node@v6
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: test
run: npm test

needs: setup
node-version: 22
- run: npm install --legacy-peer-deps
- run: npm run compile
- run: npm run test:only
22 changes: 22 additions & 0 deletions .github/workflows/react-doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: React Doctor

on:
pull_request:
push:
branches: [main]

permissions:
contents: read
pull-requests: write
issues: write
statuses: write

jobs:
react-doctor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3
2 changes: 1 addition & 1 deletion .github/workflows/test-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ jobs:
- run: npx tsc --noEmit
- run: npm run compile
- run: npm run test -- --coverage
- uses: codecov/codecov-action@v5
- uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/test-utoo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ jobs:
- run: utx tsc --noEmit
- run: ut compile
- run: ut test -- --coverage
- uses: codecov/codecov-action@v5
- uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
- run: bunx tsc --noEmit
- run: bun run compile
- run: bun run test -- --coverage
- uses: codecov/codecov-action@v5
- uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) react-component

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
59 changes: 56 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,62 @@
# rc-test
<div align="center">
<h1>rc-test</h1>
<p><sub><a href="https://ant.design"><img alt="Ant Design" height="14" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" style="vertical-align: -0.125em;" /></a> Part of the Ant Design ecosystem.</sub></p>
<p>🧪 Shared Jest workflow and test runner for rc-component packages.</p>

test for react component
<p>
<a href="https://npmjs.org/package/rc-test"><img alt="NPM version" src="https://img.shields.io/npm/v/rc-test.svg?style=flat-square"></a>
<a href="https://npmjs.org/package/rc-test"><img alt="npm downloads" src="https://img.shields.io/npm/dm/rc-test.svg?style=flat-square"></a>
<a href="https://bundlephobia.com/package/rc-test"><img alt="bundle size" src="https://img.shields.io/bundlephobia/minzip/rc-test?style=flat-square"></a>
<a href="https://github.com/react-component/rc-test/actions/workflows/test.yml"><img alt="build status" src="https://github.com/react-component/rc-test/actions/workflows/test.yml/badge.svg"></a>
<a href="https://app.codecov.io/gh/react-component/rc-test"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/react-component/rc-test/main.svg?style=flat-square"></a>
</p>
</div>

<p align="center">English | <a href="./README.zh-CN.md">简体中文</a></p>

## Highlights

| Area | Support |
| ------- | --------------------------------------------------------------- |
| Purpose | Shared Jest workflow and test runner for rc-component packages. |
| Package | `rc-test` |
| Release | `@rc-component/np` / `rc-np` |

## Install

```bash
npm install rc-test --save-dev
```

## Usage

```bash
npx rc-test --coverage
```

## API

| Command | Description |
| -------------------- | ------------------------------------ |
| `rc-test` | Run Jest with rc-component defaults. |
| `rc-test --coverage` | Run tests and collect coverage. |

## Development

```bash
npm install
npm run compile
npm run test:only
```
$ rc-test

## Release

```bash
npm run prepublishOnly
```

The release flow is handled by `@rc-component/np` through the `rc-np` command when the package uses the shared release flow.

## License

rc-test is released under the [MIT](./LICENSE) license.
62 changes: 62 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<div align="center">
<h1>rc-test</h1>
<p><sub><a href="https://ant.design"><img alt="Ant Design" height="14" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" style="vertical-align: -0.125em;" /></a> Ant Design 生态的一部分。</sub></p>
<p>🧪 rc-component 包共享的 Jest 测试运行器与 GitHub Actions 工作流。</p>

<p>
<a href="https://npmjs.org/package/rc-test"><img alt="NPM version" src="https://img.shields.io/npm/v/rc-test.svg?style=flat-square"></a>
<a href="https://npmjs.org/package/rc-test"><img alt="npm downloads" src="https://img.shields.io/npm/dm/rc-test.svg?style=flat-square"></a>
<a href="https://bundlephobia.com/package/rc-test"><img alt="bundle size" src="https://img.shields.io/bundlephobia/minzip/rc-test?style=flat-square"></a>
<a href="https://github.com/react-component/rc-test/actions/workflows/test.yml"><img alt="build status" src="https://github.com/react-component/rc-test/actions/workflows/test.yml/badge.svg"></a>
<a href="https://app.codecov.io/gh/react-component/rc-test"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/react-component/rc-test/main.svg?style=flat-square"></a>
</p>
</div>

<p align="center"><a href="./README.md">English</a> | 简体中文</p>

## 亮点

| 方向 | 支持 |
| ---- | --------------------------------------------------------------- |
| 定位 | rc-component 包共享的 Jest 测试运行器与 GitHub Actions 工作流。 |
| 包名 | `rc-test` |
| 发布 | `@rc-component/np` / `rc-np` |

## 安装

```bash
npm install rc-test --save-dev
```

## 用法

```bash
npx rc-test --coverage
```

## API

| 名称 | 说明 |
| -------------------- | ------------------------------------- |
| `rc-test` | 使用 rc-component 默认配置运行 Jest。 |
| `rc-test --coverage` | 运行测试并收集覆盖率。 |

## 本地开发

```bash
npm install
npm run compile
npm run test:only
```

## 发布

```bash
npm run prepublishOnly
```

发布流程通过 `@rc-component/np` 提供的 `rc-np` 命令处理。

## 许可证

rc-test 基于 [MIT](./LICENSE) 协议发布。
Loading
Loading