Add win-builder check #1
This file contains 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: UBSAN/ASAN Checks | ||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
push: | ||
branches: ["nlopt-update"] | ||
workflow_dispatch: | ||
permissions: | ||
contents: read | ||
jobs: | ||
SAN-check: | ||
runs-on: ubuntu-latest | ||
name: clang-win-builder-SAN (llvm-${{ matrix.compiler }} R-${{matrix.R}}) | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
compiler: | ||
# - llvm-16.0.6 | ||
# - llvm-17.0.6 | ||
- llvm-18.1.8 | ||
# - llvm-19.1.0 | ||
# - llvm-20.0.0 | ||
R: ['release', 'devel'] | ||
env: | ||
CC: clang | ||
CXX: clang++ | ||
CXXFLAGS: "-fsanitize=address,undefined -fno-sanitize=float-divide-by-zero -fno-sanitize=alignment -fno-omit-frame-pointer -frtti -std=gnu++17" | ||
LINK: clang++ | ||
ASAN: true | ||
UBSAN: true | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
RSPM: https://packagemanager.rstudio.com/cran/__linux__/jammy/latest | ||
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | ||
## R CMD check | ||
_R_CHECK_CRAN_INCOMING_: false | ||
_R_CHECK_LENGTH_1_CONDITION_: true | ||
_R_CHECK_LENGTH_1_LOGIC2_: true | ||
_R_CHECK_MATRIX_DATA_: true | ||
## Specific to package | ||
_R_CHECK_USE_VALGRIND_: true | ||
UBSAN_OPTIONS: "print_stacktrace=1" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
./build/ | ||
~/vcpkg | ||
~/.cache/vcpkg/archives | ||
${{ env.LOCALAPPDATA }}/vcpkg/archives | ||
${{ env.APPDATA }}/vcpkg/archives | ||
${{ env.XDG_CACHE_HOME }}/vcpkg/archives | ||
~/.cache/ccache | ||
~/.ccache | ||
~/.config/ccache | ||
~/Library/Caches/ccache | ||
${{ env.LOCALAPPDATA }}/ccache | ||
${{ env.XDG_CACHE_HOME }}/ccache | ||
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt', './vcpkg.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ env.BUILD_TYPE }}- | ||
- uses: awalsh128/cache-apt-pkgs-action@latest | ||
with: | ||
packages: | | ||
cmake cmake-data gsl dh-elpa-helper libcmark-gfm-extensions0.29.0.gfm.3 | ||
libcmark-gfm0.29.0.gfm.3 libcurl4-openssl-dev libjsoncpp25 librhash0 | ||
pandoc pandoc-data | ||
- name: Setup Cpp (C++ / C) | ||
uses: aminya/setup-cpp@v1 | ||
with: | ||
compiler: ${{ matrix.compiler }} | ||
cmake: true | ||
cache-tools: true | ||
llvm: true | ||
make: true | ||
- uses: r-lib/actions/setup-tinytex@v2 | ||
- name: Install additional LaTeX packages | ||
run: | | ||
tlmgr update --self | ||
tlmgr install makeindex | ||
tlmgr list --only-installed | ||
- uses: r-lib/actions/setup-pandoc@v2 | ||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{matrix.R}} | ||
install-r: true | ||
- name: Query dependencies | ||
run: | | ||
install.packages('remotes') | ||
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) | ||
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") | ||
shell: Rscript {0} | ||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::rcmdcheck, any::roxygen2 | ||
needs: check | ||
- name: Session info | ||
run: | | ||
options(width = 100) | ||
pkgs <- installed.packages()[, "Package"] | ||
sessioninfo::session_info(pkgs, include_base = TRUE) | ||
shell: Rscript {0} | ||
- name: Build and Check ToxicR | ||
run: | | ||
r_output=$(R CMD build .) | ||
package_name=$(echo "$r_output" | sed -n "s/.*building ‘\([^’]*\.tar\.gz\)’.*/\1/p") | ||
R CMD check --as-cran $package_name | ||
shell: bash | ||
working-directory: "." | ||
- name: Upload check results | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ runner.os }}-rrelease-results | ||
path: | | ||
check | ||
!check/ToxicR.Rcheck/00_pkg_src |