diff --git a/CHANGELOG b/CHANGELOG index 6087868f673408de4b000b023c8fa21eebf9d089..f3370f8c3bc131e3afd0a5e8255a9145f82cc1a5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,6 +20,7 @@ v 8.5.1 - Changed padding & background color for highlighted notes - Re-add the newrelic_rpm gem which was removed without any deprecation or warning (Stan Hu) - Update sentry-raven gem to 0.15.6 + - Add build coverage in project's builds page (Steffen Köhler) v 8.5.0 - Fix duplicate "me" in tooltip of the "thumbsup" awards Emoji (Stan Hu) diff --git a/app/views/projects/builds/index.html.haml b/app/views/projects/builds/index.html.haml index 5e3bd14565e7a48609a7252c4798b6ac8d915f7e..14f1d3226bbb508a021eee877e860f97653b58e9 100644 --- a/app/views/projects/builds/index.html.haml +++ b/app/views/projects/builds/index.html.haml @@ -51,9 +51,11 @@ %th Name %th Duration %th Finished at + - if @project.build_coverage_enabled? + %th Coverage %th - @builds.each do |build| - = render 'projects/commit_statuses/commit_status', commit_status: build, commit_sha: true, stage: true, allow_retry: true + = render 'projects/commit_statuses/commit_status', commit_status: build, commit_sha: true, stage: true, coverage: @project.build_coverage_enabled?, allow_retry: true = paginate @builds, theme: 'gitlab' diff --git a/features/project/builds/summary.feature b/features/project/builds/summary.feature index 4f3fd194d0008e32096e9cc2258332961b2a8b66..3c029a973df4c96ffc812857b7cde7eb8707b5f1 100644 --- a/features/project/builds/summary.feature +++ b/features/project/builds/summary.feature @@ -3,6 +3,7 @@ Feature: Project Builds Summary Given I sign in as a user And I own a project And project has CI enabled + And project has coverage enabled And project has a recent build Scenario: I browse build details page @@ -12,6 +13,7 @@ Feature: Project Builds Summary Scenario: I browse project builds page When I visit project builds page + Then I see coverage Then I see button to CI Lint Scenario: I erase a build diff --git a/features/steps/project/builds/summary.rb b/features/steps/project/builds/summary.rb index 4688a0e2096e0b8a27120b531ea76a3f8241b3d0..e9e2359146e4b30870da1b66f0c982db416a8bbc 100644 --- a/features/steps/project/builds/summary.rb +++ b/features/steps/project/builds/summary.rb @@ -4,6 +4,12 @@ class Spinach::Features::ProjectBuildsSummary < Spinach::FeatureSteps include SharedBuilds include RepoHelpers + step 'I see coverage' do + page.within('td.coverage') do + expect(page).to have_content "99.9%" + end + end + step 'I see button to CI Lint' do page.within('.nav-controls') do ci_lint_tool_link = page.find_link('CI Lint') diff --git a/features/steps/shared/builds.rb b/features/steps/shared/builds.rb index 0bd5d93b997cb7b1e8568729ee613e104649541d..f33ed7834fe6520a16c2eeac5724ffa26028d9b2 100644 --- a/features/steps/shared/builds.rb +++ b/features/steps/shared/builds.rb @@ -5,9 +5,13 @@ module SharedBuilds @project.enable_ci end + step 'project has coverage enabled' do + @project.update_attribute(:build_coverage_regex, /Coverage (\d+)%/) + end + step 'project has a recent build' do @ci_commit = create(:ci_commit, project: @project, sha: @project.commit.sha) - @build = create(:ci_build, commit: @ci_commit) + @build = create(:ci_build_with_coverage, commit: @ci_commit) end step 'recent build is successful' do diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index a46466798d6315c6f1d88f441eb89ae017d38d2c..a7a54d4452137fc045a5a175ae19ac4dd20f43ae 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -53,6 +53,10 @@ FactoryGirl.define do tag true end + factory :ci_build_with_coverage do + coverage 99.9 + end + trait :trace do after(:create) do |build, evaluator| build.trace = 'BUILD TRACE' @@ -68,7 +72,7 @@ FactoryGirl.define do build.artifacts_metadata = fixture_file_upload(Rails.root.join('spec/fixtures/ci_build_artifacts_metadata.gz'), 'application/x-gzip') - + build.save! end end