Skip to content

Commit eb3b908

Browse files
Fix coverage job - Part 2 (#475)
Fixes #473 - Uses the new Coverage.jl API JuliaCI/Coverage.jl#349 - Handles parallel jobs in the way that coveralls wants us to - Fixes collecting coverage for the Compiler julia dir
1 parent 601c254 commit eb3b908

10 files changed

+266
-85
lines changed
0 Bytes
Binary file not shown.

pipelines/main/launch_upload_jobs.yml.signature

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
Salted__�s1�+��Ѿ&+���P
2-
]�) �8�x���Kםx[]�p"��m�����w@},���<&S�y뜟�,�a�N�A��޲���j@�Z�^
1+
Salted__U����nz�E"Y]y��_�\�%�.Z-��"�<��'J6G#�w���=qC�b��Ͷ#v�pb���s+Î���/���̮

pipelines/scheduled/coverage/coverage.yml

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ steps:
2121
variables:
2222
- CODECOV_TOKEN="U2FsdGVkX19l0fhdBabbuiEdysyEabkJLRHfxm7CNRkuGbnwPV365sxxC7Czs/CVcws0N1oB4pVwALRRMe36oA=="
2323
- COVERALLS_TOKEN="U2FsdGVkX19zopI0hMNzzi2UUOvNVFD8Y0iisFnO/ryVxU7Tit8ZEaeN+gxodRx4CosUUh192F1+q3dTMWRIvw=="
24-
timeout_in_minutes: 720
24+
timeout_in_minutes: 420
2525
commands: |
2626
echo "--- Build Julia from source"
2727
make --output-sync -j$${JULIA_NUM_THREADS}
2828
2929
echo "--- Print Julia version info"
30-
./julia -e 'using InteractiveUtils; InteractiveUtils.versioninfo()'
31-
./julia -e '@info "" Sys.CPU_THREADS'
30+
./julia --color=yes -e 'using InteractiveUtils; InteractiveUtils.versioninfo()'
31+
./julia --color=yes -e '@info "" Sys.CPU_THREADS'
3232
# this is necessary to make sure that the LibGit2 tests passes
3333
git config --global init.defaultBranch master
3434
3535
echo "--- Run Julia tests in parallel with code coverage enabled"
3636
export JULIA_NUM_THREADS=1
3737
export JULIA_WORKER_TIMEOUT=1200 # 1200 seconds = 20 minutes
38-
./julia -e 'import Distributed; @info "" Distributed.worker_timeout()'
39-
./julia .buildkite/pipelines/scheduled/coverage/run_tests_parallel.jl
38+
./julia --color=yes -e 'import Distributed; @info "" Distributed.worker_timeout()'
39+
./julia --color=yes .buildkite/pipelines/scheduled/coverage/run_tests_parallel.jl
4040
4141
echo "--- Move the lcov files into the `./lcov_files` directory"
4242
ls *.info
@@ -49,7 +49,7 @@ steps:
4949
buildkite-agent artifact upload lcov_files.tar.gz
5050
5151
echo "--- Process and upload coverage information"
52-
./julia .buildkite/pipelines/scheduled/coverage/upload_coverage.jl
52+
./julia --color=yes .buildkite/pipelines/scheduled/coverage/upload_coverage.jl
5353
agents:
5454
queue: "julia"
5555
# Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing
@@ -59,6 +59,8 @@ steps:
5959
env:
6060
# Receive cryptic token from parent job
6161
BUILDKITE_PLUGIN_CRYPTIC_BASE64_SIGNED_JOB_ID_SECRET: ${BUILDKITE_PLUGIN_CRYPTIC_BASE64_SIGNED_JOB_ID_SECRET?}
62+
# Set build number for Coveralls parallel mode
63+
COVERALLS_SERVICE_NUMBER: ${BUILDKITE_BUILD_NUMBER}
6264

