Skip to content

Commit

Permalink
Merge aecec44 into 1bc2ab4
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Aug 13, 2022
2 parents 1bc2ab4 + aecec44 commit 39cbfda
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 2 deletions.
27 changes: 27 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
freebsd_instance:
image: freebsd-12-2-release-amd64
task:
name: FreeBSD
env:
matrix:
- JULIA_VERSION: 1.6
- JULIA_VERSION: 1
- JULIA_VERSION: nightly
allow_failures: $JULIA_VERSION == 'nightly'
install_script:
- sh -c "$(fetch https://raw.githubusercontent.com/ararslan/CirrusCI.jl/master/bin/install.sh -o -)"
build_script:
- cirrusjl build
test_script:
- |
export JULIA_COVERAGE_BLACK_HOLE_SERVER_URL_PUT="https://httpbingo.julialang.org/put"
cirrusjl test
- |
export JULIA_COVERAGE_IS_BLACK_HOLE_SERVER="true"
export COVERALLS_TOKEN="token"
export COVERALLS_URL="https://httpbingo.julialang.org/post"
export CODECOV_URL="https://httpbingo.julialang.org"
export CODECOV_URL_PATH="/post"
julia --color=yes --project=. --code-coverage=user etc/travis-coverage.jl
coverage_script:
- julia --color=yes --project=. etc/travis-coverage.jl
6 changes: 5 additions & 1 deletion etc/travis-coverage.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using Coverage
cov_res = process_folder()
Codecov.submit(cov_res)
Coveralls.submit(cov_res)
if Sys.isfreebsd()
@warn "Skipping Coveralls on FreeBSD"
else
Coveralls.submit(cov_res)
end
9 changes: 9 additions & 0 deletions src/codecovio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ function add_ci_to_kwargs(kwargs::Dict)
build = ENV["CI_PIPELINE_IID"],
pr = num_mr,
)
elseif lowercase(get(ENV, "CIRRUS_CI", "false")) == "true"
kwargs = set_defaults(kwargs,
service = "cirrus",
branch = ENV["CIRRUS_BRANCH"],
commit = ENV["CIRRUS_CHANGE_IN_REPO"],
pull_request = get(ENV, "CIRRUS_PR", "false"),
slug = ENV["CIRRUS_REPO_FULL_NAME"],
build = ENV["CIRRUS_BUILD_ID"],
)
else
error("No compatible CI platform detected")
end
Expand Down
68 changes: 67 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ withenv(
"JENKINS" => nothing,
"BUILD_ID" => nothing,
"CI_PULL_REQUEST" => nothing,
"GIT_BRANCH" => nothing
"GIT_BRANCH" => nothing,
"CIRRUS_CI" => nothing,
"CIRRUS_PR" => nothing,
"CIRRUS_BRANCH" => nothing,
"CIRRUS_CHANGE_IN_REPO" => nothing,
"CIRRUS_REPO_FULL_NAME" => nothing,
"CIRRUS_BUILD_ID" => nothing,
) do

@testset "codecovio.jl" begin
Expand Down Expand Up @@ -555,6 +561,66 @@ withenv(
end
end

# Test Cirrus CI submission process

# Set up Cirrus CI environment
withenv("CIRRUS_CI" => "true",
"CIRRUS_PR" => "t_pr",
"CIRRUS_BRANCH" => "t_branch",
"CIRRUS_CHANGE_IN_REPO" => "t_commit",
"CIRRUS_REPO_FULL_NAME" => "t_repo",
"CIRRUS_BUILD_ID" => "t_num") do
# default values
codecov_url = construct_uri_string_ci()
@test occursin("codecov.io", codecov_url)
@test occursin("service=cirrus", codecov_url)
@test occursin("branch=t_branch", codecov_url)
@test occursin("commit=t_commit", codecov_url)
@test occursin("pull_request=t_pr", codecov_url)
@test occursin("build=t_num", codecov_url)

# env var url override
withenv("CODECOV_URL" => "https://enterprise-codecov-1.com") do
codecov_url = construct_uri_string_ci()
@test occursin("enterprise-codecov-1.com", codecov_url)
@test occursin("service=cirrus", codecov_url)
@test occursin("branch=t_branch", codecov_url)
@test occursin("commit=t_commit", codecov_url)
@test occursin("pull_request=t_pr", codecov_url)
@test occursin("build=t_num", codecov_url)

# function argument url override
codecov_url = construct_uri_string_ci(codecov_url="https://enterprise-codecov-2.com")
@test occursin("enterprise-codecov-2.com", codecov_url)
@test occursin("service=cirrus", codecov_url)
@test occursin("branch=t_branch", codecov_url)
@test occursin("commit=t_commit", codecov_url)
@test occursin("pull_request=t_pr", codecov_url)
@test occursin("build=t_num", codecov_url)

# env var token
withenv("CODECOV_TOKEN" => "token_name_1") do
codecov_url = construct_uri_string_ci()
@test occursin("enterprise-codecov-1.com", codecov_url)
@test occursin("token=token_name_1", codecov_url)
@test occursin("service=cirrus", codecov_url)
@test occursin("branch=t_branch", codecov_url)
@test occursin("commit=t_commit", codecov_url)
@test occursin("pull_request=t_pr", codecov_url)
@test occursin("build=t_num", codecov_url)

# function argument token url override
codecov_url = construct_uri_string_ci(token="token_name_2")
@test occursin("enterprise-codecov-1.com", codecov_url)
@test occursin("service=cirrus", codecov_url)
@test occursin("branch=t_branch", codecov_url)
@test occursin("commit=t_commit", codecov_url)
@test occursin("pull_request=t_pr", codecov_url)
@test occursin("build=t_num", codecov_url)
end
end
end

# test codecov token masking
withenv(
"APPVEYOR" => "true",
Expand Down

0 comments on commit 39cbfda

Please sign in to comment.