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

A large CircleCI VM can able to handle 4 test jobs #1245

Merged
merged 2 commits into from
Sep 2, 2024
Merged
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
40 changes: 17 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Use the latest 2.1 version of CircleCI pipeline process engine. See:
# https://circleci.com/docs/2.0/configuration-reference
version: 2.1
orbs:
codecov: codecov/[email protected]
# Orchestrate or schedule a set of jobs
workflows:
docker-compose:
Expand Down Expand Up @@ -38,42 +40,34 @@ jobs:
./bin/metacpan-docker init
docker-compose --verbose up -d api_test
name: compose up
- run:
command: |
pushd metacpan-docker
docker-compose exec -T api_test cpm install -g Devel::Cover
name: install Devel::Cover
# Since we're running docker-compose -d, we don't actually know if
# Elasticsearch is available at the time this build step begins. We
# probably need to wait for it here, so we'll add our own check.
- run:
command: |
pushd metacpan-docker
./src/metacpan-api/wait-for-es.sh http://localhost:9200 elasticsearch_test --
./src/metacpan-api/wait-for-es.sh http://localhost:9200 elasticsearch_test
name: wait for ES
# We are running coverage inside the container, but creating the report
# from outside of the container, so Devel::Cover is installed twice. 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
# to propagate env variables to the container. There is a CircleCI orb
# that can publish the report for us, but it is hard to debug. I had to
# set up the following config in order to debug the orb, so we may as
# well keep it around for now.
- run:
command: |
pushd metacpan-docker
docker-compose exec -T api_test cpm install -g Devel::Cover
name: install Devel::Cover
- 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 2 t
docker-compose exec -T api_test env HARNESS_PERL_SWITCHES="-MDevel::Cover=+ignore,^t/|^test-data/|^etc/" prove -lr --jobs 4 t
name: run tests with coverage
# The report ends up being owned by root. We need to chown it so that
# the cover command can make changes to it.
# 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
# to propagate env variables to the container.
- run:
command: |
pushd metacpan-docker/src/metacpan-api
sudo apt install cpanminus
sudo cpanm --notest Devel::Cover Devel::Cover::Report::Codecov Devel::Cover::Report::Codecovbash
sudo chown -R circleci.circleci cover_db
cover -report codecov
name: upload coverage report
pushd metacpan-docker
docker-compose exec -T api_test cover -report json
name: create coverage report
- codecov/upload:
file: metacpan-docker/src/metacpan-api/cover_db/cover.json
- run:
command: |
pushd metacpan-docker
Expand Down