6365
- label: ":macos: coverage (aarch64)"
6466
key: "coverage-macos-aarch64"
@@ -75,22 +77,22 @@ steps:
7577
variables:
7678
- CODECOV_TOKEN="U2FsdGVkX19l0fhdBabbuiEdysyEabkJLRHfxm7CNRkuGbnwPV365sxxC7Czs/CVcws0N1oB4pVwALRRMe36oA=="
7779
- COVERALLS_TOKEN="U2FsdGVkX19zopI0hMNzzi2UUOvNVFD8Y0iisFnO/ryVxU7Tit8ZEaeN+gxodRx4CosUUh192F1+q3dTMWRIvw=="
78-
timeout_in_minutes: 720
80+
timeout_in_minutes: 420
7981
commands: |
8082
echo "--- Build Julia from source"
8183
make -j$${JULIA_NUM_THREADS}
8284
8385
echo "--- Print Julia version info"
84-
./julia -e 'using InteractiveUtils; InteractiveUtils.versioninfo()'
85-
./julia -e '@info "" Sys.CPU_THREADS'
86+
./julia --color=yes -e 'using InteractiveUtils; InteractiveUtils.versioninfo()'
87+
./julia --color=yes -e '@info "" Sys.CPU_THREADS'
8688
# this is necessary to make sure that the LibGit2 tests passes
8789
git config --global init.defaultBranch master
8890
8991
echo "--- Run Julia tests in parallel with code coverage enabled"
9092
export JULIA_NUM_THREADS=1
9193
export JULIA_WORKER_TIMEOUT=1200 # 1200 seconds = 20 minutes
92-
./julia -e 'import Distributed; @info "" Distributed.worker_timeout()'
93-
./julia .buildkite/pipelines/scheduled/coverage/run_tests_parallel.jl
94+
./julia --color=yes -e 'import Distributed; @info "" Distributed.worker_timeout()'
95+
./julia --color=yes .buildkite/pipelines/scheduled/coverage/run_tests_parallel.jl
9496
9597
echo "--- Move the lcov files into the `./lcov_files` directory"
9698
ls *.info
@@ -103,7 +105,7 @@ steps:
103105
buildkite-agent artifact upload lcov_files.tar.gz
104106
105107
echo "--- Process and upload coverage information"
106-
./julia .buildkite/pipelines/scheduled/coverage/upload_coverage.jl
108+
./julia --color=yes .buildkite/pipelines/scheduled/coverage/upload_coverage.jl
107109
agents:
108110
queue: "julia"
109111
os: "macos"
@@ -112,6 +114,8 @@ steps:
112114
JULIA_SHELL: "/bin/bash"
113115
# Receive cryptic token from parent job
114116
BUILDKITE_PLUGIN_CRYPTIC_BASE64_SIGNED_JOB_ID_SECRET: ${BUILDKITE_PLUGIN_CRYPTIC_BASE64_SIGNED_JOB_ID_SECRET?}
117+
# Set build number for Coveralls parallel mode
118+
COVERALLS_SERVICE_NUMBER: ${BUILDKITE_BUILD_NUMBER}
115119

