From 8cac29df0913f16bb89ceeba89a4f9aa0bab9b64 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 3 Sep 2024 08:59:56 -0400 Subject: [PATCH] Experiment with test splitting --- .circleci/config.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dc0c7ae68..75d6fa761 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,6 +12,7 @@ workflows: jobs: build-and-test: machine: true + parallelism: 4 resource_class: large steps: - run: @@ -53,10 +54,26 @@ jobs: pushd metacpan-docker ./src/metacpan-api/wait-for-es.sh http://localhost:9200 elasticsearch_test name: wait for ES + - run: + command: rm metacpan-docker/src/metacpan-api/t/testrules.yml + - run: + command: | + pushd metacpan-docker/src/metacpan-api + TESTFILES=$(find t -name '0*.t' | sort) + cd ../.. + docker-compose exec -T api_test env HARNESS_PERL_SWITCHES="-MDevel::Cover=+ignore,^t/|^test-data/|^etc/" prove -l $TESTFILES + name: run setup tests first - run: command: | pushd metacpan-docker - docker-compose exec -T api_test env HARNESS_PERL_SWITCHES="-MDevel::Cover=+ignore,^t/|^test-data/|^etc/" prove -lr --jobs 4 t + docker-compose exec -T api_test env HARNESS_PERL_SWITCHES="-MDevel::Cover=+ignore,^t/|^test-data/|^etc/" prove -lr --jobs 2 t/script/cover.t t/server/controller/user/favorite.t + name: run important tests second + - run: + command: | + pushd metacpan-docker/src/metacpan-api + TESTFILES=$(circleci tests glob "t/**/*.t" | grep -v "t/0.*.t" | circleci tests split --split-by=timings) + cd ../.. + docker-compose exec -T api_test env HARNESS_PERL_SWITCHES="-MDevel::Cover=+ignore,^t/|^test-data/|^etc/" prove -lr --jobs 4 $TESTFILES name: run tests with coverage # We are relying on environment variables from the host to be available when # we publish the report, so we publish from the host rather than trying