ENH: Testing. #12
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 | |
| 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 | |
| # 🧠 Cache R packages | |
| - 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- | |
| # ✅ Install key R packages (pin reticulate version!) | |
| - name: Install R dependencies | |
| run: | | |
| Rscript -e 'install.packages(c("remotes", "testthat", "tensorflow", "reticulate"), repos = "https://cloud.r-project.org")' | |
| Rscript -e 'remotes::install_version("reticulate", version = "1.34.0", repos = "https://cloud.r-project.org")' | |
| # ✅ Install and configure Miniconda (clean Python) | |
| - name: Install and configure Miniconda | |
| run: | | |
| Rscript -e 'reticulate::install_miniconda(force = TRUE)' | |
| Rscript -e 'reticulate::use_miniconda("r-reticulate", required = TRUE)' | |
| Rscript -e 'reticulate::py_config()' | |
| # ✅ Install TensorFlow into that Python environment | |
| - name: Install TensorFlow | |
| run: | | |
| Rscript -e 'tensorflow::install_tensorflow()' | |
| # ✅ Configure GitHub PAT (ensure this secret exists!) | |
| - name: Configure GitHub PAT | |
| run: | | |
| echo "GITHUB_PAT=${{ secrets.GH_PAT }}" >> $GITHUB_ENV | |
| echo "GITHUB_PAT=${{ secrets.GH_PAT }}" >> ~/.Renviron | |
| # ✅ Install ANTsR from GitHub | |
| - name: Install ANTsR | |
| run: | | |
| Rscript -e 'remotes::install_github("ANTsX/ANTsR", dependencies = TRUE)' | |
| # ✅ Install ANTsRNet (current repo) | |
| - name: Install ANTsRNet | |
| run: | | |
| Rscript -e 'remotes::install_local(".", dependencies = TRUE)' | |
| # ✅ Run tests | |
| - name: Run tests | |
| run: | | |
| Rscript -e 'testthat::test_dir("tests/testthat", reporter = testthat::SummaryReporter$new())' |