Skip to content

Commit 4061046

Browse files
committed
Setup React runtime tests workflow
1 parent b0c74b3 commit 4061046

File tree

3 files changed

+45
-49
lines changed

3 files changed

+45
-49
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# Clone React repo
4+
git clone https://github.com/facebook/react.git temp-react --depth=1
5+
6+
# Create workflows directory if it doesn't exist
7+
mkdir -p .github/workflows/
8+
9+
# Copy workflow file
10+
cp temp-react/.github/workflows/runtime_build_and_test.yml .github/workflows/benchmark.yml
11+
12+
# Modify with yq
13+
yq -P -i '(.jobs.* | select(.strategy == null)).strategy.matrix.runner = ["ubuntu-24.04", "devzero-ubuntu-24.04"]' .github/workflows/benchmark.yml
14+
yq -P -i '(.jobs.* | select(.strategy != null)).strategy.matrix.runner = ["ubuntu-24.04", "devzero-ubuntu-24.04"]' .github/workflows/benchmark.yml
15+
yq -P -i '.jobs.*.runs-on = "${{ matrix.runner }}"' .github/workflows/benchmark.yml
16+
yq -P -i '(.jobs.*.steps.[] | select(.uses == "actions/checkout@v4").with.repository) = "facebook/react"' .github/workflows/benchmark.yml
17+
yq -P -i '(.jobs.*.steps.[] | select(.uses == "actions/checkout@v4").with.ref) = "main"' .github/workflows/benchmark.yml
18+
19+
# Clean up
20+
rm -rf temp-react
21+
22+
# Configure git and commit
23+
git config --local user.email "$1"
24+
git config --local user.name "$2"
25+
git add .github/workflows/benchmark.yml
26+
git commit -m "Setup React runtime tests workflow" || echo "No changes to commit"
27+
git push origin main

.github/workflows/benchmark.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
# ----- FLOW -----
1818
discover_flow_inline_configs:
1919
name: Discover flow inline configs
20-
runs-on: ""
20+
runs-on: ${{ matrix.runner }}
2121
outputs:
2222
matrix: ${{ steps.set-matrix.outputs.result }}
2323
steps:
@@ -39,7 +39,7 @@ jobs:
3939
flow:
4040
name: Flow check ${{ matrix.flow_inline_config_shortname }}
4141
needs: discover_flow_inline_configs
42-
runs-on: ""
42+
runs-on: ${{ matrix.runner }}
4343
continue-on-error: true
4444
strategy:
4545
matrix:
@@ -70,7 +70,7 @@ jobs:
7070
# ----- FIZZ -----
7171
check_generated_fizz_runtime:
7272
name: Confirm generated inline Fizz runtime is up to date
73-
runs-on: ""
73+
runs-on: ${{ matrix.runner }}
7474
steps:
7575
- uses: actions/checkout@v4
7676
with:
@@ -101,7 +101,7 @@ jobs:
101101
# ----- FEATURE FLAGS -----
102102
flags:
103103
name: Check flags
104-
runs-on: ""
104+
runs-on: ${{ matrix.runner }}
105105
steps:
106106
- uses: actions/checkout@v4
107107
with:
@@ -130,7 +130,7 @@ jobs:
130130
# ----- TESTS -----
131131
test:
132132
name: yarn test ${{ matrix.params }} (Shard ${{ matrix.shard }})
133-
runs-on: ""
133+
runs-on: ${{ matrix.runner }}
134134
strategy:
135135
matrix:
136136
params:
@@ -186,7 +186,7 @@ jobs:
186186
# ----- BUILD -----
187187
build_and_lint:
188188
name: yarn build and lint
189-
runs-on: ""
189+
runs-on: ${{ matrix.runner }}
190190
strategy:
191191
matrix:
192192
# yml is dumb. update the --total arg to yarn build if you change the number of workers
@@ -293,7 +293,7 @@ jobs:
293293
- ubuntu-24.04
294294
- devzero-ubuntu-24.04
295295
continue-on-error: true
296-
runs-on: ""
296+
runs-on: ${{ matrix.runner }}
297297
steps:
298298
- uses: actions/checkout@v4
299299
with:
@@ -325,7 +325,7 @@ jobs:
325325
process_artifacts_combined:
326326
name: Process artifacts combined
327327
needs: build_and_lint
328-
runs-on: ""
328+
runs-on: ${{ matrix.runner }}
329329
steps:
330330
- uses: actions/checkout@v4
331331
with:
@@ -377,7 +377,7 @@ jobs:
377377
check_error_codes:
378378
name: Search build artifacts for unminified errors
379379
needs: build_and_lint
380-
runs-on: ""
380+
runs-on: ${{ matrix.runner }}
381381
steps:
382382
- uses: actions/checkout@v4
383383
with:
@@ -417,7 +417,7 @@ jobs:
417417
check_release_dependencies:
418418
name: Check release dependencies
419419
needs: build_and_lint
420-
runs-on: ""
420+
runs-on: ${{ matrix.runner }}
421421
steps:
422422
- uses: actions/checkout@v4
423423
with:
@@ -454,7 +454,7 @@ jobs:
454454
RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
455455
name: Check fixtures DOM (stable)
456456
needs: build_and_lint
457-
runs-on: ""
457+
runs-on: ${{ matrix.runner }}
458458
steps:
459459
- uses: actions/checkout@v4
460460
with:
@@ -500,7 +500,7 @@ jobs:
500500
run_fixtures_flight_tests:
501501
name: Run fixtures Flight tests
502502
needs: build_and_lint
503-
runs-on: ""
503+
runs-on: ${{ matrix.runner }}
504504
steps:
505505
- uses: actions/checkout@v4
506506
with:
@@ -568,7 +568,7 @@ jobs:
568568
build_devtools_and_process_artifacts:
569569
name: Build DevTools and process artifacts
570570
needs: build_and_lint
571-
runs-on: ""
571+
runs-on: ${{ matrix.runner }}
572572
steps:
573573
- uses: actions/checkout@v4
574574
with:
@@ -623,7 +623,7 @@ jobs:
623623
run_devtools_e2e_tests:
624624
name: Run DevTools e2e tests
625625
needs: build_devtools_and_process_artifacts
626-
runs-on: ""
626+
runs-on: ${{ matrix.runner }}
627627
steps:
628628
- uses: actions/checkout@v4
629629
with:
@@ -664,7 +664,7 @@ jobs:
664664
download_base_build_for_sizebot:
665665
if: ${{ github.event_name == 'pull_request' && github.ref_name != 'main' }}
666666
name: Download base build for sizebot
667-
runs-on: ""
667+
runs-on: ${{ matrix.runner }}
668668
steps:
669669
- uses: actions/checkout@v4
670670
with:
@@ -714,7 +714,7 @@ jobs:
714714
needs:
715715
- build_and_lint
716716
- download_base_build_for_sizebot
717-
runs-on: ""
717+
runs-on: ${{ matrix.runner }}
718718
steps:
719719
- uses: actions/checkout@v4
720720
with:

