From 3a23936dd76be37a6dc6a8b0acfcd2f9d40565ac Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Wed, 24 Jul 2024 11:32:37 +0200 Subject: [PATCH 1/5] Batch building/compiling tests --- packages/test-harness/scripts/build-tests.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/test-harness/scripts/build-tests.sh b/packages/test-harness/scripts/build-tests.sh index 462955afc4..3b1674d66c 100755 --- a/packages/test-harness/scripts/build-tests.sh +++ b/packages/test-harness/scripts/build-tests.sh @@ -1,6 +1,12 @@ #!/usr/bin/env bash set -euo pipefail -TESTS="$(find .. -name '*.test.ts')" +mapfile -t TESTS < <(find .. -name '*.test.ts') -pnpm run build:base --outdir=dist --out-extension:.js=.cjs $TESTS +BATCH_SIZE=50 +SIZE=${#TESTS[@]} + +for ((i = 0; i < SIZE; i += BATCH_SIZE)); do + BATCH=${TESTS[@]:i:BATCH_SIZE} + pnpm run build:base --outdir=dist --out-extension:.js=.cjs $BATCH +done From a78c64425689816d511b3a328f354e9dc039fc5d Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Wed, 24 Jul 2024 12:10:58 +0200 Subject: [PATCH 2/5] new solution --- packages/test-harness/scripts/build-tests.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/test-harness/scripts/build-tests.sh b/packages/test-harness/scripts/build-tests.sh index 3b1674d66c..7faea17c5a 100755 --- a/packages/test-harness/scripts/build-tests.sh +++ b/packages/test-harness/scripts/build-tests.sh @@ -1,7 +1,13 @@ #!/usr/bin/env bash set -euo pipefail -mapfile -t TESTS < <(find .. -name '*.test.ts') +# Initialize an empty array to hold the test files +TESTS=() + +# Read the output of the find command into the TESTS array +while IFS= read -r file; do + TESTS+=("$file") +done < <(find .. -name '*.test.ts') BATCH_SIZE=50 SIZE=${#TESTS[@]} @@ -9,4 +15,4 @@ SIZE=${#TESTS[@]} for ((i = 0; i < SIZE; i += BATCH_SIZE)); do BATCH=${TESTS[@]:i:BATCH_SIZE} pnpm run build:base --outdir=dist --out-extension:.js=.cjs $BATCH -done +done \ No newline at end of file From 938ea64ae51a643823ffe63ee0fd29309292621b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Wed, 24 Jul 2024 10:12:29 +0000 Subject: [PATCH 3/5] [pre-commit.ci lite] apply automatic fixes --- packages/test-harness/scripts/build-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/test-harness/scripts/build-tests.sh b/packages/test-harness/scripts/build-tests.sh index 7faea17c5a..0b68b8f050 100755 --- a/packages/test-harness/scripts/build-tests.sh +++ b/packages/test-harness/scripts/build-tests.sh @@ -15,4 +15,4 @@ SIZE=${#TESTS[@]} for ((i = 0; i < SIZE; i += BATCH_SIZE)); do BATCH=${TESTS[@]:i:BATCH_SIZE} pnpm run build:base --outdir=dist --out-extension:.js=.cjs $BATCH -done \ No newline at end of file +done From 5de2b27b8c5f0057b4b2ab87ffc5336f1cda2e59 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Wed, 24 Jul 2024 12:13:37 +0200 Subject: [PATCH 4/5] Use xargs --- packages/test-harness/scripts/build-tests.sh | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/packages/test-harness/scripts/build-tests.sh b/packages/test-harness/scripts/build-tests.sh index 7faea17c5a..c9b199a794 100755 --- a/packages/test-harness/scripts/build-tests.sh +++ b/packages/test-harness/scripts/build-tests.sh @@ -1,18 +1,4 @@ #!/usr/bin/env bash set -euo pipefail -# Initialize an empty array to hold the test files -TESTS=() - -# Read the output of the find command into the TESTS array -while IFS= read -r file; do - TESTS+=("$file") -done < <(find .. -name '*.test.ts') - -BATCH_SIZE=50 -SIZE=${#TESTS[@]} - -for ((i = 0; i < SIZE; i += BATCH_SIZE)); do - BATCH=${TESTS[@]:i:BATCH_SIZE} - pnpm run build:base --outdir=dist --out-extension:.js=.cjs $BATCH -done \ No newline at end of file +find .. -name '*.test.ts' | xargs -n 50 pnpm run build:base --outdir=dist --out-extension:.js=.cjs \ No newline at end of file From 6595de47c34ac9e112e6f46b4ae687462f948edb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Wed, 24 Jul 2024 10:16:06 +0000 Subject: [PATCH 5/5] [pre-commit.ci lite] apply automatic fixes --- packages/test-harness/scripts/build-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/test-harness/scripts/build-tests.sh b/packages/test-harness/scripts/build-tests.sh index c9b199a794..b5c99511ea 100755 --- a/packages/test-harness/scripts/build-tests.sh +++ b/packages/test-harness/scripts/build-tests.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -euo pipefail -find .. -name '*.test.ts' | xargs -n 50 pnpm run build:base --outdir=dist --out-extension:.js=.cjs \ No newline at end of file +find .. -name '*.test.ts' | xargs -n 50 pnpm run build:base --outdir=dist --out-extension:.js=.cjs