Skip to content

ENH: Testing.

ENH: Testing. #33

Workflow file for this run

name: R-CMD-check ANTsRNet
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
runs-on: ubuntu-22.04
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RETICULATE_PYTHON: /usr/bin/python3
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev python3 python3-pip
- name: Cache R packages
uses: actions/cache@v3
with:
path: ~/.cache/R
key: ${{ runner.os }}-r-pkgs-${{ hashFiles('DESCRIPTION') }}
restore-keys: |
${{ runner.os }}-r-pkgs-
- name: Install Python deps
run: |
python3 -m pip install --upgrade pip
python3 -m pip install tensorflow==2.12 numpy==1.23 h5py
- name: Install R dependencies with pinned reticulate
run: |
Rscript -e '
cat("✅ Installing R packages...\n");
install.packages(c("remotes", "testthat", "tensorflow", "reticulate"), repos = "https://cloud.r-project.org");
cat("✅ Pointing reticulate to system Python...\n");
reticulate::use_python(Sys.getenv("RETICULATE_PYTHON"), required = TRUE);
cat("✅ Installing TensorFlow via R package...\n");
tensorflow::install_tensorflow(version = "2.12");
'
- name: Configure GitHub PAT
run: |
echo "GITHUB_PAT=${{ secrets.GH_PAT }}" >> $GITHUB_ENV
echo "GITHUB_PAT=${{ secrets.GH_PAT }}" >> ~/.Renviron
- name: Install ANTsR
run: |
Rscript -e 'remotes::install_github("ANTsX/ANTsR", dependencies = TRUE)'
- name: Install ANTsRNet
run: |
Rscript -e 'remotes::install_local(".", dependencies = TRUE)'
- name: Run tests individually (non-fatal)
continue-on-error: true
run: |
for f in tests/testthat/test_*.R; do
echo "===== Running $f ====="
Rscript -e "testthat::test_file('$f', reporter = 'summary')" || echo "Test $f failed"
done