Skip to content

Commit e35021f

Browse files
committed
Merge remote-tracking branch 'origin/master' into 34268-show-on-sparse-adjoints
2 parents ea36a5f + 27c8f60 commit e35021f

File tree

558 files changed

+17964
-18614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

558 files changed

+17964
-18614
lines changed

.buildkite/0_webui.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This file represents what is put into the webUI.
2+
# It is purely for keeping track of the changes we make to the webUI configuration; modifying this file has no effect.
3+
# We use the `cryptic` buildkite plugin to provide secrets management, which requires some integration into the WebUI's steps.
4+
agents:
5+
queue: "julia"
6+
sandbox.jl: "true"
7+
8+
steps:
9+
- label: ":unlock: Unlock secrets, launch pipelines"
10+
plugins:
11+
- staticfloat/cryptic:
12+
# Our list of pipelines that should be launched (but don't require a signature)
13+
# These pipelines can be modified by any contributor and CI will still run.
14+
# Build secrets will not be available in these pipelines (or their children)
15+
# but some of our signed pipelines can wait upon the completion of these unsigned
16+
# pipelines.
17+
unsigned_pipelines:
18+
- .buildkite/pipeline.yml
19+
20+
# Our signed pipelines must have a `signature` or `signature_file` parameter that
21+
# verifies the treehash of the pipeline itself and the inputs listed in `inputs`
22+
signed_pipelines:
23+
- pipeline: .buildkite/signed_pipeline_test.yml
24+
signature: "U2FsdGVkX18aZgryp6AJTArgD2uOnVWyFFGVOP5qsY4WbGQ/LVAcYiMEp9cweV+2iht+vmEF949CuuGTeQPA1fKlhPwkG3nZ688752DUB6en9oM2nuL31NoDKWHhpygZ"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file represents what is put into the webUI.
2+
# It is purely for keeping track of the changes we make to the webUI configuration; modifying this file has no effect.
3+
# We use the `cryptic` buildkite plugin to provide secrets management, which requires some integration into the WebUI's steps.
4+
agents:
5+
queue: "julia"
6+
sandbox.jl: "true"
7+
8+
steps:
9+
- label: ":unlock: Unlock secrets, launch pipelines"
10+
plugins:
11+
- staticfloat/cryptic:
12+
# Our signed pipelines must have a `signature` or `signature_file` parameter that
13+
# verifies the treehash of the pipeline itself and the inputs listed in `inputs`
14+
signed_pipelines:
15+
- pipeline: .buildkite/coverage-linux64/pipeline.yml
16+
signature: "U2FsdGVkX18eQWpd3hMYLO5Kd+6K+oBoLk1I6J3qIw7lc6g5/jaeWyq/wralosZCfTzyjS4NstNKFvhQf3KDPEBVElipNvTxoWOjVLRVOrfBqqvTkQN4xVosY/r026Gy"

