-
Notifications
You must be signed in to change notification settings - Fork 32
259 lines (232 loc) · 9.33 KB
/
ci-tests.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
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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
#
# See https://github.com/r-lib/actions/tree/v2/examples#readme for
# additional example workflows available for the R community.
name: ci-tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '12 23 13,28 * *'
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.config.os-name }}-${{ matrix.config.os-version }}
name: >-
${{ matrix.config.os-name }}-${{ matrix.config.os-version }}
R ${{ matrix.config.r-version}} - java ${{ matrix.config.java}}
strategy:
fail-fast: false
matrix:
config:
- os-name: ubuntu # windows-2019, macos-10.15]
os-version: latest
r-version: oldrel
java: 17 #8
vignettes: true
xlc-repo: https://jcenter.bintray.com
timezone-name: Europe/Zurich
- os-name: ubuntu # windows-2019, macos-10.15]
os-version: latest
r-version: release
java: 21
vignettes: true
timezone-name: Asia/Kathmandu
- os-name: ubuntu # windows-2019, macos-10.15]
os-version: "20.04"
r-version: devel
java: 17
vignettes: true
xlc-repo: https://jcenter.bintray.com
timezone-name: Pacific/Marquesas
- os-name: macos # TODO fix java / R interaction
os-version: latest
r-version: release
# java: 13
vignettes: false
- os-name: windows # windows-2019, macos-10.15]
os-version: "2019"
r-version: release
java: 8
vignettes: false
timezone-name: "W. Europe Standard Time"
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
XLCONNECT_JAVA_REPO_URL: ${{ matrix.config.xlc-repo }}
steps:
- uses: actions/checkout@v4
- name: Setup java (x64)
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.config.java }}
java-package: jdk
architecture: x64
if: matrix.config.os-name != 'macos' && matrix.config.java != 11
- name: Set up R ${{ matrix.config.r-version }}
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r-version }}
use-public-rspm: true
- name: print effective R version
run: version
shell: Rscript {0}
- name: test additional java env var
if: ${{!matrix.config.vignettes}} # covering with / without the var being present
run: echo 'JAVA_TOOL_OPTIONS="-Dlog4j.formatMsgNoLookups=true"' >> $GITHUB_ENV
# todo not sure if this is run again during "Install and cache dependencies" before rJava install
- name: run javareconf # Yes it actually needs JAVA_HOME=$JAVA_HOME, doesn't use actual env vars (!)
if: runner.os != 'Windows' && matrix.config.java != 11
run: |
java -version
echo java_home:$JAVA_HOME
echo library paths: $LD_LIBRARY_PATH
sudo R CMD javareconf JAVA_HOME=$JAVA_HOME
- name: effective java version # Yes it actually needs JAVA_HOME=$JAVA_HOME, doesn't use actual env vars (!)
if: runner.os == 'Windows'
run: java -version
- name: Install and cache dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: ${{ matrix.config.java }}
extra-packages: |
any::covr
any::rcmdcheck
any::remotes
- name: Install tinytex
if: matrix.config.vignettes
uses: r-lib/actions/setup-tinytex@v2
- name: Install extra Tex packages
if: matrix.config.vignettes
run: |
pak::pkg_install('tinytex')
library(tinytex)
tlmgr_update(self=TRUE, all=FALSE)
tlmgr_install('datetime')
tlmgr_install('hyperref')
tlmgr_install('url')
tlmgr_install('fmtcount')
tinytex:::install_yihui_pkgs()
shell: Rscript {0}
- name: Install PDF system dependencies
if: runner.os == 'Linux' && matrix.config.vignettes
run: |
sudo apt-get install -y qpdf ghostscript tidy
- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessionInfo()
shell: Rscript {0}
- name: set TZ for tests / check
run: echo 'TZ=${{ matrix.config.timezone-name }}' >> $GITHUB_ENV
- uses: 'szenius/set-timezone@v1.2'
if: matrix.config.os-name == 'ubuntu'
with:
timezoneLinux: ${{ matrix.config.timezone-name }}
- uses: 'szenius/set-timezone@v1.2'
if: matrix.config.os-name == 'macos'
with:
timezoneMacos: ${{ matrix.config.timezone-name }}
- uses: 'szenius/set-timezone@v1.2'
if: matrix.config.os-name == 'windows'
with:
timezoneWindows: ${{ matrix.config.timezone-name }}
- name: Check without doc
if: ${{!matrix.config.vignettes}}
uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual", "--no-vignettes", "--no-build-vignettes", "--check-subdirs=no",
"--no-multiarch"["${{matrix.config.os-name}}" == "windows"])'
build_args: 'c("--no-build-vignettes")'
error-on: '"error"'
env:
FULL_TEST_SUITE: 1
- name: Check with doc
if: matrix.config.vignettes
uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--as-cran")'
build_args: 'c("--compact-vignettes=gs+qpdf")'
env:
FULL_TEST_SUITE: 0
- name: run complete test suite # some tests are not run in r check, as test xls(x) files are Rbuild-ignored
if: always()
env:
_R_CHECK_CRAN_INCOMING_: false
FULL_TEST_SUITE: 1
RCMDCHECK: "FALSE"
run: |
install_opts = if("${{matrix.config.os-name}}" == "windows") {
c("--no-multiarch")
} else {
c()
}
install.packages(list.files("./check", pattern = "XLConnect_.*.tar.gz", full.names = TRUE), repos=NULL, type="source", INSTALL_opts=install_opts)
setwd("tests")
source("run_tests.R")
shell: Rscript {0}
- name: Show test output
if: always()
run: |
echo $(date)
cat inst/unitTests/resources/XLConnect_Unit_Tests.txt || true
git clean -fd "*xls*"
grep -i "0 errors, 0 failures" inst/unitTests/resources/XLConnect_Unit_Tests.txt
shell: bash
continue-on-error: true
- name: coverage report
if: success() && matrix.config.r-version == 'release' && matrix.config.os-name == 'ubuntu'
run: |
library(covr)
covr::codecov(function_exclusions=c("onLoad", "onAttach", "xlcEnsureDependencies", "checkSystemPackage"))
shell: Rscript {0}
- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ matrix.config.os-name }}${{matrix.config.os-version}}-java${{ matrix.config.java }}-R${{ matrix.config.r-version }}-results
path: |
inst/unitTests/resources/XLConnect_Unit_Tests.*
check/XLConnect.Rcheck/
!check/XLConnect.Rcheck/**/*.jar
!check/XLConnect.Rcheck/00_pkg_src/
- name: Upload successfully built package
if: success() && matrix.config.vignettes
uses: actions/upload-artifact@main
with:
name: ${{ matrix.config.os-name }}${{matrix.config.os-version}}-java${{ matrix.config.java }}-R${{ matrix.config.r-version }}-results
path: |
check/XLConnect_*.tar.gz
- name: checkout XLConnect java
if: success() && matrix.config.r-version == 'release' && matrix.config.os-name == 'ubuntu'
uses: actions/checkout@v4
with:
repository: miraisolutions/xlconnect-java
# specify the below if you are working on a parallel xlconnect-java branch
# ref: feature/...
- name: retrieve POM dependencies using maven
if: success() && matrix.config.r-version == 'release' && matrix.config.os-name == 'ubuntu'
run: |
ls -la
mvn dependency:copy-dependencies
- name: compare JAR hashes
if: success() && matrix.config.r-version == 'release' && matrix.config.os-name == 'ubuntu'
run: |
set -eux -o pipefail
XLC_JAR_PATH=$(Rscript -e "cat(.libPaths()[1])")/XLConnect/java
rm -f "$XLC_JAR_PATH"/XLConnect*
find . -maxdepth 1 -type f -exec sha512sum {} + |\
sort -k2 | tee /dev/fd/2 | awk '{print $1}' > effective_hashes
find /home/runner/work/xlconnect/xlconnect/target/dependency/ -maxdepth 1 -type f -exec sha512sum {} + |\
grep -v -E "poi-ooxml-lite|junit|hamcrest" |\
sort -k2 | tee /dev/fd/2 | awk '{print $1}' > expected_hashes
cmp expected_hashes effective_hashes ||\
(echo "JARs are different!" && ls -la /home/runner/work/xlconnect/xlconnect/target/dependency/ &&\
ls -la "$XLC_JAR_PATH" &&\
exit 1)