Skip to content

Commit

Permalink
make v8-version-build job concurrent
Browse files Browse the repository at this point in the history
  • Loading branch information
LanderlYoung committed Sep 23, 2024
1 parent 07620f1 commit 12f341e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ jobs:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
job_split: [ 0/4, 1/4, 2/3, 3/4 ] # format index{0 .. index-1}/concurrency
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
Expand All @@ -153,6 +155,7 @@ jobs:
- name: Test build v8 on supported versions
env:
SCRIPTX_TEST_FORCE_UPDATE_DEPS: ON
SCRIPTX_TEST_JOB_SPLIT_CONFIG: ${{ matrix.job_split }}
run: |
mkdir -p build && cd build
../test/cmake/test_v8_compiles.sh continue
Expand Down
21 changes: 18 additions & 3 deletions test/cmake/test_v8_compiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,24 @@ function compile() {
if [[ -n $TARGET_VERSION ]] ; then
compile $TARGET_VERSION
else
for version in "${SUPPORTED_VERSIONS[@]}"; do
compile $version
done
if echo $SCRIPTX_TEST_JOB_SPLIT_CONFIG | egrep -q -e '^\d+\/\d+$'; then
TOTAL=$(echo ${SCRIPTX_TEST_JOB_SPLIT_CONFIG} | cut -d/ -f 2)
INDEX=$(echo ${SCRIPTX_TEST_JOB_SPLIT_CONFIG} | cut -d/ -f 1)
COUNT=${#SUPPORTED_VERSIONS[@]}

START=$((($COUNT * $INDEX + $TOTAL - 1) / $TOTAL)) # upper COUNT * INDEX / TOTAL
END=$(($COUNT * ($INDEX + 1) / $TOTAL)) # upper COUNT * INDEX / TOTAL

echo "split job=[$START, $END] total=$COUNT"

for ((i = $START; i < $END; i++)); do
compile ${SUPPORTED_VERSIONS[$i]}
done
else
for version in "${SUPPORTED_VERSIONS[@]}"; do
compile $version
done
fi
fi

echo "passed versions: [${PASSED_VERSIONS[@]}]"
Expand Down

0 comments on commit 12f341e

Please sign in to comment.