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

feat: add Xcode Cloud CI support #89

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
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
21 changes: 21 additions & 0 deletions spec/coverage_reporter/config_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -498,5 +498,26 @@ Spectator.describe CoverageReporter::Config do
})
end
end

context "for Xcode Cloud" do
before_each do
ENV["CI_XCODE_PROJECT"] = "/Users/coveralls/coverage-reporter"
ENV["CI_BUILD_NUMBER"] = "321"
ENV["CI_COMMIT"] = "commit-sha"
ENV["CI_BRANCH"] = "feature/add-xcode-ci-support"
ENV["CI_PULL_REQUEST_NUMBER"] = "42"
end

it "provides custom options" do
expect(subject).to eq({
:repo_token => repo_token,
:service_name => "xcode-cloud",
:service_number => "321",
:service_branch => "feature/add-xcode-ci-support",
:service_pull_request => "42",
:commit_sha => "commit-sha",
})
end
end
end
end
21 changes: 21 additions & 0 deletions src/coverage_reporter/ci/xcode_cloud.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require "./options"

module CoverageReporter
module CI
module XcodeCloud
extend self

def options
return unless ENV["CI_XCODE_PROJECT"]?

Options.new(
service_name: "xcode-cloud",
service_number: ENV["CI_BUILD_NUMBER"]?,
commit_sha: ENV["CI_COMMIT"]?,
service_branch: ENV["CI_PULL_REQUEST_SOURCE_BRANCH"]? || ENV["CI_BRANCH"]?,
service_pull_request: ENV["CI_PULL_REQUEST_NUMBER"]?,
).to_h
end
end
end
end
1 change: 1 addition & 0 deletions src/coverage_reporter/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module CoverageReporter
CI::Surf,
CI::Wercker,
CI::Drone,
CI::XcodeCloud,
CI::Local,
}

Expand Down