Skip to content

Commit

Permalink
ci: add ecosystem ci (#8931)
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrykingxyz authored Jan 3, 2025
1 parent 0046867 commit 77e6c4a
Showing 1 changed file with 231 additions and 0 deletions.
231 changes: 231 additions & 0 deletions .github/workflows/ecosystem-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
name: Ecosystem CI

on:
workflow_dispatch:
inputs:
pr:
type: number
description: "Run ecosystem ci PR number"
required: true
suite:
description: "testsuite to run. runs all testsuits when `-`."
required: false
type: choice
options:
- "-"
- modernjs
# - nx
- rspress
- rsbuild
- rslib
- examples
- devserver
suiteRef:
description: "suite ref to use"
required: true
type: string
default: "-"
# push:
# branches:
# - main
# paths-ignore:
# - "**/*.md"
# - "website/**"
# tags-ignore:
# - "**"

jobs:
get-runner-labels:
name: Get Runner Labels
uses: ./.github/workflows/get-runner-labels.yml

build:
name: Test Linux
needs: [get-runner-labels]
uses: ./.github/workflows/reusable-build.yml
with:
target: x86_64-unknown-linux-gnu
native: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS == '"ubuntu-22.04"' }}
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/pull/{0}/head', inputs.pr) || github.sha }}
test: false
bench: false

create-comment:
runs-on: ubuntu-latest
outputs:
comment-id: ${{ steps.create-comment.outputs.result }}
steps:
- id: create-comment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
const url = `${context.serverUrl}//${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
const urlLink = `[Open](${url})`
const body = `⏳ Triggered ecosystem ci: ${urlLink}`
if (context.eventName === 'workflow_dispatch') {
const { data: comment } = await github.rest.issues.createComment({
issue_number: context.payload.inputs.pr,
owner: context.repo.owner,
repo: context.repo.repo,
body
})
return comment.id
}
const { data: comment } = await github.rest.repos.createCommitComment({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
body
})
return comment.id
calculate-eco-ci-suite:
runs-on: ubuntu-latest
outputs:
suites: ${{ steps.calculate.outputs.result }}
steps:
- id: calculate
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
const suiteName = `${{ github.event_name == 'workflow_dispatch' && inputs.suite || '-' }}`;
let result = [
"modernjs",
// "nx",
"rspress",
"rslib",
"rsbuild",
"rsdoctor",
"examples",
"devserver",
"nuxt",
]
if (suiteName !== "-") {
result = allSuite.filter(item => item === suiteName)
}
return JSON.stringify({
include: result.map(suite => ({ suite }))
})
eco-ci:
needs: [build, calculate-eco-ci-suite]
strategy:
matrix: ${{fromJson(needs.calculate-eco-ci-suite.outputs.suites)}}
fail-fast: false
name: eco-ci (${{ matrix.suite }})
runs-on: ubuntu-latest
# runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/pull/{0}/head', inputs.pr) || github.sha }}

# - name: Clean
# uses: ./.github/actions/clean
# with:
# target: x86_64-unknown-linux-gnu

- name: Download bindings
uses: ./.github/actions/download-artifact
with:
name: bindings-x86_64-unknown-linux-gnu
path: crates/node_binding/
try-local-cache: false

- name: Show restored binding
shell: bash
run: ls -lah crates/node_binding/*.node

- name: Pnpm Cache
uses: ./.github/actions/pnpm-cache

- name: Build JS
run: pnpm run build:js

- name: Run rspack-ecosystem-ci
run: |
# prepare rspack
cp ./crates/node_binding/*.node ./npm/linux-x64-gnu/
RSPACK_DIR=$(pwd)
cd ..
git clone --single-branch --depth 1 https://github.com/web-infra-dev/rspack-ecosystem-ci.git
cd rspack-ecosystem-ci
pnpm i --frozen-lockfile
mkdir -p ./workspace
ln -s $RSPACK_DIR ./workspace/rspack
SUITE='${{ matrix.suite }}'
SUITE_REF='${{ inputs.suiteRef || '-' }}'
if [[ "$SUITE_REF" != "-" ]]; then
# run test suite with suiteRef
pnpm tsx ecosystem-ci.ts run-suites --suite-commit "$SUITE_REF" "$SUITE"
echo "finish run $SUITE with $SUITE_REF"
else
# run test suite
pnpm tsx ecosystem-ci.ts run-suites "$SUITE"
echo "finish run $SUITE"
fi
comment-compare-results:
runs-on: ubuntu-latest
needs: [create-comment, eco-ci]
if: ${{ !cancelled() }}
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data } = await github.rest.actions.listJobsForWorkflowRunAttempt({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId,
attempt_number: ${{ github.run_attempt }},
})
const jobs = data?.jobs || []
let result = jobs
.filter(job => job.name.startsWith('eco-ci '))
.filter(job => job.conclusion !== 'skipped')
.map(job => {
const suite = job.name.replace(/^eco-ci \(([^)]+)\)$/, "$1")
return { suite, conclusion: job.conclusion, link: job.html_url }
})
const conclusionEmoji = {
success: ":white_check_mark:",
failure: ":x:",
cancelled: ":stop_button:"
}
const url = `${context.serverUrl}//${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
const urlLink = `[Open](${url})`
const body = result.length ? ` 📝 Ecosystem CI detail: ${urlLink}
| suite | result |
|-------|--------|
${result.map(r => `| [${r.suite}](${r.link}) | ${conclusionEmoji[r.conclusion]} ${r.conclusion} |`).join("\n")}
` : ` 📝 Ecosystem CI failed: ${urlLink}`
if (context.eventName === 'workflow_dispatch') {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: `${{ needs.create-comment.outputs.comment-id }}`,
body
})
} else {
await github.rest.repos.updateCommitComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: `${{ needs.create-comment.outputs.comment-id }}`,
body,
});
}

