Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/actions/build-rspack/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ outputs:
runs:
using: composite
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 22
- shell: bash
Expand All @@ -35,6 +35,7 @@ runs:
repository: ${{ inputs.repository }}
path: ${{ inputs.path }}
ref: ${{ inputs.ref }}

- uses: actions/download-artifact@v4
with:
name: binding-linux-x64-gnu
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/prepare-rspack-binding/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ inputs:
node-version:
description: 'The version of Node.js to set up'
required: true
default: '18'
default: '22'
outputs:
artifact-name:
description: 'The name of the uploaded artifact'
Expand All @@ -29,7 +29,7 @@ runs:
repository: ${{ inputs.repository }}
path: ${{ inputs.path }}
ref: ${{ inputs.ref }}
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- shell: bash
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- suite: rstest
os: ubuntu-latest
- suite: rspress
os: macos-latest
os: ubuntu-latest
- suite: plugins
os: ubuntu-latest
- suite: modernjs
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- suite: rstest
os: ubuntu-latest
- suite: rspress
os: macos-latest
os: ubuntu-latest
- suite: rsdoctor
os: ubuntu-latest
fail-fast: false
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
# - suite: nx
# os: ubuntu-22.04
- suite: rspress
os: macos-latest
os: ubuntu-22.04
- suite: rsbuild
os: ubuntu-22.04
- suite: examples
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rsbuild-ecosystem-ci-from-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ on:

jobs:
execute-selected-suite:
runs-on: ${{ inputs.suite == 'rspress' && 'macos-latest' || 'ubuntu-latest' }}
runs-on: ubuntu-latest
if: "inputs.suite != '-'"
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
- suite: rstest
os: ubuntu-latest
- suite: rspress
os: macos-latest
os: ubuntu-latest
- suite: plugins
os: ubuntu-latest
- suite: modernjs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rsbuild-ecosystem-ci-from-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ on:

jobs:
execute-selected-suite:
runs-on: ${{ inputs.suite == 'rspress' && 'macos-latest' || 'ubuntu-latest' }}
runs-on: ubuntu-latest
if: "inputs.suite != '-'"
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
- suite: rstest
os: ubuntu-latest
- suite: rspress
os: macos-latest
os: ubuntu-latest
- suite: plugins
os: ubuntu-latest
- suite: modernjs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rsbuild-ecosystem-ci-selected.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ on:

jobs:
execute-selected-suite:
runs-on: ${{ inputs.suite == 'rspress' && 'macos-latest' || 'ubuntu-latest' }}
runs-on: ubuntu-latest
if: "inputs.suite != '-'"
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
- suite: rstest
os: ubuntu-latest
- suite: rspress
os: macos-latest
os: ubuntu-latest
- suite: plugins
os: ubuntu-latest
- suite: modernjs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rslib-ecosystem-ci-from-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ on:

jobs:
execute-selected-suite:
runs-on: ${{ inputs.suite == 'rspress' && 'macos-latest' || 'ubuntu-latest' }}
runs-on: ubuntu-latest
if: "inputs.suite != '-'"
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
- suite: rstest
os: ubuntu-latest
- suite: rspress
os: macos-latest
os: ubuntu-latest
- suite: rsdoctor
os: ubuntu-latest
fail-fast: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rslib-ecosystem-ci-from-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ on:

jobs:
execute-selected-suite:
runs-on: ${{ inputs.suite == 'rspress' && 'macos-latest' || 'ubuntu-latest' }}
runs-on: ubuntu-latest
if: "inputs.suite != '-'"
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
- suite: rstest
os: ubuntu-latest
- suite: rspress
os: macos-latest
os: ubuntu-latest
- suite: rsdoctor
os: ubuntu-latest
fail-fast: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rslib-ecosystem-ci-selected.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ on:

jobs:
execute-selected-suite:
runs-on: ${{ inputs.suite == 'rspress' && 'macos-latest' || 'ubuntu-latest' }}
runs-on: ubuntu-latest
if: "inputs.suite != '-'"
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
- suite: rstest
os: ubuntu-latest
- suite: rspress
os: macos-latest
os: ubuntu-latest
- suite: rsdoctor
os: ubuntu-latest
fail-fast: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rspack-ecosystem-ci-from-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
ref: ${{ inputs.commitSHA }}

execute-selected-suite:
runs-on: ${{ inputs.suite == 'rspress' && 'macos-latest' || 'ubuntu-22.04' }}
runs-on: ubuntu-22.04
needs: [get-runner-labels, prepare-binding]
if: "inputs.suite != '-'"
steps:
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
- suite: rsdoctor
os: ubuntu-22.04
- suite: rspress
os: macos-latest
os: ubuntu-22.04
- suite: rslib
os: ubuntu-22.04
- suite: rstest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rspack-ecosystem-ci-from-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
ref: ${{ inputs.branchName }}

