Skip to content

Commit 708cada

Browse files
use withenv instead
1 parent b1b46cb commit 708cada

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/ci_integration_functions.jl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,34 +164,34 @@ function upload_to_coveralls(fcs::Vector{FileCoverage};
164164
# Add coverage file
165165
push!(cmd_args, coverage_file)
166166

167-
# Set up environment variables
168-
env = copy(ENV)
167+
# Set up environment variables for withenv
168+
env_vars = []
169169

170170
# Add token if provided or available in environment
171171
upload_token = token
172172
if upload_token === nothing
173173
upload_token = get(ENV, "COVERALLS_REPO_TOKEN", nothing)
174174
end
175175
if upload_token !== nothing
176-
env["COVERALLS_REPO_TOKEN"] = upload_token
176+
push!(env_vars, "COVERALLS_REPO_TOKEN" => upload_token)
177177
end
178178

179179
# Set parallel flag if requested
180180
if parallel === true
181-
env["COVERALLS_PARALLEL"] = "true"
181+
push!(env_vars, "COVERALLS_PARALLEL" => "true")
182182
elseif parallel === false
183-
env["COVERALLS_PARALLEL"] = "false"
183+
push!(env_vars, "COVERALLS_PARALLEL" => "false")
184184
end
185185
# If parallel=nothing, let the environment variable take precedence
186186

187187
# Set job flag for distinguishing parallel jobs
188188
if job_flag !== nothing
189-
env["COVERALLS_FLAG_NAME"] = job_flag
189+
push!(env_vars, "COVERALLS_FLAG_NAME" => job_flag)
190190
end
191191

192192
# Set build number for grouping parallel jobs
193193
if build_num !== nothing
194-
env["COVERALLS_SERVICE_NUMBER"] = string(build_num)
194+
push!(env_vars, "COVERALLS_SERVICE_NUMBER" => string(build_num))
195195
@debug "Using explicit build number for Coveralls" build_num=build_num
196196
elseif haskey(ENV, "COVERALLS_SERVICE_NUMBER")
197197
@debug "Using environment COVERALLS_SERVICE_NUMBER" service_number=ENV["COVERALLS_SERVICE_NUMBER"]
@@ -200,8 +200,8 @@ function upload_to_coveralls(fcs::Vector{FileCoverage};
200200
# Set SSL certificate bundle for macOS binaries (fixes SSL verification issues)
201201
if Sys.isapple()
202202
# Set the macOS system CA certificate bundle directly
203-
env["SSL_CERT_FILE"] = "/etc/ssl/cert.pem"
204-
env["SSL_CA_BUNDLE"] = "/etc/ssl/cert.pem"
203+
push!(env_vars, "SSL_CERT_FILE" => "/etc/ssl/cert.pem")
204+
push!(env_vars, "SSL_CA_BUNDLE" => "/etc/ssl/cert.pem")
205205
@debug "Using macOS system CA certificate bundle: /etc/ssl/cert.pem"
206206
end
207207

@@ -212,7 +212,9 @@ function upload_to_coveralls(fcs::Vector{FileCoverage};
212212
return true
213213
else
214214
@info "Uploading to Coveralls..."
215-
result = run(setenv(Cmd(cmd_args), env); wait=true)
215+
result = withenv(env_vars...) do
216+
run(Cmd(cmd_args); wait=true)
217+
end
216218
success = result.exitcode == 0
217219

218220
if success

0 commit comments

Comments
 (0)