@@ -114,7 +114,7 @@ function upload_to_codecov(fcs::Vector{FileCoverage};
114
114
end
115
115
116
116
"""
117
- upload_to_coveralls(fcs::Vector{FileCoverage}; format=:lcov, token=nothing, parallel=nothing, job_flag=nothing, dry_run=false, cleanup=true)
117
+ upload_to_coveralls(fcs::Vector{FileCoverage}; format=:lcov, token=nothing, parallel=nothing, job_flag=nothing, build_num=nothing, dry_run=false, cleanup=true)
118
118
119
119
Process coverage data and upload to Coveralls using the Universal Coverage Reporter.
120
120
@@ -124,27 +124,29 @@ Process coverage data and upload to Coveralls using the Universal Coverage Repor
124
124
- `token`: Coveralls repo token (defaults to COVERALLS_REPO_TOKEN environment variable)
125
125
- `parallel`: Set to true for parallel job uploads (requires calling finish_parallel afterwards)
126
126
- `job_flag`: Flag to distinguish this job in parallel builds (e.g., "julia-1.9-linux")
127
+ - `build_num`: Build number for grouping parallel jobs (overrides COVERALLS_SERVICE_NUMBER environment variable)
127
128
- `dry_run`: If true, show what would be uploaded without actually uploading
128
129
- `cleanup`: If true, remove temporary files after upload
129
130
130
131
# Parallel Job Usage
131
132
For parallel CI jobs, set parallel=true and call finish_parallel when all jobs complete:
132
133
```julia
133
134
# Job 1: Upload with parallel flag
134
- upload_to_coveralls(fcs; parallel=true, job_flag="julia-1.9")
135
+ upload_to_coveralls(fcs; parallel=true, job_flag="julia-1.9", build_num="123" )
135
136
136
137
# Job 2: Upload with parallel flag
137
- upload_to_coveralls(fcs; parallel=true, job_flag="julia-1.10")
138
+ upload_to_coveralls(fcs; parallel=true, job_flag="julia-1.10", build_num="123" )
138
139
139
140
# After all jobs: Signal completion (typically in a separate "finalize" job)
140
- finish_coveralls_parallel()
141
+ finish_coveralls_parallel(build_num="123" )
141
142
```
142
143
"""
143
144
function upload_to_coveralls (fcs:: Vector{FileCoverage} ;
144
145
format= :lcov ,
145
146
token= nothing ,
146
147
parallel= nothing ,
147
148
job_flag= nothing ,
149
+ build_num= nothing ,
148
150
dry_run= false ,
149
151
cleanup= true )
150
152
@@ -187,6 +189,14 @@ function upload_to_coveralls(fcs::Vector{FileCoverage};
187
189
env[" COVERALLS_FLAG_NAME" ] = job_flag
188
190
end
189
191
192
+ # Set build number for grouping parallel jobs
193
+ if build_num != = nothing
194
+ env[" COVERALLS_SERVICE_NUMBER" ] = string (build_num)
195
+ @debug " Using explicit build number for Coveralls" build_num= build_num
196
+ elseif haskey (ENV , " COVERALLS_SERVICE_NUMBER" )
197
+ @debug " Using environment COVERALLS_SERVICE_NUMBER" service_number= ENV [" COVERALLS_SERVICE_NUMBER" ]
198
+ end
199
+
190
200
# Execute command
191
201
if dry_run
192
202
@info " Would execute: $(join (cmd_args, " " )) "
@@ -284,14 +294,18 @@ function process_and_upload(; service=:both,
284
294
end
285
295
286
296
"""
287
- finish_coveralls_parallel(; token=nothing)
297
+ finish_coveralls_parallel(; token=nothing, build_num=nothing )
288
298
289
299
Signal to Coveralls that all parallel jobs have completed and coverage can be processed.
290
300
This should be called once after all parallel upload_to_coveralls() calls are complete.
291
301
302
+ # Arguments
303
+ - `token`: Coveralls repo token (defaults to COVERALLS_REPO_TOKEN environment variable)
304
+ - `build_num`: Build number for the parallel jobs (overrides COVERALLS_SERVICE_NUMBER environment variable)
305
+
292
306
Call this from a separate CI job that runs after all parallel coverage jobs finish.
293
307
"""
294
- function finish_coveralls_parallel (; token= nothing )
308
+ function finish_coveralls_parallel (; token= nothing , build_num = nothing )
295
309
# Add token if provided or available in environment
296
310
upload_token = token
297
311
if upload_token === nothing
@@ -302,9 +316,20 @@ function finish_coveralls_parallel(; token=nothing)
302
316
end
303
317
304
318
# Prepare the completion webhook payload
319
+ payload_data = Dict (" status" => " done" )
320
+
321
+ # Add build number if provided or available in environment
322
+ service_number = build_num != = nothing ? string (build_num) : get (ENV , " COVERALLS_SERVICE_NUMBER" , nothing )
323
+ if service_number != = nothing && service_number != " "
324
+ payload_data[" build_num" ] = service_number
325
+ @info " Using build number for parallel completion" build_num= service_number
326
+ else
327
+ @warn " No build number available for parallel completion - this may cause issues with parallel job grouping"
328
+ end
329
+
305
330
payload = Dict (
306
331
" repo_token" => upload_token,
307
- " payload" => Dict ( " status " => " done " )
332
+ " payload" => payload_data
308
333
)
309
334
310
335
@info " Signaling Coveralls parallel job completion..."
0 commit comments