diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 0df8e5136d..0eb8dbfc44 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -4,7 +4,7 @@ on: pull_request: branches: [develop, main] types: [opened, synchronize, reopened] - + jobs: check: runs-on: ubuntu-latest @@ -14,14 +14,14 @@ jobs: run: | log_emails=$(git log --pretty=format:"%ae %ce" -1) && if [[ ${log_emails} =~ '@tencent.com' ]];then echo $log_emails && echo "邮箱校验非法" && exit 2;else echo "邮箱校验通过";fi shell: bash - + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 18 + node-version-file: .node-version - uses: actions/cache@v4 env: cache-name: cache-nodemodules @@ -32,9 +32,22 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- + - run: npm install + - run: npm run lint - - run: npm run test + + - run: npm run test + + - name: Save pr id + run: echo ${{ github.event.number }} > pr-id.txt + + - name: Upload pr id + uses: actions/upload-artifact@v4 + with: + name: pr-id + path: pr-id.txt + retention-days: 1 modify-web: runs-on: ubuntu-latest @@ -48,7 +61,7 @@ jobs: id: web-changed with: path: style/web - + modify-mobile: runs-on: ubuntu-latest outputs: @@ -60,7 +73,7 @@ jobs: - uses: tj-actions/changed-files@v45 id: mobile-changed with: - path: style/mobile + path: style/mobile build-web: runs-on: ubuntu-latest @@ -77,7 +90,7 @@ jobs: - name: init site deploy uses: actions/setup-node@v4 with: - node-version: 18 + node-version-file: .node-version - run: | cp -rf style/web/* target-repo/src/_common/style/web cd target-repo/src/_common/ @@ -105,7 +118,7 @@ jobs: name: _site path: target-repo/_site.zip retention-days: 5 - + build-mobile: runs-on: ubuntu-latest needs: modify-mobile @@ -121,7 +134,7 @@ jobs: - name: init site deploy uses: actions/setup-node@v4 with: - node-version: 18 + node-version-file: .node-version - run: | cp -rf style/mobile/* target-repo/src/_common/style/mobile cd target-repo/ @@ -148,4 +161,4 @@ jobs: with: name: _site path: target-repo/_site.zip - retention-days: 5 \ No newline at end of file + retention-days: 5 diff --git a/.github/workflows/test-component.yml b/.github/workflows/test-component.yml new file mode 100644 index 0000000000..c6b587741a --- /dev/null +++ b/.github/workflows/test-component.yml @@ -0,0 +1,180 @@ +name: TEST_COMPONENT + +on: + workflow_run: + workflows: + - MAIN_PULL_REQUEST + types: + - completed + +jobs: + pr-success: + if: github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + outputs: + pr_id: ${{ steps.pr.outputs.id }} + steps: + - name: Download pr id + uses: dawidd6/action-download-artifact@v8 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + run_id: ${{ github.event.workflow_run.id }} + name: pr-id + + - name: Set pr id + id : pr + run: echo "id=$(cat pr-id.txt)" >> $GITHUB_OUTPUT + + tdesign-vue: + if: github.event.workflow_run.conclusion == 'success' + needs: pr-success + runs-on: ubuntu-latest + steps: + - name: Checkout tdesign-vue + uses: actions/checkout@v4 + with: + repository: Tencent/tdesign-vue + + - name: Checkout tdesign-common + uses: actions/checkout@v4 + with: + path: src/_common + ref: refs/pull/${{ needs.pr-success.outputs.pr_id }}/head + + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + + - run: npm install + - run: npm run lint + - run: npm run test + - run: npm run build + + tdesign-vue-next: + if: github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + needs: pr-success + steps: + - name: Checkout tdesign-vue-next + uses: actions/checkout@v4 + with: + repository: Tencent/tdesign-vue-next + + - name: Checkout tdesign-common + uses: actions/checkout@v4 + with: + path: packages/common + ref: refs/pull/${{ needs.pr-success.outputs.pr_id }}/head + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: 'pnpm' + + - run: pnpm install --frozen-lockfile + - run: pnpm run lint + - run: pnpm run test + - run: pnpm run build + + tdesign-react: + if: github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + needs: pr-success + steps: + - name: Checkout tdesign-react + uses: actions/checkout@v4 + with: + repository: Tencent/tdesign-react + + - name: Checkout tdesign-common + uses: actions/checkout@v4 + with: + path: src/_common + ref: refs/pull/${{ needs.pr-success.outputs.pr_id }}/head + + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + + - run: npm install + - run: npm run lint + - run: npm run test + - run: npm run build + + tdesign-web-components: + if: github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + needs: pr-success + steps: + - name: Checkout tdesign-web-components + uses: actions/checkout@v4 + with: + repository: TDesignOteam/tdesign-web-components + + - name: Checkout tdesign-common + uses: actions/checkout@v4 + with: + path: src/_common + ref: refs/pull/${{ needs.pr-success.outputs.pr_id }}/head + + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + + - run: npm install + - run: npm run lint + - run: npm run test + - run: npm run build + + tdesign-mobile-vue: + if: github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + needs: pr-success + steps: + - name: Checkout tdesign-mobile-vue + uses: actions/checkout@v4 + with: + repository: Tencent/tdesign-mobile-vue + + - name: Checkout tdesign-common + uses: actions/checkout@v4 + with: + path: src/_common + ref: refs/pull/${{ needs.pr-success.outputs.pr_id }}/head + + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + + - run: npm install + - run: npm run lint + - run: npm run test + - run: npm run build + + tdesign-mobile-react: + if: github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + needs: pr-success + steps: + - name: Checkout tdesign-mobile-react + uses: actions/checkout@v4 + with: + repository: Tencent/tdesign-mobile-react + + - name: Checkout tdesign-common + uses: actions/checkout@v4 + with: + path: src/_common + ref: refs/pull/${{ needs.pr-success.outputs.pr_id }}/head + + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + + - run: npm install + - run: npm run lint + - run: npm run test + - run: npm run build + diff --git a/.node-version b/.node-version new file mode 100644 index 0000000000..3c032078a4 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +18