Browse Source

appveyor tests

boB Rudis 2 years ago
parent
commit
e54dc2bbcb
No known key found for this signature in database
10 changed files with 111 additions and 16 deletions
  1. 2
    0
      .Rbuildignore
  2. 3
    0
      .travis.yml
  3. 2
    1
      DESCRIPTION
  4. 6
    6
      R/render-json.r
  5. 3
    1
      README.Rmd
  6. 8
    8
      README.md
  7. 84
    0
      appveyor.yml
  8. 1
    0
      codecov.yml
  9. BIN
      img/cap.png
  10. 2
    0
      tests/testthat/test-splash.R

+ 2
- 0
.Rbuildignore View File

@@ -8,3 +8,5 @@
8 8
 ^img$
9 9
 ^CONDUCT\.md$
10 10
 ^README_files$
11
+^appveyor\.yml$
12
+^codecov\.yml$

+ 3
- 0
.travis.yml View File

@@ -25,3 +25,6 @@ r:
25 25
  - oldrel
26 26
  - release
27 27
  - devel
28
+
29
+after_success:
30
+  - Rscript -e 'covr::codecov()'

+ 2
- 1
DESCRIPTION View File

@@ -22,7 +22,8 @@ Suggests:
22 22
     testthat,
23 23
     tibble,
24 24
     jpeg,
25
-    png
25
+    png,
26
+    covr
26 27
 Depends:
27 28
     R (>= 3.2.0)
28 29
 Imports:

+ 6
- 6
R/render-json.r View File

