-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add TDesign Component Repositories CI Test (#2054)
* ci: add TEST_COMPONENT * chore: fix ci * chore: fix ci * chore: fix ci * chore: ci * chore: ci * chore: ci * chore: ci * chore: ci * chore: ci * chore: add .node-version * ci(MAIN_PULL_REQUEST): save pr id * chore: ci * ci: node-version * chore: ci * chore: ci * chore: ci * chore: update name * chore: update name
- Loading branch information
1 parent
b2e4e1d
commit b7935cb
Showing
2 changed files
with
249 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
229 changes: 229 additions & 0 deletions
229
.github/workflows/tdesign-component-repositories-ci.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
name: TDesign Component Repositories CI Test | ||
|
||
on: | ||
workflow_run: | ||
workflows: | ||
- MAIN_PULL_REQUEST | ||
types: | ||
- completed | ||
|
||
jobs: | ||
pr-context: | ||
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-context | ||
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-context.outputs.pr_id }}/head | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- 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-context | ||
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-context.outputs.pr_id }}/head | ||
|
||
- uses: pnpm/action-setup@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
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-context | ||
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-context.outputs.pr_id }}/head | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- 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-context | ||
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-context.outputs.pr_id }}/head | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- 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-context | ||
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-context.outputs.pr_id }}/head | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- 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-context | ||
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-context.outputs.pr_id }}/head | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- run: npm install | ||
- run: npm run lint | ||
- run: npm run test | ||
- run: npm run build | ||
|
||
pr-comment: | ||
if: always() | ||
needs: | ||
- tdesign-vue | ||
- tdesign-vue-next | ||
- tdesign-react | ||
- tdesign-web-components | ||
- tdesign-mobile-vue | ||
- tdesign-mobile-react | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: jobs report | ||
id: report | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const { data: { jobs } } = await github.rest.actions.listJobsForWorkflowRun({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: context.runId, | ||
per_page: 100 | ||
}) | ||
const tdesign = jobs.filter(job => job.name.startsWith('tdesign-')) | ||
const run_url = `${context.serverUrl}//${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` | ||
const comment =` | ||
# TDesign Component Repositories CI Test [Open](${run_url}) | ||
| Component | Status | Job | | ||
| --------- | :----: | :--: | | ||
${tdesign.map(job => { | ||
const status = job.conclusion === 'success' ? '✅' : '❌'; | ||
return `| ${job.name} | ${status} | [Open](${job.html_url}) |` | ||
console.log(job.name, process.env[job.name]); | ||
}).join("\n")} | ||
<!-- TDesign Component Repositories CI Test --> | ||
` | ||
core.setOutput('comment', comment); | ||
- name: comment | ||
uses: actions-cool/maintain-one-comment@v3 | ||
with: | ||
token: ${{ secrets.TDESIGN_BOT_TOKEN }} | ||
number: ${{needs.pr-context.outputs.pr_id}} | ||
body: ${{ steps.report.outputs.comment }} | ||
body-include: '<!-- TDesign Component Repositories CI Test -->' |