Skip to content

Commit 00b9016

Browse files
authored
chore: standardize repository maintenance (#189)
1 parent 1afe200 commit 00b9016

12 files changed

Lines changed: 254 additions & 86 deletions

File tree

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: ant-design
2+
open_collective: ant-design

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ updates:
88
time: "21:00"
99
timezone: Asia/Shanghai
1010
open-pull-requests-limit: 10
11+
groups:
12+
npm-dependencies:
13+
patterns:
14+
- "*"
1115

1216
- package-ecosystem: github-actions
1317
directory: "/"
@@ -17,3 +21,7 @@ updates:
1721
time: "21:00"
1822
timezone: Asia/Shanghai
1923
open-pull-requests-limit: 10
24+
groups:
25+
github-actions:
26+
patterns:
27+
- "*"

.github/workflows/codeql.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
schedule:
9+
- cron: "36 13 * * 3"
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [javascript-typescript]
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v7
28+
with:
29+
persist-credentials: false
30+
31+
- name: Initialize CodeQL
32+
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
33+
with:
34+
languages: ${{ matrix.language }}
35+
queries: +security-and-quality
36+
37+
- name: Autobuild
38+
uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
39+
40+
- name: Perform CodeQL Analysis
41+
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
42+
with:
43+
category: "/language:${{ matrix.language }}"

.github/workflows/main.yml

Lines changed: 13 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,24 @@
1-
name: CI
1+
name: ✅ test
22

33
on:
44
push:
5-
branches: [master]
5+
branches: [main]
66
pull_request:
7-
branches: [master]
7+
branches: [main]
88

9-
jobs:
10-
setup:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: checkout
14-
uses: actions/checkout@master
15-
16-
- uses: actions/setup-node@v1
17-
with:
18-
node-version: '12'
19-
20-
- name: cache package-lock.json
21-
uses: actions/cache@v2
22-
with:
23-
path: package-temp-dir
24-
key: lock-${{ github.sha }}
25-
26-
- name: create package-lock.json
27-
run: npm i --package-lock-only
28-
29-
- name: hack for singe file
30-
run: |
31-
if [ ! -d "package-temp-dir" ]; then
32-
mkdir package-temp-dir
33-
fi
34-
cp package-lock.json package-temp-dir
35-
36-
- name: cache node_modules
37-
id: node_modules_cache_id
38-
uses: actions/cache@v2
39-
with:
40-
path: node_modules
41-
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
42-
43-
- name: install
44-
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
45-
run: npm ci
9+
permissions:
10+
contents: read
4611

12+
jobs:
4713
test:
4814
runs-on: ubuntu-latest
4915
steps:
50-
- name: checkout
51-
uses: actions/checkout@master
52-
53-
- name: restore cache from package-lock.json
54-
uses: actions/cache@v2
16+
- uses: actions/checkout@v7
5517
with:
56-
path: package-temp-dir
57-
key: lock-${{ github.sha }}
58-
59-
- name: restore cache from node_modules
60-
uses: actions/cache@v2
18+
persist-credentials: false
19+
- uses: actions/setup-node@v6
6120
with:
62-
path: node_modules
63-
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
64-
65-
- name: test
66-
run: npm test
67-
68-
needs: setup
21+
node-version: 22
22+
- run: npm install --legacy-peer-deps
23+
- run: npm run compile
24+
- run: npm run test:only

.github/workflows/react-doctor.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: React Doctor
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
issues: write
12+
statuses: write
13+
14+
jobs:
15+
react-doctor:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v7
19+
with:
20+
fetch-depth: 0
21+
persist-credentials: false
22+
- uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3

.github/workflows/test-npm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ jobs:
1919
- run: npx tsc --noEmit
2020
- run: npm run compile
2121
- run: npm run test -- --coverage
22-
- uses: codecov/codecov-action@v5
22+
- uses: codecov/codecov-action@v7
2323
with:
2424
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/test-utoo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ jobs:
2323
- run: utx tsc --noEmit
2424
- run: ut compile
2525
- run: ut test -- --coverage
26-
- uses: codecov/codecov-action@v5
26+
- uses: codecov/codecov-action@v7
2727
with:
2828
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ jobs:
2020
- run: bunx tsc --noEmit
2121
- run: bun run compile
2222
- run: bun run test -- --coverage
23-
- uses: codecov/codecov-action@v5
23+
- uses: codecov/codecov-action@v7
2424
with:
2525
token: ${{ secrets.CODECOV_TOKEN }}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) react-component
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,62 @@
1-
# rc-test
1+
<div align="center">
2+
<h1>rc-test</h1>
3+
<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>
4+
<p>🧪 Shared Jest workflow and test runner for rc-component packages.</p>
25

3-
test for react component
6+
<p>
7+
<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>
8+
<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>
9+
<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>
10+
<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>
11+
<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>
12+
</p>
13+
</div>
14+
15+
<p align="center">English | <a href="./README.zh-CN.md">简体中文</a></p>
16+
17+
## Highlights
18+
19+
| Area | Support |
20+
| ------- | --------------------------------------------------------------- |
21+
| Purpose | Shared Jest workflow and test runner for rc-component packages. |
22+
| Package | `rc-test` |
23+
| Release | `@rc-component/np` / `rc-np` |
24+
25+
## Install
26+
27+
```bash
28+
npm install rc-test --save-dev
29+
```
430

531
## Usage
632

33+
```bash
34+
npx rc-test --coverage
35+
```
36+
37+
## API
38+
39+
| Command | Description |
40+
| -------------------- | ------------------------------------ |
41+
| `rc-test` | Run Jest with rc-component defaults. |
42+
| `rc-test --coverage` | Run tests and collect coverage. |
43+
44+
## Development
45+
46+
```bash
47+
npm install
48+
npm run compile
49+
npm run test:only
750
```
8-
$ rc-test
51+
52+
## Release
53+
54+
```bash
55+
npm run prepublishOnly
956
```
57+
58+
The release flow is handled by `@rc-component/np` through the `rc-np` command when the package uses the shared release flow.
59+
60+
## License
61+
62+
rc-test is released under the [MIT](./LICENSE) license.

0 commit comments

Comments
 (0)