-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (83 loc) · 2.96 KB
/
test_macos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: "Unit tests: macOS"
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
test:
name: tests on macOS with R ${{ matrix.R }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
R: ['4.1.0']
python-version: ['3.10'] # Explicitly define Python version in matrix
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.R }}
Ncpus: 2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}
- name: Cache R packages
uses: actions/cache@v2
id: cache
with:
path: |
${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-R${{ matrix.R }}-2-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-R${{ matrix.R }}-2-
- name: Install packages
run: |
install.packages(c("devtools"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}
- name: Setup Python environment
shell: Rscript {0}
run: |
library(reticulate)
# Use the GitHub Actions Python
Sys.setenv(RETICULATE_PYTHON = Sys.which("python"))
# Install pip packages
system2("pip", c("install", "--upgrade", "pip"))
system2("pip", c("install", "--upgrade", "numpy", "pandas", "matplotlib"))
system2("pip", c("install", "--upgrade", "git+https://github.com/SABS-R3-Epidemiology/epiabm.git@main#egg=pyEpiabm&subdirectory=pyEpiabm"))
# Verify Python configuration
py_config <- reticulate::py_config()
message("Python configuration:")
message(paste("Python version:", py_config$version))
message(paste("Python path:", py_config$python))
# Test imports
reticulate::py_run_string("
import numpy
import pandas
import matplotlib
import pyEpiabm
print('All required Python packages successfully imported')
")
- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
RETICULATE_PYTHON: ${{ env.pythonLocation }}/python
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check")
shell: Rscript {0}
- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true