Create CNAME #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Simple Sanitizer Checks | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: read-all | |
| jobs: | |
| sanitizer-checks: | |
| runs-on: ubuntu-latest | |
| name: "${{ matrix.config.name }}" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - {name: 'ASAN', image: 'ghcr.io/r-hub/containers/clang-asan:latest'} | |
| - {name: 'UBSAN', image: 'ghcr.io/r-hub/containers/clang-ubsan:latest'} | |
| container: | |
| image: ${{ matrix.config.image }} | |
| options: --cap-add=SYS_PTRACE | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| R_KEEP_PKG_SOURCE: yes | |
| _R_CHECK_CRAN_INCOMING_: false | |
| _R_CHECK_FORCE_SUGGESTS_: false | |
| DEBIAN_FRONTEND: noninteractive | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| run: | | |
| # Update and install basic system dependencies | |
| apt-get update -qq | |
| apt-get install -y --no-install-recommends \ | |
| git \ | |
| wget \ | |
| ca-certificates \ | |
| libcurl4-openssl-dev \ | |
| libssl-dev \ | |
| libxml2-dev \ | |
| libfontconfig1-dev \ | |
| libharfbuzz-dev \ | |
| libfribidi-dev \ | |
| libfreetype6-dev \ | |
| libpng-dev \ | |
| libtiff5-dev \ | |
| libjpeg-dev \ | |
| make \ | |
| pandoc \ | |
| qpdf | |
| - name: Setup R profile for CRAN | |
| run: | | |
| # Use CRAN mirror | |
| echo 'options(repos = c(CRAN = "https://cloud.r-project.org"))' >> ~/.Rprofile | |
| echo 'options(download.file.method = "libcurl")' >> ~/.Rprofile | |
| echo 'options(Ncpus = 2)' >> ~/.Rprofile | |
| - name: Install R packages | |
| run: | | |
| # Install packages step by step to handle failures | |
| Rscript -e 'install.packages("remotes")' | |
| Rscript -e 'install.packages("testthat")' | |
| Rscript -e 'install.packages("rcmdcheck")' | |
| # Install dependencies for the main package | |
| Rscript -e 'remotes::install_deps(".", dependencies = TRUE, upgrade = FALSE)' | |
| # Install cpp11armadillotest dependencies if present | |
| if [ -d "cpp11armadillotest" ]; then | |
| Rscript -e 'remotes::install_deps("cpp11armadillotest", dependencies = TRUE, upgrade = FALSE)' | |
| fi | |
| - name: Remove vignettes | |
| run: | | |
| # Remove vignettes to avoid pandoc issues | |
| rm -rf vignettes | |
| if [ -d "cpp11armadillotest" ]; then | |
| rm -rf cpp11armadillotest/vignettes | |
| fi | |
| - name: Build and check main package | |
| run: | | |
| # Build package | |
| R CMD build --no-build-vignettes --no-manual . | |
| PKG_TARBALL=$(ls -1t *.tar.gz | head -n 1) | |
| R CMD check --no-manual --no-vignettes --no-build-vignettes "$PKG_TARBALL" | |
| - name: Install and test cpp11armadillotest | |
| if: always() | |
| run: | | |
| if [ -d "cpp11armadillotest" ]; then | |
| # Build cpp11armadillotest | |
| R CMD build --no-build-vignettes --no-manual cpp11armadillotest | |
| CPP11_TARBALL=$(ls -1t cpp11armadillotest*.tar.gz | head -n 1) | |
| # Install with tests | |
| R CMD INSTALL --install-tests "$CPP11_TARBALL" | |
| # Run tests with sanitizers | |
| Rscript -e ' | |
| library(testthat) | |
| library(cpp11armadillotest) | |
| # Find test directory | |
| pkg_path <- find.package("cpp11armadillotest") | |
| test_path <- file.path(pkg_path, "tests") | |
| if (dir.exists(test_path)) { | |
| cat("Running tests from:", test_path, "\n") | |
| # Run tests | |
| old_wd <- getwd() | |
| setwd(test_path) | |
| result <- tryCatch({ | |
| test_check("cpp11armadillotest", reporter = "progress") | |
| }, error = function(e) { | |
| cat("Test error:", conditionMessage(e), "\n") | |
| NULL | |
| }) | |
| setwd(old_wd) | |
| if (!is.null(result)) { | |
| print(result) | |
| } | |
| } else { | |
| cat("Test directory not found at:", test_path, "\n") | |
| } | |
| ' | |
| fi | |
| - name: Check for sanitizer issues | |
| if: always() | |
| run: | | |
| echo "=== Checking for sanitizer output ===" | |
| # Check all log files for sanitizer output | |
| find . -name "*.Rout*" -o -name "*.log" | while read f; do | |
| if grep -E "(ERROR: AddressSanitizer|ERROR: LeakSanitizer|runtime error:|ERROR SUMMARY:|definitely lost:|Invalid read|Invalid write)" "$f" 2>/dev/null; then | |
| echo "=== Found sanitizer errors in $f ===" | |
| cat "$f" | |
| fi | |
| done | |
| # Specifically check the package check directory | |
| if [ -d *.Rcheck ]; then | |
| find *.Rcheck -type f -name "*.Rout*" -exec grep -l "ERROR:" {} \; | while read f; do | |
| echo "=== Errors in $f ===" | |
| cat "$f" | |
| done | |
| fi | |
| - name: Upload check results | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.config.name }}-results | |
| path: | | |
| *.Rcheck/ | |
| *.tar.gz |