From b6d89b69059f957e8057bf5575a0b305a9ca9482 Mon Sep 17 00:00:00 2001 From: Carrotzpc Date: Mon, 18 Mar 2024 17:41:22 +0800 Subject: [PATCH] ci: fix test --- .github/workflows/deploy-ghpages.yml | 1 + .github/workflows/release.yml | 2 +- .github/workflows/test-i18n-extract.yml | 9 ++++++++- package.json | 2 +- packages/lowcode-i18n-extract/tests/index.test.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-ghpages.yml b/.github/workflows/deploy-ghpages.yml index 44a508c..bac9295 100644 --- a/.github/workflows/deploy-ghpages.yml +++ b/.github/workflows/deploy-ghpages.yml @@ -1,6 +1,7 @@ name: Deploy to GitHub Pages on: + # https://docs.github.com/zh/actions/using-workflows/events-that-trigger-workflows#workflow_run workflow_run: workflows: - 'Build and Release' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index adf42ee..6cff3d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Build and Release on: push: branches: - - '*' + - 'main' jobs: release: diff --git a/.github/workflows/test-i18n-extract.yml b/.github/workflows/test-i18n-extract.yml index 93d3682..0705836 100644 --- a/.github/workflows/test-i18n-extract.yml +++ b/.github/workflows/test-i18n-extract.yml @@ -25,4 +25,11 @@ jobs: run: pnpm i - name: Test - run: cd packages/lowcode-i18n-extract && npm run test + run: cd packages/lowcode-i18n-extract && npm run test:cov + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: yuntijs/lowcode-tools + directory: ./packages/lowcode-i18n-extract/coverage/ diff --git a/package.json b/package.json index 51c6d23..de73117 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "build": "dumi build", "dev": "dumi dev", "dev:i18n-extract": "concurrently \"pnpm --filter 'lowcode-i18n-extract' dev\" \"npm run dev\"", - "lint": "npm run lint:es && npm run lint:style && nr lint:md", + "lint": "npm run lint:es && npm run lint:style && npm run lint:md", "lint-fix": "npm run lint-fix:es && npm run lint-fix:style", "lint-fix:es": "eslint \"{docs,packages}/**/*.{js,jsx,ts,tsx}\" --fix", "lint-fix:style": "stylelint \"{docs,packages}/**/*.{css,less,js,jsx,ts,tsx}\" --fix", diff --git a/packages/lowcode-i18n-extract/tests/index.test.ts b/packages/lowcode-i18n-extract/tests/index.test.ts index 4ecf256..4bcf059 100644 --- a/packages/lowcode-i18n-extract/tests/index.test.ts +++ b/packages/lowcode-i18n-extract/tests/index.test.ts @@ -35,5 +35,5 @@ test('extract chinese text to i18n from schema', async () => { ); // Assert 断言测试结果 - expect(matches.length).toBe(16); + expect(matches.length).toBe(17); });