-
-
Notifications
You must be signed in to change notification settings - Fork 4
142 lines (118 loc) · 4.04 KB
/
R-CMD-check.yaml
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: R-CMD-check
on:
push:
branches-ignore:
- stable
- main
pull_request:
branches: [development]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
# Ubuntu
- {os: ubuntu-latest, r: 'devel', compiler: 'default', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release', compiler: 'default'}
- {os: ubuntu-latest, r: 'oldrel-1', compiler: 'default'}
# Windows
- {os: windows-latest, r: 'release', compiler: 'default'}
- {os: windows-latest, r: 'oldrel-1', compiler: 'default'}
# macOS Clang
- {os: macos-latest, r: 'release', compiler: 'clang'}
- {os: macos-latest, r: 'oldrel-1', compiler: 'clang'}
# macOS GCC via Homebrew
- {os: macos-latest, r: 'release', compiler: 'gcc'}
- {os: macos-latest, r: 'oldrel-1', compiler: 'gcc'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Install and update build tools (macOS)
if: runner.os == 'macOS'
run: |
brew update
brew upgrade
brew reinstall gcc
brew install libomp pkg-config
brew cleanup
- name: Configure Makevars (macOS-gcc)
if: runner.os == 'macOS' && matrix.config.compiler == 'gcc'
run: |
mkdir -p ~/.R
GCC_PATH=$(brew --prefix gcc)
OMP_PATH=$(brew --prefix libomp)
SDK_PATH=$(xcrun --show-sdk-path)
GCC_BIN=gcc-14
GXX_BIN=g++-14
cat << EOF > ~/.R/Makevars
# Compiler settings
CC=${GCC_PATH}/bin/${GCC_BIN}
CXX=${GCC_PATH}/bin/${GXX_BIN}
CXX11=${GCC_PATH}/bin/${GXX_BIN}
CXX14=${GCC_PATH}/bin/${GXX_BIN}
CXX17=${GCC_PATH}/bin/${GXX_BIN}
CXX20=${GCC_PATH}/bin/${GXX_BIN}
OMP_LIB=${OMP_PATH}/lib
OMP_INC=${OMP_PATH}/include
# Compiler flags
CPPFLAGS=-I\${OMP_INC} -isysroot ${SDK_PATH} -fopenmp
CFLAGS=-O3 -pedantic
CXXFLAGS=-O3 -pedantic
# Linker flags
LDFLAGS=-L\${OMP_LIB} -L${GCC_PATH}/lib -lomp -lgfortran -lm -isysroot ${SDK_PATH}
# Fortran configuration
FC=$(brew --prefix gfortran)/bin/gfortran
F77=$(brew --prefix gfortran)/bin/gfortran
FLIBS=-L$(brew --prefix gfortran)/lib -lgfortran -lquadmath
EOF
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent || '' }}
use-public-rspm: true
- name: Installing {pkgs}
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck reticulate
needs: check
- name: Check OpenMP availability
if: matrix.config.compiler != 'clang'
shell: Rscript {0}
run: |
# 1) check if OpenMP
# is available
Rcpp::cppFunction(plugins = "openmp",
code = "
bool is_available() {
#ifdef _OPENMP
return true;
#else
return false;
#endif
}
"
)
# 2) stop if not
# available
stopifnot(
"OpenMP not available!" = is_available()
)
- name: Setup Python and {reticulate}
uses: ./.github/actions/setup-reticulate
- name: R CMD check
uses: r-lib/actions/check-r-package@v2
with:
build_args: 'c("--no-manual", "--compact-vignettes=gs+qpdf")'
upload-snapshots: true