Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions .github/workflows/oracle.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -104,29 +104,37 @@ jobs:
upload: false

# Infer# — needs compiled binaries; build the target into one output dir.
# `dotnet build <dir>` errors (MSB1050) when a repo root holds more than one
# project/solution, so choose a target: explicit `build` input wins; else a
# lone solution (root-preferred, .sln or .slnx); else the dir (-> partial).
# Choose what to build: explicit `build` input wins; else the product
# library (`<repo>.csproj` outside tests/benchmarks — a leak scan wants the
# library, and building the whole solution often drags in unbuildable test
# projects); else a lone solution (.sln/.slnx); else the dir (-> partial).
- name: Build the target (for Infer#)
env:
BUILD: ${{ inputs.build }}
REPO: ${{ inputs.repo }}
continue-on-error: true
run: |
if [[ -n "$BUILD" ]]; then
tgt="target/$BUILD"
else
# Prefer a unique solution at the repo root; else a unique one anywhere
# (covers a lone deep solution); else fall back to the dir + note.
# Match both .sln and the newer XML .slnx (e.g. Dapper).
# The main library is almost always named after the repo; prefer a
# unique <repo>.csproj outside the test/benchmark/sample/example trees
# (-ipath: case-insensitive, so Tests/ Benchmarks/ etc. are excluded too).
name="${REPO##*/}"; name="${name%.git}"
mapfile -t named < <(find target -type f -name "$name.csproj" \
-not -ipath '*/test/*' -not -ipath '*/tests/*' -not -ipath '*/benchmark*' \
-not -ipath '*/sample*' -not -ipath '*/example*' | sort)
mapfile -t root_slns < <(find target -maxdepth 1 \( -name '*.sln' -o -name '*.slnx' \) | sort)
mapfile -t all_slns < <(find target \( -name '*.sln' -o -name '*.slnx' \) | sort)
if [[ ${#root_slns[@]} -eq 1 ]]; then
if [[ ${#named[@]} -eq 1 ]]; then
tgt="${named[0]}"
elif [[ ${#root_slns[@]} -eq 1 ]]; then
tgt="${root_slns[0]}"
elif [[ ${#root_slns[@]} -eq 0 && ${#all_slns[@]} -eq 1 ]]; then
tgt="${all_slns[0]}"
else
tgt="target"
echo "note: ${#root_slns[@]} root / ${#all_slns[@]} total solution(s) under target; pass the 'build' input to disambiguate"
echo "note: no unique '$name.csproj' and ${#root_slns[@]} root / ${#all_slns[@]} total solution(s); pass the 'build' input to disambiguate"
fi
fi
# Some repos (e.g. those using Nerdbank.GitVersioning) need git history to
Expand Down
12 changes: 7 additions & 5 deletions docs/notes/oracle.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,11 +36,13 @@ Two classes sit **outside** the three-way diff and are reported separately:
CodeQL constructs a database (here via `build-mode: none`, from source), Infer#
analyses compiled `.dll`+`.pdb`. So the oracle run can fail where ours doesn't
— that asymmetry is the point, and each oracle step is `continue-on-error` so a
build failure still yields a partial report. (For Infer#, the workflow
auto-builds a lone solution — a root-level `*.sln`/`*.slnx` preferred, else a
unique one anywhere; a repo with several needs the `build` input. The shallow
clone is deepened before building, since version tools like Nerdbank.GitVersioning
need history.)
build failure still yields a partial report. (For Infer#, the workflow prefers
the product library — a unique `<repo>.csproj` outside the
test/benchmark/sample/example trees — over the whole solution, since building
the solution often drags in test projects that won't build bare; it falls back
to a single root `*.sln`/`*.slnx`, then a single solution anywhere, then the
dir. The `build` input overrides. The shallow clone is deepened first, since
version tools like Nerdbank.GitVersioning need history.)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- **Path/line matching is deliberately loose.** Tools disagree on the exact line
(allocation site vs declaration) and on path prefixes. The comparator matches
on **basename + a line window** (`--line-tol`, default 3). Robust to prefixes;
Expand Down
Loading