execute-selected-suite:
runs-on: ${{ inputs.suite == 'rspress' && 'macos-latest' || 'ubuntu-22.04' }}
runs-on: ubuntu-22.04
needs: prepare-binding
if: "inputs.suite != '-'"
steps:
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
# - suite: nx
# os: ubuntu-22.04
- suite: rspress
os: macos-latest
os: ubuntu-22.04
- suite: rslib
os: ubuntu-22.04
- suite: rstest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rspack-ecosystem-ci-selected.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:

execute-selected-suite:
needs: prepare-binding
runs-on: ${{ inputs.suite == 'rspress' && 'macos-latest' || 'ubuntu-22.04' }}
runs-on: ubuntu-22.04
if: "inputs.suite != '-'"
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
# - suite: nx
# os: ubuntu-22.04
- suite: rspress
os: macos-latest
os: ubuntu-22.04
- suite: rslib
os: ubuntu-22.04
- suite: rstest
Expand Down
2 changes: 1 addition & 1 deletion tests/rsbuild/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export async function test(options: RunOptions) {
},
overrides: {
// not override rslib's rsbuild version
'@rslib/core>@rsbuild/core': 'latest',
'@rslib/core>@rsbuild/core': '1.7.3',
},
test: [
'build',
Expand Down
61 changes: 53 additions & 8 deletions utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ interface RspackPackageData {

let rspackPackageData: RspackPackageData | null = null;

const RSLIB_RSBUILD_COMPAT_VERSION = '1.7.3';
const RSLIB_RSPACK_COMPAT_VERSION = '1.7.6';

export function cd(dir: string) {
cwd = path.resolve(cwd, dir);
}
Expand Down Expand Up @@ -328,12 +331,24 @@ async function getRspackPackageData(): Promise<RspackPackageData> {
name: pkg.name,
directory: path.join(stackPath, pkg.directory),
});
const normalizeAndFilterExisting = (pkgList: RspackPackageInfo[]) =>
pkgList.map(normalize).filter((pkg) => {
if (fs.existsSync(pkg.directory)) {
return true;
}
console.warn(
`[ecosystem-ci] skip missing rspack package override: ${pkg.name} -> ${pkg.directory}`,
);
return false;
});
rspackPackageData = {
npm: npm[
optionalKey as 'darwin-arm64' | 'darwin-x64' | 'linux-x64' | 'win32-x64'
].map(normalize),
binding: binding.map(normalize),
packages: packages.map(normalize),
npm: normalizeAndFilterExisting(
npm[
optionalKey as 'darwin-arm64' | 'darwin-x64' | 'linux-x64' | 'win32-x64'
],
),
binding: normalizeAndFilterExisting(binding),
packages: normalizeAndFilterExisting(packages),
};
return rspackPackageData;
}
Expand Down Expand Up @@ -462,6 +477,9 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
overrides[pkgInfo.name] ||= pkgInfo.directory;
}
}
if (activeStack === 'rsbuild') {
overrides['@rslib/core>@rsbuild/core'] ||= RSLIB_RSBUILD_COMPAT_VERSION;
}
await applyPackageOverrides({
dir,
pkg,
Expand Down Expand Up @@ -503,6 +521,18 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
overrides[pkgInfo.name] ||= pkgInfo.directory;
}
}
overrides['@rslib/core>@rsbuild/core'] ||= RSLIB_RSBUILD_COMPAT_VERSION;
overrides[
`@rsbuild/core@${RSLIB_RSBUILD_COMPAT_VERSION}>@rspack/core`
] ||= RSLIB_RSPACK_COMPAT_VERSION;
overrides[
`@rspack/core@${RSLIB_RSPACK_COMPAT_VERSION}>@rspack/binding`
] ||= RSLIB_RSPACK_COMPAT_VERSION;
for (const pkgInfo of npm) {
overrides[
`@rspack/binding@${RSLIB_RSPACK_COMPAT_VERSION}>${pkgInfo.name}`
] ||= RSLIB_RSPACK_COMPAT_VERSION;
}
await applyPackageOverrides({
dir,
pkg,
Expand Down Expand Up @@ -714,6 +744,15 @@ async function applyPackageOverrides({
};
devDependencyStrategy?: 'all' | 'local';
}) {
const isValidManifestDepName = (name: string): boolean => {
if (name.includes('>')) {
return false;
}
if (name.startsWith('@')) {
return name.indexOf('@', 1) === -1;
}
return !name.includes('@');
};
const useFileProtocol = (v: string) =>
isLocalOverride(v) ? `file:${path.resolve(v)}` : v;
const normalizedOverrides = Object.fromEntries(
Expand All @@ -724,10 +763,16 @@ async function applyPackageOverrides({

const devOverrides =
devDependencyStrategy === 'all'
? normalizedOverrides
? Object.fromEntries(
Object.entries(normalizedOverrides).filter(([key]) =>
isValidManifestDepName(key),
),
)
: Object.fromEntries(
Object.entries(normalizedOverrides).filter(([_key, value]) =>
(value as string).startsWith('file:'),
Object.entries(normalizedOverrides).filter(
([key, value]) =>
isValidManifestDepName(key) &&
(value as string).startsWith('file:'),
),
);

Expand Down
Loading