Skip to content

Added robust_aitchison() function. #15 #27

Added robust_aitchison() function. #15

Added robust_aitchison() function. #15 #27

Workflow file for this run

name: rchk (Kalibera)
on:
workflow_dispatch:
pull_request:
push:
branches: [main]
paths:
- src/**
- .github/workflows/rchk.yaml
jobs:
rchk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# We need R to build the source package tarball
- uses: r-lib/actions/setup-r@v2
with:
r-version: 'release'
- name: Build Package
run: |
R CMD build --no-manual --no-build-vignettes .
mkdir packages
PKG_TAR=$(ls -1 *.tar.gz | head -n 1)
mv "$PKG_TAR" packages/
echo "PKG_TAR=$PKG_TAR" >> $GITHUB_ENV
- name: Run rchk
run: |
docker pull kalibera/rchk:latest
docker run --rm \
-v "$PWD/packages:/rchk/packages" \
kalibera/rchk:latest \
"/rchk/packages/${{ env.PKG_TAR }}"
- name: Verify Results
shell: Rscript {0}
run: |
# The rchk tool writes report files to:
# packages/libsonly/<pkg>/libs/<pkg>.so.{maacheck,bcheck}
pkg <- read.dcf("DESCRIPTION")[,"Package"]
libs_dir <- file.path("packages", "libsonly", pkg, "libs")
maacheck_file <- file.path(libs_dir, paste0(pkg, ".so.maacheck"))
bcheck_file <- file.path(libs_dir, paste0(pkg, ".so.bcheck"))
stopifnot(file.exists(maacheck_file))
stopifnot(file.exists(bcheck_file))
# Ignore "too many states" warnings from bcheck
# and the final "Analyzed 104 functions" summary line
errors <- readLines(bcheck_file)
errors <- errors[!grepl("too many states", errors)]
errors <- errors[!grepl("^Analyzed [0-9]+ functions", errors)]
# Anything in maacheck log is a failure
errors <- c(errors, readLines(maacheck_file))
# Remove empty lines
errors <- errors[nzchar(errors)]
if (length(errors) > 0) {
stop("rchk failed! Errors detected in analysis logs:\n", paste(errors, collapse = "\n"))
} else {
cat("\nSUCCESS: No memory protection errors found by rchk.\n")
}