Skip to content

Commit 2cba4d5

Browse files
LayouwenzombieJ
authored andcommitted
test: use unified github action yml (#476)
1 parent 72982dd commit 2cba4d5

File tree

6 files changed

+20
-149
lines changed

6 files changed

+20
-149
lines changed

.github/workflows/main.yml

+5-113
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,6 @@
1-
name: CI
2-
3-
on:
4-
push:
5-
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
8-
1+
name: ✅ test
2+
on: [push, pull_request]
93
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: '16'
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 i
46-
47-
lint:
48-
runs-on: ubuntu-latest
49-
steps:
50-
- name: checkout
51-
uses: actions/checkout@master
52-
53-
- name: restore cache from package-lock.json
54-
uses: actions/cache@v2
55-
with:
56-
path: package-temp-dir
57-
key: lock-${{ github.sha }}
58-
59-
- name: restore cache from node_modules
60-
uses: actions/cache@v2
61-
with:
62-
path: node_modules
63-
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
64-
65-
- name: lint
66-
run: npm run lint
67-
68-
needs: setup
69-
70-
compile:
71-
runs-on: ubuntu-latest
72-
steps:
73-
- name: checkout
74-
uses: actions/checkout@master
75-
76-
- name: restore cache from package-lock.json
77-
uses: actions/cache@v2
78-
with:
79-
path: package-temp-dir
80-
key: lock-${{ github.sha }}
81-
82-
- name: restore cache from node_modules
83-
uses: actions/cache@v2
84-
with:
85-
path: node_modules
86-
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
87-
88-
- name: compile
89-
run: npm run compile
90-
91-
needs: setup
92-
93-
coverage:
94-
runs-on: ubuntu-latest
95-
steps:
96-
- name: checkout
97-
uses: actions/checkout@master
98-
99-
- name: restore cache from package-lock.json
100-
uses: actions/cache@v2
101-
with:
102-
path: package-temp-dir
103-
key: lock-${{ github.sha }}
104-
105-
- name: restore cache from node_modules
106-
uses: actions/cache@v2
107-
with:
108-
path: node_modules
109-
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
110-
111-
- name: coverage
112-
run: npm run coverage && bash <(curl -s https://codecov.io/bash)
113-
114-
needs: setup
4+
test:
5+
uses: react-component/rc-test/.github/workflows/test.yml@main
6+
secrets: inherit

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ es
2727
coverage
2828
yarn.lock
2929
package-lock.json
30+
bun.lockb
3031

3132
# dumi
3233
.umi

docs/examples/case.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import React from 'react';
44
import type { CSSMotionProps } from 'rc-motion';
5-
import type { BuildInPlacements } from 'rc-trigger';
5+
import type { ActionType, BuildInPlacements } from 'rc-trigger';
66
import Trigger from 'rc-trigger';
77
import './case.less';
88

@@ -115,6 +115,8 @@ const Demo = () => {
115115
click,
116116
contextMenu,
117117
};
118+
119+
const actionsKeys = Object.keys(actions).filter((action) => actions[action]) as ActionType[];
118120

119121
return (
120122
<React.StrictMode>
@@ -203,7 +205,7 @@ const Demo = () => {
203205
maskMotion={motion ? MaskMotion : null}
204206
maskClosable={maskClosable}
205207
stretch={stretch}
206-
action={Object.keys(actions).filter((action) => actions[action])}
208+
action={actionsKeys}
207209
builtinPlacements={builtinPlacements}
208210
forceRender={forceRender}
209211
popupStyle={{

docs/examples/nested.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const Test = () => {
6767
getPopupContainer={() => containerRef.current}
6868
popup={<div style={popupBorderStyle}>I am inner Trigger Popup</div>}
6969
>
70-
<span href="#" style={{ margin: 20 }}>
70+
<span style={{ margin: 20 }}>
7171
clickToShowInnerTrigger
7272
</span>
7373
</Trigger>
@@ -94,7 +94,7 @@ const Test = () => {
9494
builtinPlacements={builtinPlacements}
9595
popup={<div style={popupBorderStyle}>i am a hover popup</div>}
9696
>
97-
<span href="#" style={{ margin: 20 }}>
97+
<span style={{ margin: 20 }}>
9898
trigger
9999
</span>
100100
</Trigger>
@@ -108,7 +108,7 @@ const Test = () => {
108108
builtinPlacements={builtinPlacements}
109109
popup={innerTrigger}
110110
>
111-
<span href="#" style={{ margin: 20 }}>
111+
<span style={{ margin: 20 }}>
112112
trigger
113113
</span>
114114
</Trigger>

docs/examples/point.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22

33
import React from 'react';
4-
import Trigger from 'rc-trigger';
4+
import Trigger, { ActionType } from 'rc-trigger';
55
import '../../assets/index.less';
66
import './point.less';
77

@@ -17,7 +17,7 @@ const innerTrigger = (
1717

1818
class Test extends React.Component {
1919
state = {
20-
action: 'click',
20+
action: 'click' as ActionType,
2121
mouseEnterDelay: 0,
2222
};
2323

docs/examples/simple.tsx

+5-29
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console:0 */
22

3-
import Trigger from 'rc-trigger';
3+
import Trigger, { ActionType } from 'rc-trigger';
44
import React from 'react';
55
import '../../assets/index.less';
66

@@ -199,6 +199,9 @@ class Test extends React.Component<any, TestState> {
199199
if (state.destroyed) {
200200
return null;
201201
}
202+
203+
const actions = Object.keys(state.trigger) as ActionType[]
204+
202205
return (
203206
<div>
204207
<div style={{ margin: '10px 20px' }}>
@@ -359,7 +362,7 @@ class Test extends React.Component<any, TestState> {
359362
maskAnimation="fade"
360363
// mouseEnterDelay={0.1}
361364
// mouseLeaveDelay={0.1}
362-
action={Object.keys(state.trigger)}
365+
action={actions}
363366
builtinPlacements={builtinPlacements}
364367
arrow
365368
popupStyle={{
@@ -370,33 +373,6 @@ class Test extends React.Component<any, TestState> {
370373
}}
371374
popup={<div>i am a popup</div>}
372375
popupTransitionName={state.transitionName}
373-
mobile={
374-
state.mobile
375-
? {
376-
popupMotion: {
377-
motionName: 'rc-trigger-popup-mobile-fade',
378-
},
379-
popupClassName: 'rc-trigger-popup-mobile',
380-
popupStyle: {
381-
padding: 16,
382-
borderTop: '1px solid red',
383-
background: '#FFF',
384-
textAlign: 'center',
385-
},
386-
popupRender: (node) => (
387-
<>
388-
<div>
389-
<input
390-
style={{ width: '100%' }}
391-
placeholder="additional content"
392-
/>
393-
</div>
394-
{node}
395-
</>
396-
),
397-
}
398-
: null
399-
}
400376
>
401377
<RefTarget />
402378
</Trigger>

0 commit comments

Comments
 (0)