diff --git a/.github/workflows/oracle.yml b/.github/workflows/oracle.yml index acf767e6..c506c436 100644 --- a/.github/workflows/oracle.yml +++ b/.github/workflows/oracle.yml @@ -106,7 +106,7 @@ jobs: # Infer# — needs compiled binaries; build the target into one output dir. # `dotnet build ` 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); else the dir (continue-on-error -> partial). + # lone solution (root-preferred, .sln or .slnx); else the dir (-> partial). - name: Build the target (for Infer#) env: BUILD: ${{ inputs.build }} @@ -115,19 +115,24 @@ jobs: if [[ -n "$BUILD" ]]; then tgt="target/$BUILD" else - # Prefer a unique solution at the repo root; else a unique solution - # anywhere (covers a lone deep .sln); else fall back to the dir + note. - mapfile -t root_slns < <(find target -maxdepth 1 -name '*.sln' | sort) - mapfile -t all_slns < <(find target -name '*.sln' | sort) + # 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). + 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 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 .sln under target; pass the 'build' input to disambiguate" + echo "note: ${#root_slns[@]} root / ${#all_slns[@]} total solution(s) under target; pass the 'build' input to disambiguate" fi fi + # Some repos (e.g. those using Nerdbank.GitVersioning) need git history to + # compute a version at build time; the clone is shallow, so deepen it. + # Harmless (|| true) when the repo is already complete or doesn't need it. + git -C target fetch --unshallow --tags --quiet 2>/dev/null || true echo "Infer# build target: $tgt" if dotnet build "$tgt" -c Release -o _bin -v quiet; then echo "BUILD_OK=1" >> "$GITHUB_ENV" diff --git a/docs/notes/oracle.md b/docs/notes/oracle.md index 27f8112e..93cf8e32 100644 --- a/docs/notes/oracle.md +++ b/docs/notes/oracle.md @@ -37,9 +37,10 @@ Two classes sit **outside** the three-way diff and are reported separately: 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` preferred, else a unique one - anywhere; a repo with several needs the `build` input, since `dotnet build - ` is ambiguous otherwise, MSB1050.) + 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.) - **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;