From 932e438409af4479b2d9ef41a6de2cf726781055 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 21 Jun 2024 11:19:52 +0800 Subject: [PATCH 1/5] test: add github action --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ .travis.yml | 4 ---- README.md | 1 - 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..6afc9b876 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: CI + +on: ['push', 'pull_request'] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d35c327e2..000000000 --- a/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js - -node_js: - - 11 diff --git a/README.md b/README.md index 7e58a78d1..b3b828540 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ [![npm package](https://img.shields.io/npm/v/@ant-design/tools.svg?style=flat-square)](https://www.npmjs.org/package/@ant-design/tools) [![NPM downloads](http://img.shields.io/npm/dm/@ant-design/tools.svg?style=flat-square)](http://npmjs.com/@ant-design/tools) -[![Travis](https://img.shields.io/travis/ant-design/antd-tools/master.svg?style=flat-square)](https://travis-ci.org/ant-design/antd-tools) Tools for Ant Design of React: https://github.com/ant-design/ant-design From 701005f0569e6c58fbdd5f4262ed96d1cbfdcb9e Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 21 Jun 2024 11:24:14 +0800 Subject: [PATCH 2/5] test: use bun --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6afc9b876..2e2b45647 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,9 +14,13 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 + + - uses: oven-sh/setup-bun@v1 + with: + bun-version: latest - name: Install dependencies - run: npm ci + run: bun install - name: Run tests - run: npm test \ No newline at end of file + run: bun test \ No newline at end of file From 297b0b3a9daae5e3d8107a47b2a9462cf3683e1d Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 21 Jun 2024 11:51:59 +0800 Subject: [PATCH 3/5] Update .github/workflows/ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e2b45647..33c75f229 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,4 +23,4 @@ jobs: run: bun install - name: Run tests - run: bun test \ No newline at end of file + run: bun run test \ No newline at end of file From 3614c87eee5856b19607b1f39e13a275b555d72e Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 21 Jun 2024 11:54:18 +0800 Subject: [PATCH 4/5] test: fix test and add badges --- .github/workflows/ci.yml | 2 +- README.md | 1 + __tests__/utils/styleUtil.js | 49 ------------------------------------ 3 files changed, 2 insertions(+), 50 deletions(-) delete mode 100644 __tests__/utils/styleUtil.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33c75f229..bdbe1adca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: CI on: ['push', 'pull_request'] jobs: - build: + test: runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index b3b828540..d9e54e28f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![npm package](https://img.shields.io/npm/v/@ant-design/tools.svg?style=flat-square)](https://www.npmjs.org/package/@ant-design/tools) [![NPM downloads](http://img.shields.io/npm/dm/@ant-design/tools.svg?style=flat-square)](http://npmjs.com/@ant-design/tools) +[![CI](https://github.com/ant-design/antd-tools/actions/workflows/ci.yml/badge.svg)](https://github.com/ant-design/antd-tools/actions/workflows/ci.yml) Tools for Ant Design of React: https://github.com/ant-design/ant-design diff --git a/__tests__/utils/styleUtil.js b/__tests__/utils/styleUtil.js deleted file mode 100644 index 84c913f5a..000000000 --- a/__tests__/utils/styleUtil.js +++ /dev/null @@ -1,49 +0,0 @@ -const { cssInjection } = require('../../lib/utils/styleUtil'); - -describe('styleUtil', () => { - it('cssInjection', () => { - const libContent = ` -"use strict"; -require("../../style/index.less"); -require("./index.less"); - -require("../../radio/style"); -require("../../checkbox/style"); -require("../../dropdown/style"); -require("../../spin/style"); -require("../../pagination/style"); - `.trim(); - const esContent = ` -import '../../style/index.less'; -import './index.less'; - -import '../../radio/style'; -import '../../checkbox/style'; -import '../../dropdown/style'; -import '../../spin/style'; -import '../../pagination/style'; - `.trim(); - - expect(cssInjection(libContent)).toEqual(` -"use strict"; -require("../../style/index.css"); -require("./index.css"); - -require("../../radio/style/css"); -require("../../checkbox/style/css"); -require("../../dropdown/style/css"); -require("../../spin/style/css"); -require("../../pagination/style/css"); - `.trim()); - expect(cssInjection(esContent)).toEqual(` -import '../../style/index.css'; -import './index.css'; - -import '../../radio/style/css'; -import '../../checkbox/style/css'; -import '../../dropdown/style/css'; -import '../../spin/style/css'; -import '../../pagination/style/css'; - `.trim()); - }); -}); \ No newline at end of file From 5ebe63b81de3e1503dfa36448527d2e4c561e963 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 21 Jun 2024 11:55:36 +0800 Subject: [PATCH 5/5] test: fix lint --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bdbe1adca..dbe50653d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,5 +22,5 @@ jobs: - name: Install dependencies run: bun install - - name: Run tests - run: bun run test \ No newline at end of file + - name: Run lint + run: bun run lint \ No newline at end of file