116120
- label: ":windows: coverage (x86_64)"
117121
key: "coverage-windows-x86_64"
@@ -135,14 +139,14 @@ steps:
135139
echo '--- Build Julia from source' &&
136140
make -j$${JULIA_NUM_THREADS} VERBOSE=1 &&
137141
echo '--- Print Julia version info' &&
138-
./usr/bin/julia.exe -e 'using InteractiveUtils; InteractiveUtils.versioninfo()' &&
139-
./usr/bin/julia.exe -e '@info \"\" Sys.CPU_THREADS' &&
142+
./usr/bin/julia.exe --color=yes -e 'using InteractiveUtils; InteractiveUtils.versioninfo()' &&
143+
./usr/bin/julia.exe --color=yes -e '@info \"\" Sys.CPU_THREADS' &&
140144
git config --global init.defaultBranch master &&
141145
echo '--- Run Julia tests in parallel with code coverage enabled' &&
142146
export JULIA_NUM_THREADS=1 &&
143147
export JULIA_WORKER_TIMEOUT=1200 &&
144-
./usr/bin/julia.exe -e 'import Distributed; @info \"\" Distributed.worker_timeout()' &&
145-
./usr/bin/julia.exe .buildkite/pipelines/scheduled/coverage/run_tests_parallel.jl &&
148+
./usr/bin/julia.exe --color=yes -e 'import Distributed; @info \"\" Distributed.worker_timeout()' &&
149+
./usr/bin/julia.exe --color=yes .buildkite/pipelines/scheduled/coverage/run_tests_parallel.jl &&
146150
echo '--- Move the lcov files into the ./lcov_files directory' &&
147151
ls *.info &&
148152
mkdir -p lcov_files &&
@@ -152,7 +156,7 @@ steps:
152156
tar -zcf lcov_files.tar.gz lcov_files/ &&
153157
buildkite-agent artifact upload lcov_files.tar.gz &&
154158
echo '--- Process and upload coverage information' &&
155-
./usr/bin/julia.exe .buildkite/pipelines/scheduled/coverage/upload_coverage.jl
159+
./usr/bin/julia.exe --color=yes .buildkite/pipelines/scheduled/coverage/upload_coverage.jl
156160
"]
157161
propagate-environment: true
158162
volumes:
@@ -170,7 +174,8 @@ steps:
170174
- "BUILDKITE_BUILD_CREATOR_EMAIL"
171175
- "CODECOV_TOKEN"
172176
- "COVERALLS_TOKEN"
173-
timeout_in_minutes: 720
177+
- "BUILDKITE_BUILD_NUMBER"
178+
timeout_in_minutes: 420
174179
agents:
175180
queue: "julia"
176181
os: "windows"
@@ -179,3 +184,40 @@ steps:
179184
JULIA_SHELL: "/bin/bash"
180185
# Receive cryptic token from parent job
181186
BUILDKITE_PLUGIN_CRYPTIC_BASE64_SIGNED_JOB_ID_SECRET: ${BUILDKITE_PLUGIN_CRYPTIC_BASE64_SIGNED_JOB_ID_SECRET?}
187+
# Set build number for Coveralls parallel mode
188+
COVERALLS_SERVICE_NUMBER: ${BUILDKITE_BUILD_NUMBER}
189+
190+
- label: "Finalize parallel coverage"
191+
key: "coverage-finalize"
192+
if: (pipeline.slug == "julia-buildkite-scheduled") || (pipeline.slug == "julia-master-scheduled")
193+
depends_on:
194+
- step: "coverage-linux"
195+
allow_failure: true
196+
- step: "coverage-macos-aarch64"
197+
allow_failure: true
198+
- step: "coverage-windows-x86_64"
199+
allow_failure: true
200+
plugins:
201+
- JuliaCI/external-buildkite#v1:
202+
version: "./.buildkite-external-version"
203+
repo_url: "https://github.com/JuliaCI/julia-buildkite"
204+
- JuliaCI/julia#v1:
205+
# Drop default "registries" directory, so it is not persisted from execution to execution
206+
persist_depot_dirs: packages,artifacts,compiled
207+
version: '1'
208+
- JuliaCI/cryptic#v2:
209+
variables:
210+
- COVERALLS_TOKEN="U2FsdGVkX19zopI0hMNzzi2UUOvNVFD8Y0iisFnO/ryVxU7Tit8ZEaeN+gxodRx4CosUUh192F1+q3dTMWRIvw=="
211+
timeout_in_minutes: 10
212+
commands: |
213+
echo "--- Signal completion of parallel coverage uploads"
214+
julia --color=yes .buildkite/pipelines/scheduled/coverage/finish_parallel_coverage.jl
215+
agents:
216+
queue: "julia"
217+
os: "linux"
218+
arch: "x86_64"
219+
env:
220+
# Receive cryptic token from parent job
221+
BUILDKITE_PLUGIN_CRYPTIC_BASE64_SIGNED_JOB_ID_SECRET: ${BUILDKITE_PLUGIN_CRYPTIC_BASE64_SIGNED_JOB_ID_SECRET?}
222+
# Set build number for Coveralls parallel mode
223+
COVERALLS_SERVICE_NUMBER: ${BUILDKITE_BUILD_NUMBER}
Binary file not shown.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Script to signal completion of parallel Coveralls uploads
2+
# This should be run after all parallel coverage upload jobs have completed
3+
4+
Base.DEPOT_PATH[1] = mktempdir(; cleanup = true)
5+
6+
import Pkg
7+
import Logging
8+
9+
Pkg.add(; name = "Coverage", uuid = "a2441757-f6aa-5fb2-8edb-039e3f45d037", version = "1")
10+
11+
import Coverage
12+
13+
@info "Signaling completion of parallel Coveralls uploads..."
14+
15+
# Check if we have a Coveralls token
16+
coveralls_token = get(ENV, "COVERALLS_TOKEN", nothing)
17+
if coveralls_token === nothing
18+
@warn "COVERALLS_TOKEN not found - parallel completion not needed"
19+
exit(0)
20+
end
21+
22+
# Signal that all parallel jobs are complete
23+
build_number = get(ENV, "BUILDKITE_BUILD_NUMBER", nothing)
24+
@info "Finishing parallel Coveralls uploads" build_number=build_number
25+
26+
try
27+
success = Coverage.finish_coveralls_parallel(token=coveralls_token, build_num=build_number)
28+
if success
29+
@info "Successfully signaled parallel job completion to Coveralls"
30+
exit(0)
31+
else
32+
@error "Failed to signal parallel completion"
33+
exit(1)
34+
end
35+
catch e
36+
@error "Error during parallel completion" exception=e
37+
exit(1)
38+
end

pipelines/scheduled/coverage/run_tests_parallel.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ const ncores = Sys.CPU_THREADS
99
@info "" Sys.CPU_THREADS
1010
@info "" ncores
1111

12-
script = """
13-
Base.runtests(["all", "--skip", "Pkg"]; ncores = $(ncores))
14-
"""
12+
script = if Sys.iswindows()
13+
"""
14+
Base.runtests(["all", "--skip", "Pkg", "Profile", "cmdlineargs"]; ncores = $(ncores))
15+
"""
16+
else
17+
"""
18+
Base.runtests(["all", "--skip", "Pkg"]; ncores = $(ncores))
19+
"""
20+
end
1521

1622
cmd = `$(Base.julia_cmd()) --code-coverage=lcov-%p.info -e $(script)`
1723

0 commit comments

Comments
 (0)