-
Notifications
You must be signed in to change notification settings - Fork 1
294 lines (240 loc) · 13.7 KB
/
check-full.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
on:
push:
branches:
- master
- testing
- develop
pull_request:
branches:
- master
- testing
- develop
name: R-CMD-check
jobs:
R-CMD-check:
# 0. Define the systems to run on:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: macOS-13, r: 'release', pkgext: '.tgz'}
- {os: macOS-13, r: '4.3', pkgext: '.tgz'}
- {os: macOS-13, r: '4.2', pkgext: '.tgz'}
# - {os: macOS-latest, r: '4.1', pkgext: '.tgz'} # Disabled due to units failure
# - {os: macOS-latest, r: '4.0', pkgext: '.tgz'} # Failing in Install system dependencies on macOS
# Disccarded due to the following missing packages on Mac for R 3.6: tinytest, Rcpp, xml2, units, stringi, data.table:
#- {os: macOS-latest, r: '3.6', pkgext: '.tgz'}
- {os: windows-latest, r: 'release', pkgext: '.zip'}
- {os: windows-latest, r: '4.3', pkgext: '.zip'}
- {os: windows-latest, r: '4.2', pkgext: '.zip'}
# - {os: windows-latest, r: '4.1', pkgext: '.zip'} # Disabled due to stringi failure
# - {os: windows-latest, r: '4.0', pkgext: '.zip', rspm: "https://cloud.r-project.org"} # Disabled due to stringi failure
# - {os: windows-latest, r: '3.6', pkgext: '.zip', rspm: "https://cloud.r-project.org"} # Disabled due to stringi failure
- {os: ubuntu-latest, r: 'release', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
- {os: ubuntu-20.04, r: '4.3', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
- {os: ubuntu-20.04, r: '4.2', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
- {os: ubuntu-20.04, r: '4.1', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
- {os: ubuntu-20.04, r: '4.0', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
# - {os: ubuntu-20.04, r: '3.6', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"} # Disabled due to "vignette builder 'knitr' not found"
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
###################
#### 1. Setup: ####
###################
- uses: actions/checkout@v3
- name: Prepare for deployment at push
if: github.event_name == 'push'
run: |
curl "https://raw.githubusercontent.com/StoXProject/unstableRepo/main/scripts/checktag-actions.sh" --output unstableRepo_checktag.sh
curl "https://raw.githubusercontent.com/StoXProject/unstableRepo/main/scripts/deploy-actions.sh" --output unstableRepo_deploy.sh
chmod +x ./unstableRepo_checktag.sh ./unstableRepo_deploy.sh
. unstableRepo_checktag.sh
curl "https://raw.githubusercontent.com/StoXProject/testingRepo/main/scripts/checktag-actions.sh" --output testingRepo_checktag.sh
curl "https://raw.githubusercontent.com/StoXProject/testingRepo/main/scripts/deploy-actions.sh" --output testingRepo_deploy.sh
chmod +x ./testingRepo_checktag.sh ./testingRepo_deploy.sh
. testingRepo_checktag.sh
curl "https://raw.githubusercontent.com/StoXProject/repo/master/scripts/checktag-actions.sh" --output repo_checktag.sh
curl "https://raw.githubusercontent.com/StoXProject/repo/master/scripts/deploy-actions.sh" --output repo_deploy.sh
chmod +x ./repo_checktag.sh ./repo_deploy.sh
. repo_checktag.sh
echo "PRERELEASE=${PRERELEASE}" >> $GITHUB_ENV
echo "FINAL_TAG=${FINAL_TAG}" >> $GITHUB_ENV
echo "PKG_FILE_PREFIX=${PKG_FILE_PREFIX}" >> $GITHUB_ENV
echo "PKG_FILE=${PKG_FILE_PREFIX}${{ matrix.config.pkgext }}" >> $GITHUB_ENV
echo "PKG_FREL=${PKG_FILE_PREFIX}-R.${{ matrix.config.r }}-${{ runner.os }}${{ matrix.config.pkgext }}" >> $GITHUB_ENV
echo "PKG_REPO=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
shell: bash
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
- uses: r-lib/actions/setup-pandoc@v2
#############################################################################
#### 2. R package installation (with system and R package dependencies): ####
#############################################################################
## 2a. Cache R packages:
#- name: Query R package dependencies
# run: |
# install.packages('remotes')
# saveRDS(remotes::dev_package_deps(dependencies = TRUE), "depends.Rds", version = 2)
# writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
# shell: Rscript {0}
#- name: Cache R packages
# if: runner.os != 'Windows'
# uses: actions/cache@v3
# with:
# path: ${{ env.R_LIBS_USER }}
# key: ${{ env.cache-version }}-${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
# restore-keys: ${{ env.cache-version }}-${{ runner.os }}-r-${{ matrix.config.r }}-
## 2b. System dependencies:
- name: Install system dependencies on macOS
if: runner.os == 'macOS'
run: |
# gfortran may not exist in a period after a new R minor release:
gfortranFile='/usr/local/bin/gfortran'
if [ -f "$gfortranFile" ] ; then
rm "$gfortranFile"
fi
rm '/usr/local/bin/2to3'
rm '/usr/local/bin/2to3-3.11'
rm '/usr/local/bin/idle3.11'
rm '/usr/local/bin/idle3'
rm '/usr/local/bin/pydoc3'
rm '/usr/local/bin/python3'
rm '/usr/local/bin/python3-config'
rm '/usr/local/bin/pydoc3.11'
rm '/usr/local/bin/python3.11'
rm '/usr/local/bin/python3.11-config'
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=false # This prevents Homebrew from re-installing R, which will lead to .Platform$pkgType = "source".
brew install gdal udunits
shell: bash
- name: Install system dependencies on Linux
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Prepare for CRANdependencies on Linux
if: runner.os == 'Linux'
run: |
sudo apt-get install -y libcurl4-openssl-dev
sudo apt-get install -y libudunits2-dev
shell: bash
## 2c. R packages needed for this yaml script (not related to the Rstox package itself):
- name: Install CRANdependencies
run: |
install.packages(c("rcmdcheck", "git2r", "sessioninfo", "knitr", "remotes"))
# Using the latest drat that supports big sur (after inputs from us).
# When the next drat appears on CRAN this can be changed to install from CRAN:
remotes::install_github(repo = 'eddelbuettel/drat', dependencies = FALSE)
shell: Rscript {0}
## 2d. Install dependencies:
- name: Install R package dependencies
run: |
remotes::install_deps(dependencies = TRUE, repos = "https://cloud.r-project.org/")
shell: Rscript {0}
## 2e. Session info:
- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
## 2f. Additional installs to secure specific versions to patch incompatibilities with older R versions:
- name: Additional installs to secure specific versions
run: |
pkgs <- installed.packages()[, "Package"]
s <- sessioninfo::session_info(pkgs, include_base = TRUE)
onlyStringi <- subset(s$packages, package == "stringi")
if("stringi" %in% as.data.frame(s$packages)$package && is.na(subset(s$packages, package == "stringi")$ondiskversion)) {
remotes::install_github("gagolews/stringi")
}
shell: Rscript {0}
#####################################
#### 3. Check the Rstox package: ####
#####################################
- name: Check
env:
_R_CHECK_CRAN_INCOMING_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
#######################################################
#### 4. Build the package source and binary files: ####
#######################################################
- name: Build package source archive from branches develop, testing and master (on Linux for some reason)
if: runner.os == 'Linux' && matrix.config.r == 'release' && github.event_name == 'push' && (github.ref_name == 'master' || github.ref_name == 'testing' || github.ref_name == 'develop')
run: |
pkgbuild::build(".", dest_path = ".", binary = FALSE)
system(paste0("PKG_FREL=", Sys.getenv("PKG_FILE"), " >> ", Sys.getenv("GITHUB_ENV")))
shell: Rscript {0}
- name: Build package binary archive from branches develop, testing and master for Windows and macOS (this builds also on matrix.config.r = release, which can or can not be a duplicate)
if: (runner.os == 'Windows' || runner.os == 'macOS') && github.event_name == 'push' && (github.ref_name == 'master' || github.ref_name == 'testing' || github.ref_name == 'develop')
run: |
pkgbuild::build(".", dest_path = ".", binary = TRUE)
print("PKG_FILE")
print(Sys.getenv("PKG_FILE"))
print("PKG_FREL")
print(Sys.getenv("PKG_FREL"))
file.copy(Sys.getenv("PKG_FILE"), Sys.getenv("PKG_FREL"))
shell: Rscript {0}
######################################
#### 5. Deploy to the drat repos: ####
######################################
## 5a. Upload to the official (DRAT) repo, but only from the master branch. Here we skip the matrix.config.r = release, as a new StoX release should be ready shortly after each R minor release and listed specifically in the matrix.config:
- name: Upload to the official (DRAT) repo
if: ( (runner.os == 'Windows' && matrix.config.r != 'release') || (runner.os == 'macOS' && matrix.config.r != 'release') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'master'
env:
BUILD_NUMBER: ${{ github.sha }}
DRAT_DEPLOY_TOKEN: ${{ secrets.DRAT_DEPLOY_TOKEN }}
run: . repo_deploy.sh
shell: bash
## 5b. Upload to the (DRAT) testingRepo, but only from the testing branch. Here we skip the matrix.config.r = release, as a new StoX release should be ready shortly after each R minor release and listed specifically in the matrix.config:
- name: Upload to the testing (DRAT) repo
if: ( (runner.os == 'Windows' && matrix.config.r != 'release') || (runner.os == 'macOS' && matrix.config.r != 'release') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'testing'
env:
BUILD_NUMBER: ${{ github.sha }}
DRAT_DEPLOY_TOKEN: ${{ secrets.DRAT_DEPLOY_TOKEN }}
run: . testingRepo_deploy.sh
shell: bash
## 5c. Upload to the (DRAT) unstableRepo, but only from the develop branch. Here we skip the matrix.config.r = release, as a new StoX release should be ready shortly after each R minor release and listed specifically in the matrix.config:
- name: Upload to the unstable (DRAT) repo
if: ( (runner.os == 'Windows' && matrix.config.r != 'release') || (runner.os == 'macOS' && matrix.config.r != 'release') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'develop'
env:
BUILD_NUMBER: ${{ github.sha }}
DRAT_DEPLOY_TOKEN: ${{ secrets.DRAT_DEPLOY_TOKEN }}
run: . unstableRepo_deploy.sh
shell: bash
###############################
#### 6. Release on GitHub: ####
###############################
- name: Create release on GitHub and upload files for testing branch
if: ( (runner.os == 'Windows' && matrix.config.r != 'release') || (runner.os == 'macOS' && matrix.config.r != 'release') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'testing'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
commit: testing
tag: ${{ env.FINAL_TAG }}
name: ${{ env.FINAL_TAG }}
artifacts: ${{ env.PKG_REPO }}/${{ env.PKG_FREL }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release on GitHub and upload files for master branch
if: ( (runner.os == 'Windows' && matrix.config.r != 'release') || (runner.os == 'macOS' && matrix.config.r != 'release') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'master'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
commit: master
tag: ${{ env.FINAL_TAG }}
name: ${{ env.FINAL_TAG }}
artifacts: ${{ env.PKG_REPO }}/${{ env.PKG_FREL }}
token: ${{ secrets.GITHUB_TOKEN }}