From de9831c2c2c6801a79df840226e59832c7b4e4d1 Mon Sep 17 00:00:00 2001 From: Robert Prehn <3952444+prehnRA@users.noreply.github.com> Date: Fri, 23 Jul 2021 11:08:31 -0500 Subject: [PATCH] chore: Report coverage in a separate CI job --- .gitlab-ci.yml | 20 ++++++++++++++------ script/cibuild | 6 +++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fe7cfbc9..a4262ab2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,13 +38,9 @@ test: <<: *test_template image: "elixir:1.12.1-alpine" script: - - script/cibuild - - script/coverage-json-to-metrics - - script/coverage-json-to-cobertura + - script/cibuild covered artifacts: - reports: - metrics: metrics.txt - cobertura: cover/cobertura.xml + coverage_json: cover/excoveralls.json credo: stage: test @@ -94,6 +90,18 @@ build_image_for_commit: script: - script/ci-docker-build +report_coverage: + stage: deploy_tags + needs: ['test'] + image: "elixir:1.12.1-alpine" + script: + - script/coverage-json-to-metrics + - script/coverage-json-to-cobertura + artifacts: + reports: + metrics: metrics.txt + cobertura: cover/cobertura.xml + # If tests pass, tag the commit and update package versions deploy_to_tags: stage: deploy_tags diff --git a/script/cibuild b/script/cibuild index 1ef790c7..6544bbe7 100755 --- a/script/cibuild +++ b/script/cibuild @@ -12,6 +12,10 @@ mix deps.get mix ecto.create mix ecto.migrate -mix coveralls.json --umbrella +if [ $1 == 'covered' ]; then + mix coveralls.json --umbrella +else + mix test +fi; script/restore-timestamps