From 8be8d8bc3cf8f935d2360f9cbb9b2141d2448a8d Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Tue, 30 Jun 2026 10:29:08 +0900 Subject: [PATCH] Fix R coverage tooling dependencies --- .github/workflows/opencode-review.yml | 8 ++++---- scripts/ci/test_strix_quick_gate.sh | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/opencode-review.yml b/.github/workflows/opencode-review.yml index 998e18ba6..bf652dd93 100644 --- a/.github/workflows/opencode-review.yml +++ b/.github/workflows/opencode-review.yml @@ -550,11 +550,11 @@ jobs: } ensure_r_runtime() { - if command -v Rscript >/dev/null 2>&1; then + if command -v Rscript >/dev/null 2>&1 && dpkg -s libcurl4-openssl-dev libssl-dev libxml2-dev >/dev/null 2>&1; then return 0 fi - run_and_capture "R runtime install (r-base)" \ - bash -c 'sudo apt-get update && sudo apt-get install -y r-base' + run_and_capture "R runtime install (r-base and package headers)" \ + bash -c 'sudo apt-get update && sudo apt-get install -y r-base libcurl4-openssl-dev libssl-dev libxml2-dev' } run_r_test_coverage() { @@ -572,7 +572,7 @@ jobs: export R_LIBS_USER="${RUNNER_TEMP}/R-library" mkdir -p "$R_LIBS_USER" run_and_capture "R coverage tooling (covr/testthat)" \ - Rscript -e 'repos <- "https://cloud.r-project.org"; dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE, showWarnings = FALSE); .libPaths(c(Sys.getenv("R_LIBS_USER"), .libPaths())); for (pkg in c("covr", "testthat")) if (!requireNamespace(pkg, quietly = TRUE)) install.packages(pkg, repos = repos, lib = Sys.getenv("R_LIBS_USER"))' + Rscript -e 'repos <- "https://cloud.r-project.org"; lib <- Sys.getenv("R_LIBS_USER"); dir.create(lib, recursive = TRUE, showWarnings = FALSE); .libPaths(c(lib, .libPaths())); required <- c("covr", "testthat"); for (pkg in required) if (!requireNamespace(pkg, quietly = TRUE)) install.packages(pkg, repos = repos, lib = lib, dependencies = TRUE); missing <- required[!vapply(required, requireNamespace, logical(1), quietly = TRUE)]; if (length(missing)) stop("R coverage tooling packages unavailable after install: ", paste(missing, collapse = ", "))' if [ -f DESCRIPTION ]; then run_and_capture "R package coverage with missing-line report" \ Rscript -e 'cov <- covr::package_coverage(); print(cov); zero <- covr::zero_coverage(cov); if (NROW(zero) > 0) { print(zero); stop("R coverage below 100%; add tests for the listed files/lines.") }' diff --git a/scripts/ci/test_strix_quick_gate.sh b/scripts/ci/test_strix_quick_gate.sh index 6ec266e8c..4dc2e9f2a 100755 --- a/scripts/ci/test_strix_quick_gate.sh +++ b/scripts/ci/test_strix_quick_gate.sh @@ -402,7 +402,10 @@ assert_opencode_review_uses_codegraph_and_gpt5_fallback() { assert_file_contains "$workflow_file" "Checkout trusted OpenCode review workflow" "opencode review checks out central trusted workflow scripts before processing PR data" assert_file_contains "$workflow_file" "Checkout trusted OpenCode coverage contract" "opencode coverage job uses central trusted coverage tooling instead of target-repo copies" assert_file_contains "$workflow_file" 'R_LIBS_USER="${RUNNER_TEMP}/R-library"' "opencode R coverage installs packages into a writable runner user library" - assert_file_contains "$workflow_file" 'install.packages(pkg, repos = repos, lib = Sys.getenv("R_LIBS_USER"))' "opencode R coverage avoids unwritable system R library installs" + assert_file_contains "$workflow_file" 'install.packages(pkg, repos = repos, lib = lib' "opencode R coverage avoids unwritable system R library installs" + assert_file_contains "$workflow_file" "libcurl4-openssl-dev libssl-dev libxml2-dev" "opencode R coverage installs system headers required by covr dependencies" + assert_file_contains "$workflow_file" "dependencies = TRUE" "opencode R coverage installs transitive package dependencies for covr/testthat" + assert_file_contains "$workflow_file" "R coverage tooling packages unavailable after install" "opencode R coverage verifies covr/testthat are loadable after installation" assert_file_contains "$workflow_file" "repository: ContextualWisdomLab/.github" "opencode required workflow checks out the central source repository" assert_file_contains "$workflow_file" 'ref: ${{ steps.trusted_source.outputs.ref }}' "opencode required workflow checks out the resolved central ref" assert_file_contains "$workflow_file" "target_repository:" "opencode workflow_dispatch can target a repository whose PR does not inherit required workflows"