Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use gh action ci #530

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
162 changes: 162 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: ✅ test

on: [push, pull_request]

# Cancel prev CI if new commit come
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
afc163 marked this conversation as resolved.
Show resolved Hide resolved
- name: restore lerna
id: lerna_cache_node_modules
uses: actions/cache@v4
with:
path: |
node_modules
*/*/node_modules
key: lerna-${{ github.sha }}-package-json-${{ hashFiles('**/package.json') }}
restore-keys: |
lerna-${{ github.sha }}-package-json-

- name: install
if: steps.lerna_cache_node_modules.outputs.cache-hit != 'true'
run: |
yarn
afc163 marked this conversation as resolved.
Show resolved Hide resolved
afc163 marked this conversation as resolved.
Show resolved Hide resolved
yarn bootstrap

lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: restore lerna
id: lerna_cache_node_modules
uses: actions/cache@v4
with:
path: |
node_modules
*/*/node_modules
key: lerna-${{ github.sha }}-package-json-${{ hashFiles('**/package.json') }}
restore-keys: lerna-${{ github.sha }}-package-json-

- name: lint
run: yarn lint
needs: setup

################################ Icon Svg ################################
icon-svg:
name: icon-svg
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: restore lerna
id: lerna_cache_node_modules
uses: actions/cache@v4
with:
path: |
node_modules
*/*/node_modules
key: lerna-${{ github.sha }}-package-json-${{ hashFiles('**/package.json') }}
restore-keys: lerna-${{ github.sha }}-package-json-

- name: icon-svg build
run: |
yarn icons:generate
yarn icons:build

- name: cache icon-svg
uses: actions/cache@v4
with:
path: |
packages/icons-svg/es
packages/icons-svg/lib
packages/icons-svg/inline-svg
key: icon-svg-${{ github.sha }}

- name: icon-svg ci
run: yarn icons:test
needs: setup

################################ Framework Icons CI ################################
framework-test:
name: test
strategy:
matrix:
framework: ['angular', 'react', 'vue']
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
afc163 marked this conversation as resolved.
Show resolved Hide resolved

- name: restore lerna
id: lerna_cache_node_modules
uses: actions/cache@v4
with:
path: |
node_modules
*/*/node_modules
key: lerna-${{ github.sha }}-package-json-${{ hashFiles('**/package.json') }}
restore-keys: lerna-${{ github.sha }}-package-json-

- name: restore cache from icon-svg
uses: actions/cache@v4
with:
path: |
packages/icons-svg/es
packages/icons-svg/lib
packages/icons-svg/inline-svg
key: icon-svg-${{ github.sha }}

- name: icon-${{ matrix.framework }} ci
run: yarn ${{ matrix.framework }}:ci

needs: [setup, icon-svg]

rn-test:
name: test
strategy:
matrix:
framework: ['react-native']
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: restore lerna
id: lerna_cache_node_modules
uses: actions/cache@v4
with:
path: |
node_modules
*/*/node_modules
key: lerna-${{ github.sha }}-package-json-${{ hashFiles('**/package.json') }}
restore-keys: lerna-${{ github.sha }}-package-json-

- name: restore cache from icon-svg
uses: actions/cache@v4
with:
path: |
packages/icons-svg/es
packages/icons-svg/lib
packages/icons-svg/inline-svg
key: icon-svg-${{ github.sha }}

- name: icon-${{ matrix.framework }} ci
run: yarn ${{ matrix.framework }}:ci

needs: [setup, icon-svg]
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"packages": ["packages/*"],
"version": "independent",
"bootstrap": {
"npmClientArgs": []
},
"useWorkspaces": true,
"npmClient": "yarn"
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"name": "ant-design-icons",
"version": "0.0.1",
"private": true,
"workspaces": ["packages/*"],
"scripts": {
"bootstrap": "lerna bootstrap",
"clean": "lerna clean",
Expand Down
8 changes: 4 additions & 4 deletions packages/icons-react/src/components/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Omit<IconComponentProps, 'ref'> & React.RefAttributes<HTMLSpanElement>
className,

// affect inner <svg>...</svg>
component: Component,
component,
viewBox,
spin,
rotate,
Expand All @@ -50,7 +50,7 @@ Omit<IconComponentProps, 'ref'> & React.RefAttributes<HTMLSpanElement>
const mergedRef = useComposeRef(iconRef, ref);

warning(
Boolean(Component || children),
Boolean(component || children),
'Should have `component` prop or `children`.',
);

Expand Down Expand Up @@ -91,8 +91,8 @@ Omit<IconComponentProps, 'ref'> & React.RefAttributes<HTMLSpanElement>

// component > children
const renderInnerNode = () => {
if (Component) {
return <Component {...innerSvgProps}>{children}</Component>;
if (component) {
return React.createElement(component, innerSvgProps, children);
}

if (children) {
Expand Down
3 changes: 2 additions & 1 deletion packages/icons-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"module": "esnext",
"target": "esnext",
"moduleResolution": "node",
"jsx": "react"
"jsx": "react",
"skipLibCheck": true
},
"include": ["./src", "./typings/"],
"typings": "./typings/index.d.ts",
Expand Down
3 changes: 0 additions & 3 deletions packages/icons-svg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,9 @@
"@types/rgrove__parse-xml": "^1.1.0",
"@types/svgo": "^1.3.1",
"@types/through2": "^2.0.34",
"@typescript-eslint/eslint-plugin": "^2.21.0",
"@typescript-eslint/parser": "^2.21.0",
"babel-jest": "^25.1.0",
"cross-env": "^7.0.0",
"del": "^5.1.0",
"eslint": "^7.16.0",
"globby": "^11.0.0",
"gulp": "^4.0.2",
"gulp-clone": "^2.0.1",
Expand Down
Loading