-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
123 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Ecosystem CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
pull_request: | ||
branches: [main] | ||
|
||
merge_group: | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
ecosystem_ci_notify: | ||
name: Run Ecosystem CI | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'web-infra-dev/rsbuild' && github.event_name != 'workflow_dispatch' | ||
steps: | ||
- name: Run Ecosystem CI with notify | ||
id: eco_ci | ||
uses: convictional/[email protected] | ||
with: | ||
owner: "rspack-contrib" | ||
repo: "rsbuild-ecosystem-ci" | ||
workflow_file_name: "ecosystem-ci-from-commit.yml" | ||
github_token: ${{ secrets.REPO_SCOPED_TOKEN }} | ||
ref: "main" | ||
client_payload: '{"commitSHA":"${{ github.sha }}","updateComment":${{ github.ref_name == 'main'}},"repo":"web-infra-dev/rsbuild","suite":"-","suiteRefType":"precoded","suiteRef":"precoded"}' | ||
|
||
- if: steps.eco_ci.outcome == 'failure' | ||
uses: actions/checkout@v4 | ||
- if: steps.eco_ci.outcome == 'failure' | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- name: Send Failure Notification | ||
if: steps.eco_ci.outcome == 'failure' | ||
shell: bash | ||
run: ./scripts/alert/lark.js | ||
env: | ||
TITLE: Rsbuild Ecosystem CI failed | ||
DESCRIPTION: | | ||
commitID: [${{github.sha}}](${{github.server_url}}/${{github.repository}}/commit/${{github.sha}}) | ||
URL: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}} | ||
LARK_WEBHOOK_URL: ${{secrets.LARK_WEBHOOK_URL}} | ||
|
||
ecosystem_ci: | ||
name: Run Ecosystem CI | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'web-infra-dev/rsbuild' && github.event_name == 'workflow_dispatch' | ||
steps: | ||
- name: Run Ecosystem CI | ||
id: eco_ci | ||
uses: convictional/[email protected] | ||
with: | ||
owner: "rspack-contrib" | ||
repo: "rsbuild-ecosystem-ci" | ||
workflow_file_name: "ecosystem-ci-selected.yml" | ||
github_token: ${{ secrets.REPO_SCOPED_TOKEN }} | ||
ref: ${{ github.event.inputs.branch }} | ||
client_payload: '{"commitSHA":"${{ github.sha }}","repo":"web-infra-dev/rsbuild","suite":"-","suiteRefType":"precoded","suiteRef":"precoded"}' |
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 |
---|---|---|
|
@@ -98,23 +98,3 @@ jobs: | |
- name: E2E Test | ||
if: steps.changes.outputs.changed == 'true' | ||
run: pnpm run e2e | ||
|
||
# ======== ecosystem_ci ======== | ||
ecosystem_ci: | ||
name: Run Ecosystem CI | ||
runs-on: ubuntu-latest | ||
if: github.repository_owner == 'web-infra-dev' | ||
# if: github.ref_name == 'main' && github.repository_owner == 'web-infra-dev' | ||
steps: | ||
- name: Run Ecosystem CI | ||
id: eco_ci | ||
uses: convictional/[email protected] | ||
with: | ||
owner: "rspack-contrib" | ||
repo: "rsbuild-ecosystem-ci" | ||
workflow_file_name: "ecosystem-ci-from-commit.yml" | ||
propagate_failure: false | ||
wait_workflow: false | ||
github_token: ${{ secrets.REPO_SCOPED_TOKEN }} | ||
ref: "main" | ||
client_payload: '{"commitSHA":"${{ github.sha }}","repo":"web-infra-dev/rsbuild","suite":"-","suiteRefType":"precoded","suiteRef":"precoded"}' |
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,61 @@ | ||
#!/bin/env node | ||
|
||
const TITLE = process.env.TITLE; | ||
const DESCRIPTION = process.env.DESCRIPTION; | ||
const URL = process.env.URL; | ||
const LARK_WEBHOOK_URL = process.env.LARK_WEBHOOK_URL; | ||
const TPL_COLOR = process.env.TPL_COLOR || 'red'; | ||
const TPL_BTN_TYPE = process.env.TPL_BTN_TYPE || 'danger'; // default primary danger | ||
|
||
if (!TITLE || !DESCRIPTION) { | ||
throw new Error('please input title and description'); | ||
} | ||
|
||
if (!LARK_WEBHOOK_URL) { | ||
console.log('missing LARK_WEBHOOK_URL, will exit'); | ||
process.exit(0); | ||
} | ||
|
||
const res = await fetch(LARK_WEBHOOK_URL, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
msg_type: 'interactive', | ||
card: { | ||
header: { | ||
template: TPL_COLOR, | ||
title: { | ||
content: TITLE, | ||
tag: 'plain_text', | ||
}, | ||
}, | ||
elements: [ | ||
{ | ||
tag: 'markdown', | ||
content: DESCRIPTION, | ||
}, | ||
URL && { | ||
tag: 'action', | ||
actions: [ | ||
{ | ||
tag: 'button', | ||
text: { | ||
content: 'Details', | ||
tag: 'plain_text', | ||
}, | ||
url: URL, | ||
type: TPL_BTN_TYPE, | ||
}, | ||
], | ||
}, | ||
].filter(Boolean), | ||
}, | ||
}), | ||
}); | ||
|
||
if (!res.ok) { | ||
const data = await res.text(); | ||
throw new Error(`send alert failed with ${data}`); | ||
} |