From 9d40fe8ad915a6503527dfab3b296ad052164a0b Mon Sep 17 00:00:00 2001 From: Avan Date: Thu, 15 Aug 2024 13:59:59 +0800 Subject: [PATCH] test: use codecov/codecov-action (#296) --- .github/workflows/react-component-ci.yml | 117 +---------------------- package.json | 1 + src/Circle/PtgCircle.tsx | 2 +- src/interface.ts | 2 +- 4 files changed, 8 insertions(+), 114 deletions(-) diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml index 6bfd63e..cf73678 100644 --- a/.github/workflows/react-component-ci.yml +++ b/.github/workflows/react-component-ci.yml @@ -1,114 +1,7 @@ -name: CI - -on: - push: - branches: [master] - pull_request: - branches: [master] +name: ✅ test +on: [push, pull_request] jobs: - setup: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@master - - - uses: actions/setup-node@v1 - with: - node-version: '18' - - - 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 --ignore-scripts - - - 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 - - lint: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@master - - - name: restore cache from package-lock.json - uses: actions/cache@v2 - with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: restore cache from node_modules - uses: actions/cache@v2 - with: - path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - - - name: lint - run: npm run lint - - needs: setup - - compile: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@master - - - name: restore cache from package-lock.json - uses: actions/cache@v2 - with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: restore cache from node_modules - uses: actions/cache@v2 - with: - path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - - - name: compile - run: npm run compile - - needs: setup - - coverage: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@master - - - name: restore cache from package-lock.json - uses: actions/cache@v2 - with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: restore cache from node_modules - uses: actions/cache@v2 - with: - path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - - - name: coverage - run: npm test -- --coverage && bash <(curl -s https://codecov.io/bash) - - needs: setup + test: + uses: react-component/rc-test/.github/workflows/test.yml@main + secrets: inherit \ No newline at end of file diff --git a/package.json b/package.json index d04baa4..a28e94d 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "@types/react": "^18.0.9", "@types/react-dom": "^18.0.3", "@umijs/fabric": "^3.0.0", + "cheerio": "1.0.0-rc.12", "cross-env": "^7.0.0", "dumi": "^2.0.0", "enzyme": "^3.1.1", diff --git a/src/Circle/PtgCircle.tsx b/src/Circle/PtgCircle.tsx index 88311b4..60cbc22 100644 --- a/src/Circle/PtgCircle.tsx +++ b/src/Circle/PtgCircle.tsx @@ -11,7 +11,7 @@ const Block: React.FC = ({ bg, children }) => (
{children}
); -function getPtgColors(color: Record, scale: number) { +function getPtgColors(color: Record, scale: number) { return Object.keys(color).map((key) => { const parsedKey = parseFloat(key); const ptgKey = `${Math.floor(parsedKey * scale)}%`; diff --git a/src/interface.ts b/src/interface.ts index 41a8f88..a5c3770 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -16,7 +16,7 @@ export interface ProgressProps { steps?: number | { count: number; gap: number }; } -export type StrokeColorObject = Record; +export type StrokeColorObject = Record; export type BaseStrokeColorType = string | StrokeColorObject;