Skip to content

Commit 37375c6

Browse files
committed
ENH: Refactor test.yml3.
1 parent 70f8bd1 commit 37375c6

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

.github/workflows/test.yml

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ jobs:
2323
- name: Install system dependencies
2424
run: |
2525
sudo apt-get update
26-
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev
26+
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev python3 python3-pip
2727
28-
# 🧠 Cache R packages
2928
- name: Cache R packages
3029
uses: actions/cache@v3
3130
with:
@@ -34,41 +33,36 @@ jobs:
3433
restore-keys: |
3534
${{ runner.os }}-r-pkgs-
3635
37-
# ✅ Install key R packages (pin reticulate version!)
38-
- name: Install R dependencies
39-
run: |
40-
Rscript -e 'install.packages(c("remotes", "testthat", "tensorflow", "reticulate"), repos = "https://cloud.r-project.org")'
41-
Rscript -e 'remotes::install_version("reticulate", version = "1.34.0", repos = "https://cloud.r-project.org")'
36+
- name: Cache reticulate environment
37+
uses: actions/cache@v3
38+
with:
39+
path: ~/.local/share/r-reticulate
40+
key: ${{ runner.os }}-reticulate-${{ hashFiles('DESCRIPTION') }}
41+
restore-keys: |
42+
${{ runner.os }}-reticulate-
4243
43-
# ✅ Install and configure Miniconda (clean Python)
44-
- name: Install and configure Miniconda
44+
- name: Install Python deps
4545
run: |
46-
Rscript -e 'reticulate::install_miniconda(force = TRUE)'
47-
Rscript -e 'reticulate::use_miniconda("r-reticulate", required = TRUE)'
48-
Rscript -e 'reticulate::py_config()'
46+
python3 -m pip install --upgrade pip
47+
pip install tensorflow==2.9.1 numpy h5py
4948
50-
# ✅ Install TensorFlow into that Python environment
51-
- name: Install TensorFlow
49+
- name: Install R dependencies
5250
run: |
53-
Rscript -e 'tensorflow::install_tensorflow()'
51+
Rscript -e 'install.packages(c("remotes", "testthat", "reticulate", "tensorflow"), repos = "https://cloud.r-project.org")'
5452
55-
# ✅ Configure GitHub PAT (ensure this secret exists!)
56-
- name: Configure GitHub PAT
53+
- name: Point reticulate to system Python
5754
run: |
58-
echo "GITHUB_PAT=${{ secrets.GH_PAT }}" >> $GITHUB_ENV
59-
echo "GITHUB_PAT=${{ secrets.GH_PAT }}" >> ~/.Renviron
55+
Rscript -e 'reticulate::use_python("/usr/bin/python3", required = TRUE)'
56+
Rscript -e 'reticulate::py_config()'
6057
61-
# ✅ Install ANTsR from GitHub
6258
- name: Install ANTsR
6359
run: |
6460
Rscript -e 'remotes::install_github("ANTsX/ANTsR", dependencies = TRUE)'
6561
66-
# ✅ Install ANTsRNet (current repo)
6762
- name: Install ANTsRNet
6863
run: |
6964
Rscript -e 'remotes::install_local(".", dependencies = TRUE)'
7065
71-
# ✅ Run tests
7266
- name: Run tests
7367
run: |
7468
Rscript -e 'testthat::test_dir("tests/testthat", reporter = testthat::SummaryReporter$new())'

0 commit comments

Comments
 (0)