Skip to content

Commit

Permalink
Merge a3c3a54 into cf1c147
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredmoody committed Apr 10, 2023
2 parents cf1c147 + a3c3a54 commit 27db0d8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
14 changes: 11 additions & 3 deletions spec/coverage_reporter/config_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,24 @@ Spectator.describe CoverageReporter::Config do
context "for Semaphore CI" do
before_each do
ENV["SEMAPHORE"] = "1"
ENV["SEMAPHORE_BUILD_NUMBER"] = "semaphore-build-number"
ENV["PULL_REQUEST_NUMBER"] = "semaphore-pr"
ENV["SEMAPHORE_WORKFLOW_ID"] = "semaphore-workflow-id"
ENV["SEMAPHORE_GIT_WORKING_BRANCH"] = "semaphore-branch"
ENV["SEMAPHORE_GIT_PR_NUMBER"] = "semaphore-pr"
ENV["SEMAPHORE_GIT_SHA"] = "semaphore-commit-sha"
ENV["SEMAPHORE_ORGANIZATION_URL"] = "https://myorg.semaphoreci.com"
ENV["SEMAPHORE_JOB_ID"] = "semaphore-job-id"
end

it "provides custom options" do
expect(subject).to eq({
:repo_token => repo_token,
:service_name => "semaphore",
:service_job_id => "semaphore-build-number",
:service_job_id => "semaphore-workflow-id",
:service_pull_request => "semaphore-pr",
:service_branch => "semaphore-branch",
:commit_sha => "semaphore-commit-sha",
:service_build_url => "https://myorg.semaphoreci.com/workflows/semaphore-workflow-id",
:service_job_url => "https://myorg.semaphoreci.com/jobs/semaphore-job-id",
})
end
end
Expand Down
8 changes: 6 additions & 2 deletions src/coverage_reporter/ci/semaphore.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ module CoverageReporter

Options.new(
service_name: "semaphore",
service_job_id: ENV["SEMAPHORE_BUILD_NUMBER"]?,
service_pull_request: ENV["PULL_REQUEST_NUMBER"]?,
service_job_id: ENV["SEMAPHORE_WORKFLOW_ID"]?,
service_branch: ENV["SEMAPHORE_GIT_WORKING_BRANCH"]?,
service_pull_request: ENV["SEMAPHORE_GIT_PR_NUMBER"]?,
commit_sha: ENV["SEMAPHORE_GIT_SHA"]?,
service_build_url: "#{ENV["SEMAPHORE_ORGANIZATION_URL"]?}/workflows/#{ENV["SEMAPHORE_WORKFLOW_ID"]?}",
service_job_url: "#{ENV["SEMAPHORE_ORGANIZATION_URL"]?}/jobs/#{ENV["SEMAPHORE_JOB_ID"]?}"
).to_h
end
end
Expand Down

0 comments on commit 27db0d8

Please sign in to comment.