|
| 1 | +--- |
| 2 | +# Use the latest 2.1 version of CircleCI pipeline process engine. See: |
| 3 | +# https://circleci.com/docs/2.0/configuration-reference |
| 4 | +version: 2.1 |
| 5 | +orbs: |
| 6 | + codecov: codecov/codecov@4.1.0 |
| 7 | +# Orchestrate or schedule a set of jobs |
| 8 | +workflows: |
| 9 | + docker-compose: |
| 10 | + jobs: |
| 11 | + - build-and-test |
| 12 | +jobs: |
| 13 | + build-and-test: |
| 14 | + machine: true |
| 15 | + resource_class: large |
| 16 | + steps: |
| 17 | + - run: |
| 18 | + name: docker-compose version |
| 19 | + command: docker-compose --version |
| 20 | + - run: |
| 21 | + command: | |
| 22 | + git clone https://github.com/metacpan/metacpan-docker.git |
| 23 | + cd metacpan-docker |
| 24 | + name: metacpan-docker checkout |
| 25 | + - checkout: |
| 26 | + path: metacpan-docker/src/metacpan-ingest |
| 27 | + - run: |
| 28 | + command: | |
| 29 | + pushd metacpan-docker |
| 30 | + ./bin/metacpan-docker init |
| 31 | + name: clone missing repositories |
| 32 | + - run: |
| 33 | + command: | |
| 34 | + pushd metacpan-docker |
| 35 | + docker-compose build --build-arg CPM_ARGS='--with-test' insgest_test |
| 36 | + name: compose build |
| 37 | + - run: |
| 38 | + command: | |
| 39 | + pushd metacpan-docker |
| 40 | + ./bin/metacpan-docker init |
| 41 | + docker-compose --verbose up -d ingest_test |
| 42 | + name: compose up |
| 43 | + - run: |
| 44 | + command: | |
| 45 | + pushd metacpan-docker |
| 46 | + docker-compose exec -T ingest_test cpm install -g Devel::Cover |
| 47 | + name: install Devel::Cover |
| 48 | + # Since we're running docker-compose -d, we don't actually know if |
| 49 | + # Elasticsearch is available at the time this build step begins. We |
| 50 | + # probably need to wait for it here, so we'll add our own check. |
| 51 | + - run: |
| 52 | + command: | |
| 53 | + pushd metacpan-docker |
| 54 | + ./src/metacpan-ingest/wait-for-es.sh http://localhost:9200 elasticsearch_test |
| 55 | + name: wait for ES |
| 56 | + - run: |
| 57 | + command: | |
| 58 | + pushd metacpan-docker |
| 59 | + docker-compose exec -T ingest_test env PLACK_ENV='dev' HARNESS_PERL_SWITCHES="-MDevel::Cover=+ignore,^t/|^test-data/|^etc/" prove -lr --jobs 4 t |
| 60 | + name: run tests with coverage |
| 61 | + # We are relying on environment variables from the host to be available when |
| 62 | + # we publish the report, so we publish from the host rather than trying |
| 63 | + # to propagate env variables to the container. |
| 64 | + - run: |
| 65 | + command: | |
| 66 | + pushd metacpan-docker |
| 67 | + docker-compose exec -T ingest_test cover -report json |
| 68 | + name: create coverage report |
| 69 | + - codecov/upload: |
| 70 | + file: metacpan-docker/src/metacpan-ingest/cover_db/cover.json |
| 71 | + - run: |
| 72 | + command: | |
| 73 | + pushd metacpan-docker |
| 74 | + docker-compose logs |
| 75 | + docker stats --no-stream |
| 76 | + docker ps -a | head |
| 77 | + name: docker-compose logs |
| 78 | + when: on_fail |
0 commit comments