.buildkite/coverage-linux64/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Coverage pipeline
2+
3+
We run coverage on a separate pipeline, that uses a scheduled build rather than webhooks.
4+
The pipeline is here: https://buildkite.com/julialang/julia-coverage-linux64
5+
6+
It contains [its own webui steps](0_webuiy.ml) (listed here in this repository for clarity) and its own [pipeline.yml](pipeline.yml).
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# These steps should only run on `sandbox.jl` machines, not `docker`-isolated ones
2+
# since we need nestable sandboxing. The rootfs images being used here are built from
3+
# the `.buildkite/rootfs_images/llvm-passes.jl` file.
4+
agents:
5+
queue: "julia"
6+
# Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing
7+
sandbox.jl: "true"
8+
os: "linux"
9+
10+
steps:
11+
- label: ":unlock: :coverage: Run coverage test"
12+
plugins:
13+
- staticfloat/cryptic:
14+
variables:
15+
- CODECOV_TOKEN="U2FsdGVkX19l0fhdBabbuiEdysyEabkJLRHfxm7CNRkuGbnwPV365sxxC7Czs/CVcws0N1oB4pVwALRRMe36oA=="
16+
- COVERALLS_TOKEN="U2FsdGVkX19zopI0hMNzzi2UUOvNVFD8Y0iisFnO/ryVxU7Tit8ZEaeN+gxodRx4CosUUh192F1+q3dTMWRIvw=="
17+
- JuliaCI/julia#v1:
18+
version: 1.6
19+
- staticfloat/sandbox#v1:
20+
rootfs_url: https://github.com/JuliaCI/rootfs-images/releases/download/v1/llvm-passes.tar.gz
21+
rootfs_treehash: "f3ed53f159e8f13edfba8b20ebdb8ece73c1b8a8"
22+
uid: 1000
23+
gid: 1000
24+
commands: |
25+
echo "--- Build Julia from source"
26+
make -j 6
27+
28+
echo "--- Print Julia version info"
29+
./julia -e 'using InteractiveUtils; InteractiveUtils.versioninfo()'
30+
./julia -e '@info "" Sys.CPU_THREADS'
31+
# this is necessary to make sure that the LibGit2 tests passes
32+
git config --global init.defaultBranch master
33+
34+
echo "--- Run Julia tests with code coverage enabled"
35+
# Run the actual tests
36+
./julia --code-coverage=all --sysimage-native-code=no .buildkite/coverage-linux64/run_tests_base.jl
37+
38+
echo "--- Process and upload coverage information"
39+
./julia .buildkite/coverage-linux64/upload_coverage.jl
40+
timeout_in_minutes: 600 # 600 minutes = 10 hours
41+
42+
# We must accept the signed job id secret in order to propagate secrets
43+
env:
44+
BUILDKITE_PLUGIN_CRYPTIC_BASE64_SIGNED_JOB_ID_SECRET: ${BUILDKITE_PLUGIN_CRYPTIC_BASE64_SIGNED_JOB_ID_SECRET?}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# When running this file, make sure to set the `--code-coverage=all` command-line flag.
2+
3+
# Important note: even if one or more tests fail, we will still exit with status code 0.
4+
5+
# The reason for this is that we always want to upload code coverage, even if some of the
6+
# tests fail. Therefore, even if the `coverage-linux64` pipeline passes, you should not
7+
# assume that all of the tests passed. If you want to know if all of the tests are passing,
8+
# please look at the status of the `tester_linux64` pipeline.
9+
10+
const include_tests = String[]
11+
12+
const exclude_tests = String[]
13+
14+
empty!(Base.DEPOT_PATH)
15+
push!(Base.DEPOT_PATH, mktempdir(; cleanup = true))
16+
17+
module ChooseTests
18+
include(joinpath(dirname(dirname(@__DIR__)), "test", "choosetests.jl"))
19+
end
20+
21+
const tests = ChooseTests.choosetests() |>
22+
first |>
23+
x -> setdiff(x, exclude_tests) |>
24+
x -> vcat(x, include_tests) |>
25+
unique |>
26+
sort
27+
28+
const ncores = min(Sys.CPU_THREADS, Threads.nthreads())
29+
30+
@info "" ncores Sys.CPU_THREADS Threads.nthreads()
31+
32+
try
33+
Base.runtests(tests; ncores)
34+
catch ex
35+
@error "" exception=(ex, catch_backtrace())
36+
end
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
empty!(Base.DEPOT_PATH)
2+
push!(Base.DEPOT_PATH, mktempdir(; cleanup = true))
3+
4+
import Pkg
5+
import Logging
6+
import TOML
7+
8+
Pkg.add(; name = "Coverage", uuid = "a2441757-f6aa-5fb2-8edb-039e3f45d037", version = "1")
9+
Pkg.precompile()
10+
11+
import Coverage
12+
13+
function process_folders()
14+
# `Coverage.process_folder` will have a LOT of `@info` statements that will make the log
15+
# way too long. So before we run `Coverage.process_folder`, we disable logging for `@info`
16+
# statements. After we run `Coverage.process_folder`, we re-enable logging for `@info`
17+
# statements.
18+
Logging.disable_logging(Logging.Info)
19+
fcs_base = Coverage.process_folder("base");
20+
fcs_stdlib = Coverage.process_folder("stdlib");
21+
Logging.disable_logging(Logging.Debug)
22+
23+
fcs = Coverage.merge_coverage_counts(
24+
fcs_base,
25+
fcs_stdlib,
26+
);
27+
28+
return fcs
29+
end
30+
31+
function get_external_stdlib_names(stdlib_dir::AbstractString)
32+
filename_list = filter(x -> isfile(joinpath(stdlib_dir, x)), readdir(stdlib_dir))
33+
# find all of the files like `Pkg.version`, `Statistics.version`, etc.
34+
regex_matches_or_nothing = match.(Ref(r"^([\w].*?)\.version$"), filename_list)
35+
regex_matches = filter(x -> x !== nothing, regex_matches_or_nothing)
36+
# get the names of the external stdlibs, like `Pkg`, `Statistics`, etc.
37+
external_stdlib_names = only.(regex_matches)
38+
unique!(external_stdlib_names)
39+
sort!(external_stdlib_names)
40+
@info "# Begin list of external stdlibs"
41+
for (i, x) in enumerate(external_stdlib_names)
42+
@info "$(i). $(x)"
43+
end
44+
@info "# End list of external stdlibs"
45+
return external_stdlib_names
46+
end
47+
48+
function get_external_stdlib_prefixes(stdlib_dir::AbstractString)
49+
external_stdlib_names = get_external_stdlib_names(stdlib_dir)
50+
prefixes_1 = joinpath.(Ref(stdlib_dir), external_stdlib_names, Ref(""))
51+
prefixes_2 = joinpath.(Ref(stdlib_dir), string.(external_stdlib_names, Ref("-")))
52+
prefixes = vcat(prefixes_1, prefixes_2)
53+
unique!(prefixes)
54+
sort!(prefixes)
55+
# example of what `prefixes` might look like:
56+
# 4-element Vector{String}:
57+
# "stdlib/Pkg-"
58+
# "stdlib/Pkg/"
59+
# "stdlib/Statistics-"
60+
# "stdlib/Statistics/"
61+
return prefixes
62+
end
63+
64+
function print_coverage_summary(fc::Coverage.FileCoverage)
65+
cov_lines, tot_lines = Coverage.get_summary(fc)
66+
if cov_lines == tot_lines == 0
67+
cov_pct = 0
68+
else
69+
cov_pct = floor(Int, cov_lines/tot_lines * 100)
70+
end
71+
pad_1 = 71
72+
pad_2 = 15
73+
pad_3 = 15
74+
col_1 = rpad(fc.filename, pad_1)
75+
col_2 = rpad(string(cov_pct, " %"), pad_2)
76+
col_3 = string(
77+
rpad(string(cov_lines), pad_3),
78+
string(tot_lines),
79+
)
80+
@info "$(col_1) $(col_2) $(col_3)"
81+
return nothing
82+
end
83+
84+
function print_coverage_summary(
85+
fcs::Vector{Coverage.FileCoverage}, description::AbstractString,
86+
)
87+
cov_lines, tot_lines = Coverage.get_summary(fcs)
88+
if cov_lines == tot_lines == 0
89+
cov_pct = 0
90+
else
91+
cov_pct = floor(Int, cov_lines/tot_lines * 100)
92+
end
93+
@info "$(description): $(cov_pct)% ($(cov_lines)/$(tot_lines))"
94+
return nothing
95+
end
96+
97+
function buildkite_env(name::String)
98+
value = String(strip(ENV[name]))
99+
if isempty(value)
100+
throw(ErrorException("environment variable $(name) is empty"))
101+
end
102+
return value
103+
end
104+
105+
function buildkite_env(name_1::String, name_2::String, default::String)
106+
value_1 = String(strip(ENV[name_1]))
107+
value_2 = String(strip(ENV[name_2]))
108+
!isempty(value_1) && return value_1
109+
!isempty(value_2) && return value_2
110+
return default
111+
end
112+
113+
function buildkite_branch_and_commit()
114+
branch = buildkite_env("BUILDKITE_BRANCH")
115+
commit = buildkite_env("BUILDKITE_COMMIT")
116+
head_rev_parse = String(strip(read(`git rev-parse HEAD`, String)))
117+
if strip(commit) == "HEAD"
118+
commit = head_rev_parse
119+
end
120+
if commit !== head_rev_parse
121+
msg = "mismatch"
122+
@error msg commit head_rev_parse
123+
throw(ErrorException(msg))
124+
end
125+
if !occursin(r"^[a-f0-9]{40}$", commit)
126+
msg = "BUILDKITE_COMMIT does not look like a long commit SHA"
127+
@error msg commit
128+
throw(ErrorException(msg))
129+
end
130+
return (; branch, commit)
131+
end
132+
133+
function codecov_buildkite_add_local_to_kwargs()
134+
branch, commit = buildkite_branch_and_commit()
135+
kwargs = Coverage.Codecov.set_defaults(
136+
Dict();
137+
branch,
138+
commit,
139+
)
140+
return kwargs
141+
end
142+
143+
function coveralls_buildkite_query_git_info()
144+
branch, commit = buildkite_branch_and_commit()
145+
remote_name = "origin"
146+
remote = buildkite_env("BUILDKITE_REPO")
147+
message = buildkite_env("BUILDKITE_MESSAGE")
148+
author_name = buildkite_env(
149+
"BUILDKITE_BUILD_AUTHOR",
150+
"BUILDKITE_BUILD_CREATOR",
151+
"",
152+
)
153+
author_email = buildkite_env(
154+
"BUILDKITE_BUILD_AUTHOR_EMAIL",
155+
"BUILDKITE_BUILD_CREATOR_EMAIL",
156+
"",
157+
)
158+
remotes = [
159+
Dict(
160+
"name" => remote_name,
161+
"url" => remote,
162+
)
163+
]
164+
head = Dict(
165+
"id" => commit,
166+
"author_name" => author_name,
167+
"author_email" => author_email,
168+
"committer_name" => author_name,
169+
"committer_email" => author_email,
170+
"message" => message,
171+
)
172+
git_info = Dict(
173+
"branch" => branch,
174+
"remotes" => remotes,
175+
"head" => head,
176+
)
177+
return git_info
178+
end
179+
180+
const fcs = process_folders()
181+
182+
# Only include source code files. Exclude test files, benchmarking files, etc.
183+
filter!(fcs) do fc
184+
occursin(r"^base\/", fc.filename) || occursin("/src/", fc.filename)
185+
end;
186+
187+
# Exclude all external stdlibs (stdlibs that live in external repos).
188+
const external_stdlib_prefixes = get_external_stdlib_prefixes("stdlib")
189+
filter!(fcs) do fc
190+
all(x -> !startswith(fc.filename, x), external_stdlib_prefixes)
191+
end;
192+
193+
# Exclude all stdlib JLLs (stdlibs of the form `stdlib/*_jll/`).
194+
filter!(fcs) do fc
195+
!occursin(r"^stdlib\/[A-Za-z0-9]*?_jll\/", fc.filename)
196+
end;
197+
198+
sort!(fcs; by = fc -> fc.filename);
199+
200+
print_coverage_summary.(fcs);
201+
print_coverage_summary(fcs, "Total")
202+
203+
let
204+
git_info = coveralls_buildkite_query_git_info()
205+
@info "" git_info
206+
@info "" git_info["branch"]
207+
@info "" git_info["head"]
208+
209+
# In order to upload to Coveralls, you need to have the `COVERALLS_TOKEN` environment variable defined.
210+
Coverage.Coveralls.submit_local(fcs, git_info)
211+
end
212+
213+
let
214+
kwargs = codecov_buildkite_add_local_to_kwargs()
215+
@info "" kwargs
216+
217+
# In order to upload to Codecov, you need to have the `CODECOV_TOKEN` environment variable defined.
218+
Coverage.Codecov.submit_generic(fcs, kwargs)
219+
end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Cryptic repository keys
2+
3+
This folder contains RSA-encrypted symmetric AES keys.
4+
These are used by buildkite agents to decrypt the secrets embedded within this repository.
5+
Each buildkite agent contains an RSA secret key that is used to unlock the symmetric AES key that was used to encrypt the secrets within this repository.
6+
For more information, see the [`cryptic` buildkite plugin repository](https://github.com/staticfloat/cryptic-buildkite-plugin).
256 Bytes
Binary file not shown.

.buildkite/llvm_passes.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# These steps should only run on `sandbox.jl` machines, not `docker`-isolated ones
2+
# since we need nestable sandboxing. The rootfs images being used here are built from
3+
# the `.buildkite/rootfs_images/llvm-passes.jl` file.
4+
agents:
5+
queue: "julia"
6+
# Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing
7+
sandbox.jl: "true"
8+
os: "linux"
9+
10+
steps:
11+
- label: "analyzegc"
12+
plugins:
13+
- JuliaCI/julia#v1:
14+
version: 1.6
15+
- staticfloat/sandbox#v1:
16+
rootfs_url: https://github.com/JuliaCI/rootfs-images/releases/download/v1/llvm-passes.tar.gz
17+
rootfs_treehash: "f3ed53f159e8f13edfba8b20ebdb8ece73c1b8a8"
18+
commands: |
19+
echo "--- Install in-tree LLVM dependencies"
20+
make -j 6 -C deps install-llvm install-clang install-llvm-tools install-libuv install-utf8proc install-unwind
21+
echo "+++ run clangsa/analyzegc"
22+
make -j 6 -C test/clangsa
23+
make -j 6 -C src analyzegc
24+
timeout_in_minutes: 60
25+
26+
- label: "llvmpasses"
27+
plugins:
28+
- JuliaCI/julia#v1:
29+
version: 1.6
30+
- staticfloat/sandbox#v1:
31+
rootfs_url: https://github.com/JuliaCI/rootfs-images/releases/download/v1/llvm-passes.tar.gz
32+
rootfs_treehash: "f3ed53f159e8f13edfba8b20ebdb8ece73c1b8a8"
33+
uid: 1000
34+
gid: 1000
35+
commands: |
36+
echo "+++ run llvmpasses"
37+
make -j 6 release
38+
make -j 6 -C src install-analysis-deps
39+
make -j 6 -C test/llvmpasses
40+
timeout_in_minutes: 60

0 commit comments

Comments
 (0)