Skip to content

Commit 316b662

Browse files
authored
Add R build test to CircleCI (#1238)
1 parent cfebe38 commit 316b662

File tree

4 files changed

+114
-9
lines changed

4 files changed

+114
-9
lines changed

.circleci/config.yml

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
docker:
3030
- image: circleci/python:3.7-stretch-node-browsers
3131
environment:
32+
PYLINTRC: .pylintrc37
3233
PYVERSION: python37
3334

3435
steps:
@@ -81,7 +82,6 @@ jobs:
8182
docker:
8283
- image: circleci/python:3.7-stretch-node-browsers
8384
environment:
84-
PYLINTRC: .pylintrc37
8585
PYVERSION: python37
8686
steps:
8787
- checkout
@@ -213,6 +213,113 @@ jobs:
213213
paths:
214214
- packages/*.tar.gz
215215

216+
build-dashr:
217+
working_directory: ~/dashr
218+
docker:
219+
- image: plotly/dashr:ci
220+
environment:
221+
PERCY_PARALLEL_TOTAL: -1
222+
PYVERSION: python37
223+
_R_CHECK_FORCE_SUGGESTS_: FALSE
224+
225+
steps:
226+
- checkout
227+
228+
- run:
229+
name: ️️🏭 clone and npm build core for R
230+
command: |
231+
python -m venv venv
232+
. venv/bin/activate
233+
git clone --depth 1 https://github.com/plotly/dash.git -b ${CIRCLE_BRANCH} dash-main
234+
cd dash-main && pip install -e .[dev,testing] --progress-bar off && cd ..
235+
git clone --depth 1 https://github.com/plotly/dashR.git -b dev dashR
236+
git clone --depth 1 https://github.com/plotly/dash-html-components.git
237+
git clone --depth 1 https://github.com/plotly/dash-core-components.git
238+
git clone --depth 1 https://github.com/plotly/dash-table.git
239+
shopt -s extglob
240+
cd dash-html-components; npm ci && npm run build; rm -rf !(.|..|DESCRIPTION|LICENSE.txt|LICENSE|NAMESPACE|.Rbuildignore|R|man|inst|vignettes|build)
241+
cd ../dash-core-components; npm ci && npm run build; rm -rf !(.|..|DESCRIPTION|LICENSE.txt|LICENSE|NAMESPACE|.Rbuildignore|R|man|inst|vignettes|build)
242+
cd ../dash-table; npm ci && npm run build; rm -rf !(.|..|DESCRIPTION|LICENSE.txt|LICENSE|NAMESPACE|.Rbuildignore|R|man|inst|vignettes|build); cd ..
243+
244+
- run:
245+
name: 🔧fix up dash metadata
246+
command: |
247+
sudo Rscript -e 'dash_desc <- read.dcf("dashR/DESCRIPTION"); dt_version <- read.dcf("dash-table/DESCRIPTION")[,"Version"]; dcc_version <- read.dcf("dash-core-components/DESCRIPTION")[,"Version"]; dhc_version <- read.dcf("dash-html-components/DESCRIPTION")[,"Version"]; imports <- dash_desc[,"Imports"][[1]]; imports <- gsub("((?<=dashHtmlComponents )(\\\\(.*?\\\\)))", paste0("(= ", dhc_version, ")"), imports, perl = TRUE); imports <- gsub("((?<=dashCoreComponents )(\\\\(.*?\\\\)))", paste0("(= ", dcc_version, ")"), imports, perl = TRUE); imports <- gsub("((?<=dashTable )(\\\\(.*?\\\\)))", paste0("(= ", dt_version, ")"), imports, perl = TRUE); dash_desc[,"Imports"][[1]] <- imports; dhc_hash <- system("cd dash-html-components; git rev-parse HEAD | tr -d '\''\n'\''", intern=TRUE); dcc_hash <- system("cd dash-core-components; git rev-parse HEAD | tr -d '\''\n'\''", intern=TRUE); dt_hash <- system("cd dash-table; git rev-parse HEAD | tr -d '\''\n'\''", intern=TRUE); remotes <- dash_desc[,"Remotes"][[1]]; remotes <- gsub("((?<=plotly\\\\/dash-html-components@)([a-zA-Z0-9]+))", dhc_hash, remotes, perl=TRUE); remotes <- gsub("((?<=plotly\\\\/dash-core-components@)([a-zA-Z0-9]+))", dcc_hash, remotes, perl=TRUE); remotes <- gsub("((?<=plotly\\\\/dash-table@)([a-zA-Z0-9]+))", dt_hash, remotes, perl=TRUE); dash_desc[,"Remotes"][[1]] <- remotes; write.dcf(dash_desc, "dashR/DESCRIPTION")'
248+
249+
- run:
250+
name: 🎛 set environment variables
251+
command: |
252+
Rscript --vanilla \
253+
-e 'dash_dsc <- read.dcf("dashR/DESCRIPTION")' \
254+
-e 'cat(sprintf("export DASH_TARBALL=%s_%s.tar.gz\n", dash_dsc[,"Package"], dash_dsc[,"Version"]))' \
255+
-e 'cat(sprintf("export DASH_CHECK_DIR=%s.Rcheck\n", dash_dsc[,"Package"]))' \
256+
-e 'dhc_dsc <- read.dcf("dash-html-components/DESCRIPTION")' \
257+
-e 'cat(sprintf("export DHC_TARBALL=%s_%s.tar.gz\n", dhc_dsc[,"Package"], dhc_dsc[,"Version"]))' \
258+
-e 'cat(sprintf("export DHC_CHECK_DIR=%s.Rcheck\n", dhc_dsc[,"Package"]))' \
259+
-e 'dcc_dsc <- read.dcf("dash-core-components/DESCRIPTION")' \
260+
-e 'cat(sprintf("export DCC_TARBALL=%s_%s.tar.gz\n", dcc_dsc[,"Package"], dcc_dsc[,"Version"]))' \
261+
-e 'cat(sprintf("export DCC_CHECK_DIR=%s.Rcheck\n", dcc_dsc[,"Package"]))' \
262+
-e 'dt_dsc <- read.dcf("dash-table/DESCRIPTION")' \
263+
-e 'cat(sprintf("export DT_TARBALL=%s_%s.tar.gz\n", dt_dsc[,"Package"], dt_dsc[,"Version"]))' \
264+
-e 'cat(sprintf("export DT_CHECK_DIR=%s.Rcheck\n", dt_dsc[,"Package"]))' \
265+
>> ${BASH_ENV}
266+
267+
- run:
268+
name: ️️📋 run CRAN package checks
269+
command: |
270+
R CMD build dash-core-components
271+
R CMD build dash-html-components
272+
R CMD build dash-table
273+
R CMD build dashR
274+
sudo R CMD INSTALL dash-core-components
275+
sudo R CMD INSTALL dash-html-components
276+
sudo R CMD INSTALL dash-table
277+
sudo R CMD INSTALL dashR
278+
R CMD check "${DHC_TARBALL}" --as-cran --no-manual
279+
R CMD check "${DCC_TARBALL}" --as-cran --no-manual
280+
R CMD check "${DT_TARBALL}" --as-cran --no-manual
281+
R CMD check "${DASH_TARBALL}" --as-cran --no-manual
282+
283+
- run:
284+
name: 🕵 detect failures
285+
command: |
286+
Rscript -e "message(devtools::check_failures(path = '${DHC_CHECK_DIR}'))"
287+
Rscript -e "message(devtools::check_failures(path = '${DCC_CHECK_DIR}'))"
288+
Rscript -e "message(devtools::check_failures(path = '${DT_CHECK_DIR}'))"
289+
Rscript -e "message(devtools::check_failures(path = '${DASH_CHECK_DIR}'))"
290+
# warnings are errors; enable for stricter checks once CRAN submission finished
291+
# if grep -q -R "WARNING" "${DHC_CHECK_DIR}/00check.log"; then exit 1; fi
292+
# if grep -q -R "WARNING" "${DCC_CHECK_DIR}/00check.log"; then exit 1; fi
293+
# if grep -q -R "WARNING" "${DT_CHECK_DIR}/00check.log"; then exit 1; fi
294+
# if grep -q -R "WARNING" "${DASH_CHECK_DIR}/00check.log"; then exit 1; fi
295+
296+
- run:
297+
name: 🔎 run unit tests
298+
command: |
299+
sudo Rscript -e 'res=devtools::test("dashR/tests/", reporter=default_reporter());df=as.data.frame(res);if(sum(df$failed) > 0 || any(df$error)) {q(status=1)}'
300+
301+
- run:
302+
name: ⚙️ Integration tests
303+
command: |
304+
python -m venv venv
305+
. venv/bin/activate
306+
cd dash-main/\@plotly/dash-generator-test-component-nested && npm ci && npm run build && sudo R CMD INSTALL . && cd ../../..
307+
cd dash-main/\@plotly/dash-generator-test-component-standard && npm ci && npm run build && sudo R CMD INSTALL . && cd ../../..
308+
export PATH=$PATH:/home/circleci/.local/bin/
309+
pytest --nopercyfinalize --junitxml=test-reports/dashr.xml dashR/tests/integration/dopsa/
310+
- store_artifacts:
311+
path: test-reports
312+
- store_test_results:
313+
path: test-reports
314+
- store_artifacts:
315+
path: /tmp/dash_artifacts
316+
317+
- run:
318+
name: 🦔 percy finalize
319+
command: npx percy finalize --all
320+
when: on_fail
321+
322+
216323
test-37: &test
217324
working_directory: ~/dash
218325
docker:
@@ -279,12 +386,14 @@ workflows:
279386
- build-core-37
280387
- build-windows-37
281388
- build-misc-37
389+
- build-dashr
282390
- test-37:
283391
requires:
284392
- build-core-37
285393
- build-misc-37
286394
- percy-finalize:
287395
requires:
396+
- build-dashr
288397
- test-37
289398
- artifacts:
290399
requires:

.pylintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ ignore-docstrings=yes
270270
ignore-imports=no
271271

272272
# Minimum lines number of a similarity.
273-
min-similarity-lines=10
273+
min-similarity-lines=20
274274

275275

276276
[SPELLING]
@@ -466,4 +466,4 @@ known-third-party=enchant
466466

467467
# Exceptions that will emit a warning when being caught. Defaults to
468468
# "Exception"
469-
overgeneral-exceptions=Exception
469+
overgeneral-exceptions=Exception

.pylintrc37

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,7 @@ ignore-docstrings=yes
365365
ignore-imports=no
366366

367367
# Minimum lines number of a similarity.
368-
min-similarity-lines=10
369-
368+
min-similarity-lines=20
370369

371370
[SPELLING]
372371

@@ -565,4 +564,4 @@ known-third-party=enchant
565564

566565
# Exceptions that will emit a warning when being caught. Defaults to
567566
# "Exception".
568-
overgeneral-exceptions=Exception
567+
overgeneral-exceptions=Exception

dash/development/_r_components_generation.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,6 @@ def generate_class_string(name, props, project_shortname, prefix):
221221

222222
default_argtext += ", ".join("{}=NULL".format(p) for p in prop_keys)
223223

224-
if wildcards == ", ...":
225-
default_argtext += ", ..."
226-
227224
# pylint: disable=C0301
228225
default_paramtext += ", ".join(
229226
"{0}={0}".format(p) if p != "children" else "{}=children".format(p)

0 commit comments

Comments
 (0)