Skip to content

Commit be0ff01

Browse files
committed
build: batch file lists to avoid argument list too long errors
When a PR touches many packages, the affected tests/benchmarks CI scripts collect all file paths into a single shell variable that can exceed the OS ARG_MAX limit. Batch make invocations via xargs in the shell scripts. --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: passed - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent ea63211 commit be0ff01

File tree

2 files changed

+8
-4
lines changed
  • .github/workflows/scripts
    • run_affected_benchmarks
    • run_affected_tests

2 files changed

+8
-4
lines changed

.github/workflows/scripts/run_affected_benchmarks/run

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# LOG_FILE Log file.
3131
#
3232

33-
# shellcheck disable=SC2034,SC2153,SC2317
33+
# shellcheck disable=SC2034,SC2086,SC2153,SC2317
3434

3535
# Ensure that the exit status of pipelines is non-zero in the event that at least one of the commands in a pipeline fails:
3636
set -o pipefail
@@ -141,7 +141,8 @@ main() {
141141

142142
# Run JS benchmarks:
143143
if [ -n "${js_bench_files}" ]; then
144-
make benchmark-javascript-files FILES="${js_bench_files}"
144+
# Invoke make in batches to avoid "Argument list too long" errors:
145+
printf '%s\n' ${js_bench_files} | xargs -s 65536 sh -c 'make benchmark-javascript-files FILES="$*"' _
145146
else
146147
echo 'No JavaScript benchmarks to run.' >&2
147148
fi
@@ -172,7 +173,8 @@ main() {
172173
fi
173174

174175
if [ -n "${c_bench_files}" ]; then
175-
make benchmark-c-files FILES="${c_bench_files}"
176+
# Invoke make in batches to avoid "Argument list too long" errors:
177+
printf '%s\n' ${c_bench_files} | xargs -s 65536 sh -c 'make benchmark-c-files FILES="$*"' _
176178
else
177179
echo 'No C benchmarks to run.' >&2
178180
fi

.github/workflows/scripts/run_affected_tests/run

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ main() {
165165
files=$(echo "${files}" | grep -v '/fixtures/') || true
166166

167167
if [[ -n "${files}" ]]; then
168-
make test-javascript-files-min FILES="${files}"
168+
# Invoke make in batches to avoid "Argument list too long" errors
169+
# when the total length of file paths exceeds OS limits:
170+
printf '%s\n' ${files} | xargs -s 65536 sh -c 'make test-javascript-files-min FILES="$*"' _
169171
fi
170172

171173
cleanup

0 commit comments

Comments
 (0)