Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Build std_spec in batches on 32-bit #11077

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- run: bin/ci prepare_system
- run: echo 'export CURRENT_TAG="$CIRCLE_TAG"' >> $BASH_ENV
- run: bin/ci prepare_build
- run: bin/ci with_build_env 'make std_spec threads=1 junit_output=.junit/std_spec.xml'
- run: bin/ci std_spec
- run:
when: always
command: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: bin/ci prepare_build

- name: Test
run: bin/ci with_build_env 'make std_spec threads=1'
run: bin/ci std_spec

test_alpine:
env:
Expand Down
42 changes: 37 additions & 5 deletions bin/ci
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,13 @@ prepare_system() {
}

build() {
with_build_env 'make std_spec clean threads=1 junit_output=.junit/std_spec.xml'
std_spec

case $ARCH in
i386)
with_build_env 'make crystal threads=1'
with_build_env 'SPEC_SPLIT="0%4" make std_spec threads=1 junit_output=.junit/std_spec.0.xml'
with_build_env 'SPEC_SPLIT="1%4" make std_spec threads=1 junit_output=.junit/std_spec.1.xml'
with_build_env 'SPEC_SPLIT="2%4" make std_spec threads=1 junit_output=.junit/std_spec.2.xml'
with_build_env 'SPEC_SPLIT="3%4" make std_spec threads=1 junit_output=.junit/std_spec.3.xml'

run_specs_in_batches spec/std 4 std_spec

parts=16
i=0
Expand All @@ -125,6 +123,37 @@ build() {
with_build_env 'find samples -name "*.cr" | xargs -tn 1 ./bin/crystal build --no-codegen'
}

std_spec() {
case $ARCH in
i386)
with_build_env 'make deps'

run_specs_in_batches spec/std 4 std_spec
;;
*)
with_build_env 'make std_spec clean threads=1 junit_output=.junit/std_spec.xml'
;;
esac
}

run_specs_in_batches() {
path=$1
parts=$2
junit_filename=$3

spec_files=$(find $path -mindepth 1 -maxdepth 1)
num_files=$(echo "$spec_files" | wc -l)
batch_size=$(( $num_files / $parts + 1 ))

i=0
while [ $i -lt $parts ]; do
batch_files=$(echo "$spec_files" | tail -n +$(( $batch_size * $i + 1 )) | head -$batch_size)

with_build_env "echo \"$batch_files\" | xargs bin/crystal spec --junit_output=.junit/$junit_filename.$i.xml"
i=$((i + 1))
done
}

format() {
with_build_env 'make clean crystal threads=1'
with_build_env './bin/crystal tool format --check samples spec src'
Expand Down Expand Up @@ -257,6 +286,9 @@ case $command in
build)
build
;;
std_spec)
std_spec
;;
format)
format
;;
Expand Down