ENH: Testing. #27
Workflow file for this run
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: 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.16.0 numpy==1.24 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.16.0"); | |
| ' | |
| - 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 | |
| run: | | |
| Rscript -e 'testthat::test_dir("tests/testthat", reporter = testthat::SummaryReporter$new())' |