@@ -76,12 +76,12 @@ render_json <- function(splash_obj = splash_local, url, base_url=NULL, quality=7
76 76
   if ("har" %in% names(out)) {
77 77
 
78 78
     sphar <- list(
79
-      log=list(
80
-        version=out$har$log$version,
81
-        creator=out$har$log$creator,
82
-        browser=out$har$log$browser,
83
-        pages=out$har$log$pages,
84
-        entries=out$har$log$entries
79
+      log = list(
80
+        version = out$har$log$version,
81
+        creator = out$har$log$creator,
82
+        browser = out$har$log$browser,
83
+        pages = out$har$log$pages,
84
+        entries = out$har$log$entries
85 85
       )
86 86
     )
87 87
 

+ 3
- 1
README.Rmd View File

@@ -2,12 +2,14 @@
2 2
 output: rmarkdown::github_document
3 3
 ---
4 4
 [![Travis-CI Build Status](https://travis-ci.org/hrbrmstr/splashr.svg?branch=master)](https://travis-ci.org/hrbrmstr/splashr)
5
+[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/hrbrmstr/splashr?branch=master&svg=true)](https://ci.appveyor.com/project/hrbrmstr/splashr)
6
+<!-- [![Coverage Status](https://img.shields.io/codecov/c/github/hrbrmstr/splashr/master.svg)](https://codecov.io/github/hrbrmstr/splashr?branch=master) -->
5 7
 
6 8
 `splashr` : Tools to Work with the 'Splash' JavaScript Rendering Service
7 9
 
8 10
 TL;DR: This package works with Splash rendering servers which are really just a REST API & `lua` scripting interface to a QT browser. It's an alternative to the Selenium ecosystem which was really engineered for application testing & validation. 
9 11
 
10
-Sometimes, all you need is a page scrape after javascript has been allowed to roam wild and free over your meticulously crafted HTML tags. So, this package does not do _everything_ Selenium can, but if you're just trying to get a page back that needs javascript rendering, this is a nice alternative.
12
+Sometimes, all you need is a page scrape after javascript has been allowed to roam wild and free over your meticulously crafted HTML tags. So, this package does not do _everything_ Selenium can in pure R (the Lua interface is equally as powerful and accessible via R), but if you're just trying to get a page back that needs javascript rendering, this is a nice, lightweight, consistent alternative.
11 13
 
12 14
 It's also an alternative to `phantomjs` (which you can use in R within or without a Selenium context as it's it's own webdriver) and it may be useful to compare renderings between this package & `phantomjs`.
13 15
 

+ 8
- 8
README.md View File

@@ -1,11 +1,11 @@
1 1
 
2
-[![Travis-CI Build Status](https://travis-ci.org/hrbrmstr/splashr.svg?branch=master)](https://travis-ci.org/hrbrmstr/splashr)
2
+[![Travis-CI Build Status](https://travis-ci.org/hrbrmstr/splashr.svg?branch=master)](https://travis-ci.org/hrbrmstr/splashr) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/hrbrmstr/splashr?branch=master&svg=true)](https://ci.appveyor.com/project/hrbrmstr/splashr) <!-- [![Coverage Status](https://img.shields.io/codecov/c/github/hrbrmstr/splashr/master.svg)](https://codecov.io/github/hrbrmstr/splashr?branch=master) -->
3 3
 
4 4
 `splashr` : Tools to Work with the 'Splash' JavaScript Rendering Service
5 5
 
6 6
 TL;DR: This package works with Splash rendering servers which are really just a REST API & `lua` scripting interface to a QT browser. It's an alternative to the Selenium ecosystem which was really engineered for application testing & validation.
7 7
 
8
-Sometimes, all you need is a page scrape after javascript has been allowed to roam wild and free over your meticulously crafted HTML tags. So, this package does not do *everything* Selenium can, but if you're just trying to get a page back that needs javascript rendering, this is a nice alternative.
8
+Sometimes, all you need is a page scrape after javascript has been allowed to roam wild and free over your meticulously crafted HTML tags. So, this package does not do *everything* Selenium can in pure R (the Lua interface is equally as powerful and accessible via R), but if you're just trying to get a page back that needs javascript rendering, this is a nice, lightweight, consistent alternative.
9 9
 
10 10
 It's also an alternative to `phantomjs` (which you can use in R within or without a Selenium context as it's it's own webdriver) and it may be useful to compare renderings between this package & `phantomjs`.
11 11
 
@@ -153,13 +153,13 @@ splash_debug()
153 153
     ## List of 7
154 154
     ##  $ active  : list()
155 155
     ##  $ argcache: int 0
156
-    ##  $ fds     : int 19
156
+    ##  $ fds     : int 14
157 157
     ##  $ leaks   :List of 4
158 158
     ##   ..$ Deferred  : int 50
159 159
     ##   ..$ LuaRuntime: int 1
160 160
     ##   ..$ QTimer    : int 1
161 161
     ##   ..$ Request   : int 1
162
-    ##  $ maxrss  : int 197264
162
+    ##  $ maxrss  : int 75912
163 163
     ##  $ qsize   : int 0
164 164
     ##  $ url     : chr "http://localhost:8050"
165 165
     ##  - attr(*, "class")= chr [1:2] "splash_debug" "list"
@@ -204,15 +204,15 @@ print(har)
204 204
     ## --------HAR PAGES-------- 
205 205
     ## Page id: 1 , Page title: Poynter – A global leader in journalism. Strengthening democracy. 
206 206
     ## --------HAR ENTRIES-------- 
207
-    ## Number of entries: 29 
207
+    ## Number of entries: 42 
208 208
     ## REQUESTS: 
209 209
     ## Page: 1 
210
-    ## Number of entries: 29 
210
+    ## Number of entries: 42 
211 211
     ##   -  http://www.poynter.org/ 
212
+    ##   -  http://www.poynter.org/wp-content/plugins/easy-author-image/css/easy-author-image.css?ver=2016_06_24.1 
212 213
     ##   -  http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css?ver=2016_06_24.1 
213 214
     ##   -  http://cloud.webtype.com/css/162ac332-3b31-4b73-ad44-da375b7f2fe3.css?ver=2016_06_24.1 
214 215
     ##   -  http://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css?ver=2016_06_24.1 
215
-    ##   -  http://www.poynter.org/wp-content/themes/poynter_timber/assets/scrollbar/jquery.mCustomScrollbar.min.css?ver=2016... 
216 216
     ##      ........ 
217 217
     ##   -  http://cloud.webtype.com/webtype/ff2/3/4ac7f809-9bdf-4acc-8bd5-a922f05f271b?ec_token=8f7c4c4997246fd7fa920171c994... 
218 218
     ##   -  http://cloud.webtype.com/webtype/ff2/3/c6608520-1978-45ac-9061-74ada664cae4?ec_token=8f7c4c4997246fd7fa920171c994... 
@@ -286,7 +286,7 @@ library(testthat)
286 286
 date()
287 287
 ```
288 288
 
289
-    ## [1] "Sun Aug 27 07:51:03 2017"
289
+    ## [1] "Sun Aug 27 08:16:01 2017"
290 290
 
291 291
 ``` r
292 292
 test_dir("tests/")

+ 84
- 0
appveyor.yml View File

@@ -0,0 +1,84 @@
1
+# DO NOT CHANGE the "init" and "install" sections below
2
+
3
+image: Visual Studio 2017
4
+
5
+environment:
6
+  NOT_CRAN: true
7
+  USE_RTOOLS: true
8
+  matrix:
9
+    - PYTHON: "C:\\Python27"
10
+      RETICULATE_PYTHON: "C:\\Python27"
11
+    - PYTHON: "C:\\Python34"
12
+      RETICULATE_PYTHON: "C:\\Python34"
13
+    - PYTHON: "C:\\Python35"
14
+      RETICULATE_PYTHON: "C:\\Python35"
15
+    - PYTHON: "C:\\Python36"
16
+      RETICULATE_PYTHON: "C:\\Python36"
17
+
18
+matrix:
19
+  fast_finish: true
20
+
21
+# Download script file from GitHub
22
+init:
23
+  ps: |
24
+        $ErrorActionPreference = "Stop"
25
+        Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1"
26
+        Import-Module '..\appveyor-tool.ps1'
27
+
28
+install:
29
+  ps: Bootstrap
30
+
31
+cache:
32
+  - C:\RLibrary
33
+
34
+# Adapt as necessary starting from here
35
+
36
+build_script:
37
+  - docker pull microsoft/nanoserver
38
+  - docker pull scrapinghub/splash:3.0
39
+  - "%PYTHON%\\python.exe -m pip install setuptools numpy pypiwin32 docker"
40
+  - travis-tool.sh install_github rstudio/reticulate
41
+  - travis-tool.sh install_deps
42
+
43
+before_test:
44
+  - echo %RETICULATE_PYTHON%
45
+  - echo %PATH%
46
+  - R -q -e "reticulate::py_discover_config('docker')"
47
+  - docker run -p 5023:5023 -p 8050:8050 -p 8051:8051 -d scrapinghub/splash:3.0
48
+  - docker ps -a
49
+
50
+test_script:
51
+  - travis-tool.sh run_tests
52
+
53
+on_failure:
54
+  - 7z a failure.zip *.Rcheck\*
55
+  - appveyor PushArtifact failure.zip
56
+
57
+artifacts:
58
+  - path: '*.Rcheck\**\*.log'
59
+    name: Logs
60
+
61
+  - path: '*.Rcheck\**\*.out'
62
+    name: Logs
63
+
64
+  - path: '*.Rcheck\**\*.fail'
65
+    name: Logs
66
+
67
+  - path: '*.Rcheck\**\*.Rout'
68
+    name: Logs
69
+
70
+  - path: '\*_*.tar.gz'
71
+    name: Bits
72
+
73
+  - path: '\*_*.zip'
74
+    name: Bits
75
+
76
+notifications:
77
+  - provider: Email
78
+    to:
79
+      - bob@rud.is
80
+    subject: 'r-appveyor build {{status}}'
81
+    message: "https://ci.appveyor.com/project/hrbrmstr/splashr"
82
+    on_build_success: false
83
+    on_build_failure: true
84
+    on_build_status_changed: true

+ 1
- 0
codecov.yml View File

@@ -0,0 +1 @@
1
+comment: false

BIN
img/cap.png View File


+ 2
- 0
tests/testthat/test-splash.R View File

@@ -1,6 +1,8 @@
1 1
 context("basic functionality")
2 2
 test_that("we can do something", {
3 3
 
4
+  testthat::skip_on_cran()
5
+
4 6
   test_url <- "http://localhost:8050/"
5 7
 
6 8
   xpct <- function(x) {

Loading…
Cancel
Save