Skip to content

Commit bd55ab7

Browse files
authored
[code-infra] Use the same CI names on master & next (#43064)
1 parent 40792e6 commit bd55ab7

File tree

3 files changed

+96
-1
lines changed

3 files changed

+96
-1
lines changed

.circleci/config.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,48 +889,106 @@ workflows:
889889
jobs:
890890
- test_profile:
891891
<<: *default-context
892+
893+
# This workflow can be triggered manually on the PR
892894
react-17:
895+
when:
896+
equal: [react-17, << pipeline.parameters.workflow >>]
897+
jobs:
898+
- test_unit:
899+
<<: *default-context
900+
react-version: ^17.0.0
901+
name: test_unit-react@17
902+
- test_browser:
903+
<<: *default-context
904+
react-version: ^17.0.0
905+
name: test_browser-react@17
906+
- test_regressions:
907+
<<: *default-context
908+
react-version: ^17.0.0
909+
name: test_regressions-react@17
910+
- test_e2e:
911+
<<: *default-context
912+
react-version: ^17.0.0
913+
name: test_e2e-react@17
914+
915+
# This workflow is identical to react-17, but scheduled
916+
react-17-cron:
893917
triggers:
894918
- schedule:
895919
cron: '0 0 * * *'
896920
filters:
897921
branches:
898922
only:
899923
- master
924+
- next
900925
jobs:
901926
- test_unit:
902927
<<: *default-context
903928
react-version: ^17.0.0
929+
name: test_unit-react@17
904930
- test_browser:
905931
<<: *default-context
906932
react-version: ^17.0.0
933+
name: test_browser-react@17
907934
- test_regressions:
908935
<<: *default-context
909936
react-version: ^17.0.0
937+
name: test_regressions-react@17
910938
- test_e2e:
911939
<<: *default-context
912940
react-version: ^17.0.0
941+
name: test_e2e-react@17
942+
943+
# This workflow can be triggered manually on the PR
913944
react-next:
945+
when:
946+
equal: [react-next, << pipeline.parameters.workflow >>]
947+
jobs:
948+
- test_unit:
949+
<<: *default-context
950+
react-version: next
951+
name: test_unit-react@next
952+
- test_browser:
953+
<<: *default-context
954+
react-version: next
955+
name: test_browser-react@next
956+
- test_regressions:
957+
<<: *default-context
958+
react-version: next
959+
name: test_regressions-react@next
960+
- test_e2e:
961+
<<: *default-context
962+
react-version: next
963+
name: test_e2e-react@next
964+
# This workflow is identical to react-next, but scheduled
965+
react-next-cron:
914966
triggers:
915967
- schedule:
916968
cron: '0 0 * * *'
917969
filters:
918970
branches:
919971
only:
920972
- master
973+
- next
921974
jobs:
922975
- test_unit:
923976
<<: *default-context
924977
react-version: next
978+
name: test_unit-react@next
925979
- test_browser:
926980
<<: *default-context
927981
react-version: next
982+
name: test_browser-react@next
928983
- test_regressions:
929984
<<: *default-context
930985
react-version: next
986+
name: test_regressions-react@next
931987
- test_e2e:
932988
<<: *default-context
933989
react-version: next
990+
name: test_e2e-react@next
991+
934992
typescript-next:
935993
triggers:
936994
- schedule:
@@ -939,6 +997,7 @@ workflows:
939997
branches:
940998
only:
941999
- master
1000+
- next
9421001
jobs:
9431002
- test_types_next:
9441003
<<: *default-context

scripts/useReactVersion.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ async function main(version) {
9797

9898
// add newline for clean diff
9999
fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}${os.EOL}`);
100+
101+
console.log('Installing dependencies...');
102+
const pnpmInstall = childProcess.spawn('pnpm', ['install', '--no-frozen-lockfile'], {
103+
shell: true,
104+
stdio: ['inherit', 'inherit', 'inherit'],
105+
});
106+
pnpmInstall.on('exit', (exitCode) => {
107+
if (exitCode !== 0) {
108+
throw new Error('Failed to install dependencies');
109+
}
110+
});
100111
}
101112

102113
const [version = process.env.REACT_VERSION] = process.argv.slice(2);

test/README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,11 @@ For example, in https://app.circleci.com/pipelines/github/mui/material-ui/32796/
244244

245245
### Testing multiple versions of React
246246

247-
You can check integration of different versions of React (for example different [release channels](https://react.dev/community/versioning-policy) or PRs to React) by running `node scripts/useReactVersion.mjs <version>`.
247+
You can check integration of different versions of React (for example different [release channels](https://react.dev/community/versioning-policy) or PRs to React) by running:
248+
249+
```bash
250+
pnpm use-react-version <version>
251+
```
248252

249253
Possible values for `version`:
250254

@@ -254,6 +258,27 @@ Possible values for `version`:
254258

255259
#### CI
256260

261+
##### Circle CI web interface
262+
263+
There are two workflows that can be triggered for any given PR manually in the CircleCI web interface:
264+
265+
- `react-next`
266+
- `react-17`
267+
268+
Follow these steps:
269+
270+
1. Go to https://app.circleci.com/pipelines/github/mui/material-ui?branch=pull/PR_NUMBER/head and replace `PR_NUMBER` with the PR number you want to test.
271+
2. Click `Trigger Pipeline` button.
272+
3. Expand `Add parameters (optional)` and add the following parameter:
273+
274+
| Parameter type | Name | Value |
275+
| :------------- | :--------- | :------------------------- |
276+
| `string` | `workflow` | `react-next` or `react-17` |
277+
278+
4. Click `Trigger Pipeline` button.
279+
280+
##### API request
281+
257282
You can pass the same `version` to our CircleCI pipeline as well:
258283

259284
With the following API request we're triggering a run of the default workflow in

0 commit comments

Comments
 (0)