From db125d54ddb6a2a1aac4b70a8c723253c0d6c764 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Tue, 14 May 2024 15:20:16 -0300 Subject: [PATCH] ci: allow customizing number of jobs when running locally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Example: ```sh ͳ scripts/spellcheck/spellcheck.sh -j 20 _build/docgen/emqx-enterprise/schema-en.json Adding /dicts/emqx.txt Starting LanguageTool server... + java -Xms256m -Xmx512m -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8010 --public --allow-origin '*' --config config.properties Checking /schema.json with 20 processes... Spellcheck OK ``` --- scripts/spellcheck/spellcheck.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/spellcheck/spellcheck.sh b/scripts/spellcheck/spellcheck.sh index 0abb46fdf..5635bfd7a 100755 --- a/scripts/spellcheck/spellcheck.sh +++ b/scripts/spellcheck/spellcheck.sh @@ -6,6 +6,19 @@ set -euo pipefail cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." PROJ_ROOT="$(pwd)" +NUM_JOBS=10 +while getopts "j:" FLAG; do + case "$FLAG" in + j) + NUM_JOBS="${OPTARG}" + ;; + *) + echo "unknown flag: $FLAG" + ;; + esac +done +shift $((OPTIND-1)) + if [ -z "${1:-}" ]; then SCHEMA="${PROJ_ROOT}/_build/docgen/emqx/schema-en.json" else @@ -29,7 +42,7 @@ set +e docker run --rm -i ${DOCKER_TERMINAL_OPT} --name spellcheck \ -v "${PROJ_ROOT}"/scripts/spellcheck/dicts:/dicts \ -v "$SCHEMA":/schema.json \ - ghcr.io/emqx/emqx-schema-validate:0.5.1 -j 10 /schema.json + ghcr.io/emqx/emqx-schema-validate:0.5.1 -j "${NUM_JOBS}" /schema.json result="$?"