feat: R-minor-sensitive binary builds (full + iterative) (#84)
## Summary
Builds R-minor-sensitive CRAN packages once per installed R minor version (into per-minor S3 slots `…/contrib/<x.y>/`) and everything else once into the generic slot, driven by bincraft 4.2.0's ABI classifier. Both the full and iterative pipelines are covered.
## What's in here
**Detection / precompute**
- `local/r-minor-helpers.R` — pure `classify_from_metadata()` (NeedsCompilation / risky `LinkingTo`) + `parse_build_args()`, with unit tests.
- `local/packages-to-build.R` — adds a per-package `r_minor_sensitive` flag: cheap CRAN-metadata rules first, source download + `bincraft::needs_per_minor_recompile()` only for the ambiguous compiled subset (fail-safe to sensitive). Classified once per package, applied to all versions.
**Full build**
- `local/build-all.R` — passes the per-row `is_r_minor_sensitive` flag; new `--sensitive-only` mode builds just the risky subset.
- `.crow/build-all-versions-{amd64,arm64}.yaml` — install-deps persists the sensitive subset; build step runs a sensitive-only pass under each non-primary `/opt/R/*` minor; new step uploads the generic index plus a per-minor index for each minor.
**Iterative build**
- All 14 `.crow/process-updates-*.yaml` — primary pass uses `r_minor_detection = 'classifier'`; a sensitive-only multi-R pass builds risky updates under each other minor; per-minor index upload added.
**Tooling / housekeeping**
- Pins bincraft `v4.1.1` → `v4.2.0` across all workflows; removes the superseded standalone `build-r-minor-sensitive-packages.yaml`.
- Adds prek/pre-commit hooks (prettier, markdownlint, editorconfig-checker, yamllint, air) and applies them repo-wide; excludes the verbatim GPL `LICENSE.md` and auxiliary shell scripts.
- Design + implementation docs under `docs/superpowers/`.
## Requires before merge
- A `v4.2.0` git tag must be pushed on the bincraft repo (codefloe.com/rpkgs/bincraft) — the workflow install steps pin `@v4.2.0`. The full-build install-deps clones `main`, so it is unaffected.
Reviewed-on: #84
This commit is contained in:
parent
f28ccaf008
commit
d558e27c11
1 changed files with 1171 additions and 413 deletions
|
|
@ -39,7 +39,7 @@ depends_on:
|
|||
|
||||
steps:
|
||||
- name: 'Build binaries'
|
||||
image: "reg.devxy.io/rpkgs/build-env-${OS}:${OS_VERSION}"
|
||||
image: 'reg.devxy.io/rpkgs/build-env-${OS}:${OS_VERSION}'
|
||||
pull: true
|
||||
environment:
|
||||
RED_HAT_DEV_PW:
|
||||
|
|
@ -57,7 +57,7 @@ steps:
|
|||
# normal env vars
|
||||
GIT_USER: pat-s
|
||||
# set the location of the 'pkgcache' cache dir which persists the R package dependencies needed to install the packages themselves
|
||||
R_PKG_CACHE_DIR: ""
|
||||
R_PKG_CACHE_DIR: ''
|
||||
R_LIBS_USER: /mnt/cache/R-pkgs
|
||||
CCACHE_DIR: /mnt/cache/ccache
|
||||
NCPUS: 2
|
||||
|
|
@ -70,6 +70,15 @@ steps:
|
|||
# pkgs = readRDS('/mnt/cache/pkgs_amd64.rds');
|
||||
- XVFB=$(command -v xwfb-run 2>/dev/null || command -v xvfb-run); XVFB_ARGS=""; if command -v xwfb-run >/dev/null 2>&1; then dnf install -y -q weston 2>/dev/null; XVFB_ARGS="-c weston"; fi
|
||||
- $XVFB $XVFB_ARGS -n $SPLIT_INDEX -- /opt/R/$R_VERSION/bin/Rscript local/build-all.R $SPLIT_INTO $SPLIT_INDEX $NCPUS 2>&1
|
||||
- |
|
||||
PRIMARY_MINOR=$(echo "$R_VERSION" | cut -d. -f1-2)
|
||||
for RBIN in /opt/R/*/bin/R; do
|
||||
RV=$(basename "$(dirname "$(dirname "$RBIN")")")
|
||||
RMINOR=$(echo "$RV" | cut -d. -f1-2)
|
||||
[ "$RMINOR" = "$PRIMARY_MINOR" ] && continue
|
||||
echo "=== R-minor-sensitive pass under R $RV ==="
|
||||
$XVFB $XVFB_ARGS -n $SPLIT_INDEX -- "$(dirname "$RBIN")/Rscript" local/build-all.R --sensitive-only $SPLIT_INTO $SPLIT_INDEX $NCPUS 2>&1 || true
|
||||
done
|
||||
# archive missed packages
|
||||
- /opt/R/$R_VERSION/bin/R -q -e "bincraft::process_unarchived_pkgs(paste(Sys.getenv('OS'), Sys.getenv('OS_VERSION')), Sys.getenv('ARCH'), workers = $NCPUS)"
|
||||
backend_options:
|
||||
|
|
@ -97,3 +106,47 @@ steps:
|
|||
operator: 'Equal'
|
||||
value: 'true'
|
||||
effect: 'NoSchedule'
|
||||
- name: 'Upload package indexes'
|
||||
image: 'reg.devxy.io/rpkgs/build-env-${OS}:${OS_VERSION}'
|
||||
pull: true
|
||||
environment:
|
||||
B2_S3_ACCESS_KEY:
|
||||
from_secret: B2_S3_ACCESS_KEY
|
||||
B2_S3_SECRET_KEY:
|
||||
from_secret: B2_S3_SECRET_KEY
|
||||
R_LIBS_USER: /mnt/cache/R-pkgs
|
||||
volumes:
|
||||
- ${ARCH}-binaries-r-dep-cache-${OS}-${OS_VERSION//./}:/mnt/cache
|
||||
commands:
|
||||
- |
|
||||
CODENAME=$(/opt/R/$R_VERSION/bin/Rscript -e "cat(bincraft::set_codename(NULL))")
|
||||
/opt/R/$R_VERSION/bin/R -q -e "bincraft::upload_package_index(codename = '$CODENAME', s3_endpoint = 'https://s3.eu-central-003.backblazeb2.com', s3_region = 'eu-central-003', s3_bucket = 'devxy-rpkgs-binaries', s3_access_key_id = Sys.getenv('B2_S3_ACCESS_KEY'), s3_secret_access_key = Sys.getenv('B2_S3_SECRET_KEY'))"
|
||||
for RBIN in /opt/R/*/bin/R; do
|
||||
RMINOR=$(basename "$(dirname "$(dirname "$RBIN")")" | cut -d. -f1-2)
|
||||
/opt/R/$R_VERSION/bin/R -q -e "bincraft::upload_package_index(codename = '$CODENAME', r_minor = '$RMINOR', s3_endpoint = 'https://s3.eu-central-003.backblazeb2.com', s3_region = 'eu-central-003', s3_bucket = 'devxy-rpkgs-binaries', s3_access_key_id = Sys.getenv('B2_S3_ACCESS_KEY'), s3_secret_access_key = Sys.getenv('B2_S3_SECRET_KEY'))" || true
|
||||
done
|
||||
backend_options:
|
||||
docker:
|
||||
resources:
|
||||
requests:
|
||||
memory: 5Gi
|
||||
cpu: 1000m
|
||||
limits:
|
||||
memory: 20Gi
|
||||
cpu: 2000m
|
||||
kubernetes:
|
||||
resources:
|
||||
requests:
|
||||
memory: 5Gi
|
||||
cpu: 1000m
|
||||
limits:
|
||||
memory: 20Gi
|
||||
cpu: 2000m
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: ${ARCH}
|
||||
node.kubernetes.io/instance-type: ${K8S_INSTANCE_TYPE}
|
||||
tolerations:
|
||||
- key: 'CI'
|
||||
operator: 'Equal'
|
||||
value: 'true'
|
||||
effect: 'NoSchedule'
|
||||
|
|
|
|||
Loading…
Reference in a new issue