-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit f297c69
Showing
26 changed files
with
3,955 additions
and
0 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,12 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = tab | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
|
||
[package.json] | ||
indent_style = space |
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,32 @@ | ||
// @ts-check | ||
const { defineConfig } = require('eslint-define-config') | ||
|
||
module.exports = defineConfig({ | ||
root: true, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:n/recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2021, | ||
}, | ||
rules: { | ||
eqeqeq: ['warn', 'always', { null: 'never' }], | ||
'no-debugger': ['error'], | ||
'no-empty': ['warn', { allowEmptyCatch: true }], | ||
'no-process-exit': 'off', | ||
'no-useless-escape': 'off', | ||
'prefer-const': [ | ||
'warn', | ||
{ | ||
destructuring: 'all', | ||
}, | ||
], | ||
'n/no-missing-import': 'off', // doesn't like ts imports | ||
'n/no-process-exit': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', // we use any in some places | ||
}, | ||
}) |
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,47 @@ | ||
name: 'Build Rsbuild' | ||
description: 'Checkout, build rsbuild' | ||
inputs: | ||
repository: | ||
description: 'The rsbuild repository to use' | ||
required: true | ||
default: 'web-infra-dev/rsbuild' | ||
path: | ||
description: 'Destination path to the rsbuild repository' | ||
required: true | ||
default: 'workspace/rsbuild' | ||
ref: | ||
description: 'The branch, tag or SHA to checkout' | ||
required: true | ||
default: 'main' | ||
node-version: | ||
description: 'The version of Node.js to set up' | ||
required: true | ||
default: '18' | ||
outputs: | ||
artifact-name: | ||
description: 'The name of the uploaded artifact' | ||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- shell: bash | ||
name: Install package manager | ||
run: | | ||
npm install -g [email protected] | ||
echo "Corepack version: $(corepack --version)" | ||
corepack enable | ||
- name: Checkout Rsbuild repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ inputs.repository }} | ||
path: ${{ inputs.path }} | ||
ref: ${{ inputs.ref }} | ||
- name: Build Rsbuild | ||
shell: bash | ||
run: | | ||
cd ${{ inputs.path }} | ||
pnpm i | ||
pnpm run build |
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,15 @@ | ||
{ | ||
"extends": ["config:base", "schedule:weekly", "group:allNonMajor"], | ||
"labels": ["dependencies"], | ||
"ignorePaths": [], | ||
"pin": false, | ||
"rangeStrategy": "bump", | ||
"node": false, | ||
"packageRules": [ | ||
{ | ||
"depTypeList": ["peerDependencies", "engines"], | ||
"enabled": false, | ||
}, | ||
], | ||
"ignoreDeps": [], | ||
} |
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,44 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
get-runner-labels: | ||
name: Get Runner Labels | ||
uses: ./.github/workflows/get-runner-labels.yml | ||
|
||
ci: | ||
needs: [get-runner-labels] | ||
strategy: | ||
matrix: | ||
include: | ||
- suite: modernjs | ||
os: ubuntu-latest | ||
- suite: plugins | ||
os: ubuntu-latest | ||
- suite: rspress | ||
os: ubuntu-latest | ||
- suite: examples | ||
os: ubuntu-latest | ||
- suite: rslib | ||
os: ubuntu-latest | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
name: ${{ matrix.suite }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/build-rsbuild | ||
- name: Install | ||
run: pnpm install --frozen-lockfile --prefer-offline | ||
- name: Expose GitHub Runtime | ||
uses: crazy-max/ghaction-github-runtime@v3 | ||
- run: >- | ||
pnpm tsx ecosystem-ci.ts | ||
run-suites | ||
${{ matrix.suite }} |
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,162 @@ | ||
# integration tests for rsbuild ecosystem - run from pr comments | ||
name: rsbuild-ecosystem-ci-from-commit | ||
|
||
env: | ||
# 7 GiB by default on GitHub, setting to 6 GiB | ||
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | ||
NODE_OPTIONS: --max-old-space-size=6144 | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
commitSHA: | ||
description: "commit sha" | ||
required: true | ||
type: string | ||
repo: | ||
description: "rsbuild repository to use" | ||
required: true | ||
type: string | ||
default: "web-infra-dev/rsbuild" | ||
suite: | ||
description: "testsuite to run. runs all testsuits when `-`." | ||
required: false | ||
type: choice | ||
options: | ||
- "-" | ||
- modernjs | ||
# - nx | ||
- rspress | ||
- rslib | ||
- rsbuild | ||
- examples | ||
- devserver | ||
suiteRefType: | ||
description: "type of suite ref to use" | ||
required: true | ||
type: choice | ||
options: | ||
- precoded | ||
- branch | ||
- tag | ||
- commit | ||
default: "precoded" | ||
suiteRef: | ||
description: "suite ref to use" | ||
required: true | ||
type: string | ||
default: "precoded" | ||
|
||
jobs: | ||
get-runner-labels: | ||
name: Get Runner Labels | ||
uses: ./.github/workflows/get-runner-labels.yml | ||
|
||
execute-selected-suite: | ||
runs-on: ubuntu-latest | ||
needs: [get-runner-labels] | ||
if: "inputs.suite != '-'" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/build-rsbuild | ||
with: | ||
repository: ${{ inputs.repo }} | ||
ref: ${{ inputs.commitSHA }} | ||
- run: pnpm i --frozen-lockfile | ||
- name: Expose GitHub Runtime | ||
uses: crazy-max/ghaction-github-runtime@v3 | ||
- run: >- | ||
pnpm tsx ecosystem-ci.ts | ||
run-suites | ||
--suite-${{ inputs.suiteRefType }} ${{ inputs.suiteRef }} | ||
${{ inputs.suite }} | ||
|
||
execute-all: | ||
needs: [get-runner-labels] | ||
if: "inputs.suite == '-'" | ||
strategy: | ||
matrix: | ||
include: | ||
- suite: modernjs | ||
os: ubuntu-latest | ||
- suite: plugins | ||
os: ubuntu-latest | ||
- suite: rspress | ||
os: ubuntu-latest | ||
- suite: rslib | ||
os: ubuntu-latest | ||
- suite: rsbuild | ||
os: ubuntu-latest | ||
- suite: examples | ||
os: ubuntu-latest | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
name: execute-all (${{ matrix.suite }}) | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: moonrepo/setup-rust@v1 | ||
- uses: ./.github/actions/build-rsbuild | ||
with: | ||
repository: ${{ inputs.repo }} | ||
ref: ${{ inputs.commitSHA }} | ||
- run: pnpm i --frozen-lockfile | ||
- name: Expose GitHub Runtime | ||
uses: crazy-max/ghaction-github-runtime@v3 | ||
- run: >- | ||
pnpm tsx ecosystem-ci.ts | ||
run-suites | ||
${{ matrix.suite }} | ||
|
||
update-comment: | ||
runs-on: ubuntu-latest | ||
needs: [execute-selected-suite, execute-all] | ||
if: always() | ||
steps: | ||
- uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.ECOSYSTEM_CI_ACCESS_TOKEN }} | ||
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 selectedSuite = context.payload.inputs.suite | ||
let result | ||
if (selectedSuite !== "-") { | ||
const { conclusion, html_url } = jobs.find(job => job.name === "execute-selected-suite") | ||
result = [{ suite: `${selectedSuite} ${context.payload.inputs.suiteRefType} ${context.payload.inputs.suiteRef}`, conclusion, link: html_url }] | ||
} else { | ||
result = jobs | ||
.filter(job => job.name.startsWith('execute-all ')) | ||
.map(job => { | ||
const suite = job.name.replace(/^execute-all \(([^)]+)\)$/, "$1") | ||
return { suite, conclusion: job.conclusion, link: job.html_url } | ||
}) | ||
} | ||
|
||
const url = `${context.serverUrl}//${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` | ||
const urlLink = `[Open](${url})` | ||
|
||
const conclusionEmoji = { | ||
success: ":white_check_mark:", | ||
failure: ":x:", | ||
cancelled: ":stop_button:" | ||
} | ||
|
||
const body = ` | ||
📝 Ran ecosystem CI: ${urlLink} | ||
|
||
| suite | result | | ||
|-------|--------| | ||
${result.map(r => `| [${r.suite}](${r.link}) | ${conclusionEmoji[r.conclusion]} ${r.conclusion} |`).join("\n")} | ||
` | ||
|
||
await github.rest.repos.createCommitComment({ | ||
commit_sha: context.payload.inputs.commitSHA, | ||
owner: context.repo.owner, | ||
repo: 'rsbuild', | ||
body | ||
}) |
Oops, something went wrong.