From 09891135caf96f5bd3d83b0181186518e50dfb43 Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Fri, 18 Apr 2025 15:59:39 +0800 Subject: [PATCH 1/5] feat: add github ci and build workflows --- .github/workflows/build.yml | 52 ++++++++++++++++++++++++++ .github/workflows/ci.yml | 73 +++++++++++++++++++++++++++++++++++++ .gitignore | 1 - 3 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..1b57e34c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,52 @@ +name: Build +on: + pull_request_target: + types: + - opened + - synchronize + branches: + - master + push: + branches: + - master + +env: + HUSKY: '0' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + post-update: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + # - macos-latest + - windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + run_install: true + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - name: Build + run: | + pnpm build:antd diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..a38a9069 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,73 @@ +name: CI + +on: + pull_request: + push: + branches: + - master + +permissions: + contents: read + +jobs: + lint: + name: Lint + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + # - macos-latest + - windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + run_install: true + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - name: Lint + run: pnpm run lint + + check: + name: Check + runs-on: ${{ matrix.os }} + timeout-minutes: 20 + strategy: + matrix: + os: + - ubuntu-latest + # - macos-latest + - windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + run_install: true + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - name: Typecheck + run: pnpm check:type diff --git a/.gitignore b/.gitignore index 4211af2f..87cb9077 100644 --- a/.gitignore +++ b/.gitignore @@ -53,7 +53,6 @@ vite.config.ts.* # 升级 vben 时需要删除的文件 .vscode .changeset -.github backend-mock web-ele web-naive From 66684061f0b0c99de63b531fbaca5e29b75d2e67 Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Fri, 18 Apr 2025 16:04:09 +0800 Subject: [PATCH 2/5] fix: pnpm version --- .github/workflows/build.yml | 2 +- .github/workflows/ci.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b57e34c..8173f899 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: fetch-depth: 0 - name: Setup pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@v2 with: version: 10 run_install: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a38a9069..c8558559 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: fetch-depth: 0 - name: Setup pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@v2 with: version: 10 run_install: true @@ -58,7 +58,7 @@ jobs: fetch-depth: 0 - name: Setup pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@v2 with: version: 10 run_install: true From 9867e6cb2fb6ad0e64b8aca7321013addd6d304d Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Fri, 18 Apr 2025 17:00:52 +0800 Subject: [PATCH 3/5] fix: type check fail --- apps/web-antd/src/store/auth.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web-antd/src/store/auth.ts b/apps/web-antd/src/store/auth.ts index f1a51fb5..df0720f0 100644 --- a/apps/web-antd/src/store/auth.ts +++ b/apps/web-antd/src/store/auth.ts @@ -1,3 +1,5 @@ +import type { Recordable } from '@vben/types'; + import type { CaptchaResult, LoginParams, MyUserInfo } from '#/api'; import { ref } from 'vue'; @@ -39,14 +41,14 @@ export const useAuthStore = defineStore('auth', () => { * @param params 登录表单数据 */ async function authLogin( - params: LoginParams, + params: Recordable, onSuccess?: () => Promise | void, ) { // 异步处理用户登录操作并获取 accessToken let userInfo: MyUserInfo | null = null; try { loginLoading.value = true; - const { access_token } = await loginApi(params); + const { access_token } = await loginApi(params as LoginParams); // 如果成功获取到 accessToken if (access_token) { From c12177875f9f167d15ecf097ff181a786baca164 Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Fri, 18 Apr 2025 17:29:18 +0800 Subject: [PATCH 4/5] chore: remove lint ci --- .github/workflows/ci.yml | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8558559..660833ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,37 +10,6 @@ permissions: contents: read jobs: - lint: - name: Lint - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - ubuntu-latest - # - macos-latest - - windows-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup pnpm - uses: pnpm/action-setup@v2 - with: - version: 10 - run_install: true - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: pnpm - - - name: Lint - run: pnpm run lint - check: name: Check runs-on: ${{ matrix.os }} From 3a84c433eff1660b91fa2c6ea6d2a41521aa394f Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Fri, 18 Apr 2025 17:35:20 +0800 Subject: [PATCH 5/5] feat: update build on --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8173f899..401c5053 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: Build on: - pull_request_target: + pull_request: types: - opened - synchronize