1 comment on commit 77e6c4a

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented on 77e6c4a Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2025-01-03 649c656) Current Change
10000_big_production-mode_disable-minimize + exec 37.6 s ± 265 ms 37.9 s ± 563 ms +1.00 %
10000_development-mode + exec 1.89 s ± 24 ms 1.79 s ± 19 ms -5.17 %
10000_development-mode_hmr + exec 677 ms ± 14 ms 673 ms ± 6.1 ms -0.62 %
10000_production-mode + exec 2.52 s ± 76 ms 2.43 s ± 46 ms -3.48 %
arco-pro_development-mode + exec 1.74 s ± 81 ms 1.73 s ± 70 ms -0.66 %
arco-pro_development-mode_hmr + exec 377 ms ± 1.5 ms 376 ms ± 0.66 ms -0.14 %
arco-pro_production-mode + exec 3.64 s ± 80 ms 3.51 s ± 77 ms -3.54 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.66 s ± 97 ms 3.56 s ± 110 ms -2.80 %
arco-pro_production-mode_traverse-chunk-modules + exec 3.65 s ± 70 ms 3.52 s ± 112 ms -3.57 %
threejs_development-mode_10x + exec 1.5 s ± 22 ms 1.45 s ± 22 ms -3.37 %
threejs_development-mode_10x_hmr + exec 780 ms ± 18 ms 772 ms ± 26 ms -1.09 %
threejs_production-mode_10x + exec 5.38 s ± 127 ms 5.33 s ± 64 ms -0.84 %
10000_big_production-mode_disable-minimize + rss memory 9517 MiB ± 179 MiB 9547 MiB ± 51.4 MiB +0.31 %
10000_development-mode + rss memory 650 MiB ± 10.7 MiB 704 MiB ± 10.5 MiB +8.27 %
10000_development-mode_hmr + rss memory 1371 MiB ± 227 MiB 1541 MiB ± 388 MiB +12.41 %
10000_production-mode + rss memory 625 MiB ± 18.8 MiB 724 MiB ± 66.5 MiB +15.72 %
arco-pro_development-mode + rss memory 589 MiB ± 30.1 MiB 639 MiB ± 42.2 MiB +8.49 %
arco-pro_development-mode_hmr + rss memory 635 MiB ± 85.2 MiB 664 MiB ± 89.1 MiB +4.51 %
arco-pro_production-mode + rss memory 749 MiB ± 48.7 MiB 773 MiB ± 49.9 MiB +3.28 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 725 MiB ± 45.5 MiB 773 MiB ± 23.7 MiB +6.70 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 734 MiB ± 41.6 MiB 777 MiB ± 32.4 MiB +5.88 %
threejs_development-mode_10x + rss memory 589 MiB ± 20.5 MiB 683 MiB ± 28.3 MiB +15.91 %
threejs_development-mode_10x_hmr + rss memory 1135 MiB ± 200 MiB 1226 MiB ± 189 MiB +8.05 %
threejs_production-mode_10x + rss memory 852 MiB ± 24.9 MiB 928 MiB ± 45 MiB +8.88 %

Please sign in to comment.