.github/workflows/sync.yml

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,8 @@ jobs:
2424
sudo chmod a+x /usr/local/bin/yq
2525
fi
2626
27-
- name: Clone React repo
28-
run: |
29-
git clone https://github.com/facebook/react.git temp-react --depth=1
30-
31-
- name: Copy workflow file
32-
run: |
33-
mkdir -p .github/workflows/
34-
cp temp-react/.github/workflows/runtime_build_and_test.yml .github/workflows/benchmark.yml
35-
36-
- name: Modify workflow file with yq
37-
run: |
38-
# Add runner matrix to all jobs that don't already have a matrix
39-
yq -P -i '(.jobs.* | select(.strategy == null)).strategy.matrix.runner = ["ubuntu-24.04", "devzero-ubuntu-24.04"]' .github/workflows/benchmark.yml
40-
41-
# Add runner to existing matrices
42-
yq -P -i '(.jobs.* | select(.strategy != null)).strategy.matrix.runner = ["ubuntu-24.04", "devzero-ubuntu-24.04"]' .github/workflows/benchmark.yml
43-
44-
# Set runs-on to use matrix runner
45-
yq -P -i '.jobs.*.runs-on = "${{ matrix.runner }}"' .github/workflows/benchmark.yml
46-
47-
# Add repository field to all checkout actions
48-
yq -P -i '(.jobs.*.steps.[] | select(.uses == "actions/checkout@v4").with.repository) = "facebook/react"' .github/workflows/benchmark.yml
49-
yq -P -i '(.jobs.*.steps.[] | select(.uses == "actions/checkout@v4").with.ref) = "main"' .github/workflows/benchmark.yml
50-
51-
- name: Cleanup temp files
52-
run: rm -rf temp-react
53-
54-
- name: Commit changes
27+
- name: Run sync script
5528
env:
5629
GHA_BENCHMARK: ${{ secrets.GHA_BENCHMARK }}
5730
run: |
58-
git config --local user.email "[email protected]"
59-
git config --local user.name "debot"
60-
git add .github/workflows/benchmark.yml
61-
git commit -m "Setup React runtime tests workflow" || echo "No changes to commit"
62-
git push origin main
31+
./.github/scripts/sync-react-workflow.sh "[email protected]" "debot"

0 commit comments

Comments
 (0)