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
47 changes: 44 additions & 3 deletions .github/workflows/runtime_build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,6 @@ jobs:
-r=experimental --env=development,
-r=experimental --env=production,

# Dev Tools
--project=devtools -r=experimental,

# TODO: Update test config to support www build tests
# - "-r=www-classic --env=development --variant=false"
# - "-r=www-classic --env=production --variant=false"
Expand Down Expand Up @@ -450,6 +447,50 @@ jobs:
run: ls -R build
- run: yarn test --build ${{ matrix.test_params }} --shard=${{ matrix.shard }} --ci

test_build_devtools:
name: yarn test-build (devtools)
needs: [build_and_lint, runtime_node_modules_cache]
strategy:
fail-fast: false
matrix:
shard:
- 1/5
- 2/5
- 3/5
- 4/5
- 5/5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.commit_sha != '' && github.event.inputs.commit_sha || github.event.pull_request.head.sha || github.sha }}
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
cache-dependency-path: yarn.lock
- name: Restore cached node_modules
uses: actions/cache/restore@v4
id: node_modules
with:
path: |
**/node_modules
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
- name: Ensure clean build directory
run: rm -rf build
- run: yarn install --frozen-lockfile
if: steps.node_modules.outputs.cache-hit != 'true'
- name: Restore archived build
uses: actions/download-artifact@v4
with:
pattern: _build_*
path: build
merge-multiple: true
- name: Display structure of build
run: ls -R build
- run: yarn test --build --project=devtools -r=experimental --shard=${{ matrix.shard }} --ci

process_artifacts_combined:
name: Process artifacts combined
needs: [build_and_lint, runtime_node_modules_cache]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ describe('ProfilerContext', () => {
expect(store.profilerStore.isProfilingBasedOnUserInput).toBe(false);

document.body.removeChild(profilerContainer);
});
}, 20000);

it('should navigate between commits when the keyboard shortcut is pressed', async () => {
const Parent = () => <Child />;
Expand Down
1 change: 1 addition & 0 deletions scripts/jest/config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module.exports = {
globalSetup: require.resolve('./setupGlobal.js'),
testSequencer: require.resolve('./sizeBalancedSequencer.js'),
modulePathIgnorePatterns: [
'<rootDir>/scripts/rollup/shims/',
'<rootDir>/scripts/bench/',
Expand Down
28 changes: 28 additions & 0 deletions scripts/jest/sizeBalancedSequencer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use strict';

const Sequencer = require('@jest/test-sequencer').default;
const fs = require('fs');

class SizeBalancedSequencer extends Sequencer {
shard(tests, {shardIndex, shardCount}) {
const shards = Array.from({length: shardCount}, () => ({
tests: [],
size: 0,
}));
const sorted = [...tests].sort(
(a, b) => fs.statSync(b.path).size - fs.statSync(a.path).size
);

for (let i = 0; i < sorted.length; i++) {
const test = sorted[i];
const size = fs.statSync(test.path).size;
const smallest = shards.reduce((min, s) => (s.size < min.size ? s : min));
smallest.tests.push(test);
smallest.size += size;
}

return shards[shardIndex - 1].tests;
}
}

module.exports = SizeBalancedSequencer;
Loading