Skip to content

Commit

Permalink
Merge branch 'master' into 134-animint2pages-default-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
tdhock authored Aug 30, 2024
2 parents a3516e6 + 994006d commit f98f9d9
Show file tree
Hide file tree
Showing 26 changed files with 1,231 additions and 1,254 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
test-suite: [ renderer1,renderer2,renderer3,compiler,CRAN]
test-suite: [ renderer, compiler, CRAN ]

name: Test Suite ${{ matrix.test-suite }}
env:
Expand All @@ -21,17 +21,12 @@ jobs:
GH_ACTION: "ENABLED"
steps:
- uses: actions/checkout@v3
- name: Start Selenium Docker
run: docker run -d --network="host" selenium/standalone-firefox-debug:2.53.0
- name: install and update texlive
run: /usr/bin/sudo DEBIAN_FRONTEND=noninteractive apt update -y -qq
- run: /usr/bin/sudo DEBIAN_FRONTEND=noninteractive apt install texlive texlive-fonts-extra -y
- run: /usr/bin/sudo DEBIAN_FRONTEND=noninteractive apt install tidy texlive texlive-fonts-extra -y
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: digest, RJSONIO, gtable, plyr, reshape2, scales, knitr



- name: install package
run: R CMD INSTALL .

Expand Down
22 changes: 11 additions & 11 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: animint2
Title: Animated Interactive Grammar of Graphics
Version: 2024.3.12
Version: 2024.8.29
URL: https://animint.github.io/animint2/
BugReports: https://github.com/animint/animint2/issues
Authors@R: c(
Expand Down Expand Up @@ -50,12 +50,12 @@ Authors@R: c(
person("Yufan", "Fei",
role="aut",
comment="Animint2 GSoC 2022"),
person("Jocelyne", "Chen",
role="aut",
comment="Animint2 GSoC 2023"),
person("Siddhesh", "Deodhar",
role="aut",
comment="Animint2 GSoC 2024"))
person("Jocelyne", "Chen",
role="aut",
comment="Animint2 GSoC 2023"),
person("Siddhesh", "Deodhar",
role="aut",
comment="Animint2 GSoC 2024"))
Description: Functions are provided for defining animated,
interactive data visualizations in R code, and rendering
on a web page. The 2018 Journal of Computational and
Expand Down Expand Up @@ -87,7 +87,7 @@ Suggests:
htmltools,
rmarkdown,
testthat,
RSelenium, XML,
XML,
devtools,
httr,
maps,
Expand All @@ -100,8 +100,8 @@ Suggests:
nlme,
rpart,
svglite,
ggplot2
Remotes: ropensci/[email protected]
ggplot2,
chromote
License: GPL-3
Encoding: UTF-8
LazyData: true
Expand Down Expand Up @@ -280,6 +280,6 @@ Collate:
'z_scales.R'
'z_theme_animint.R'
'z_transformShape.R'
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Config/Needs/website: tidyverse/tidytemplate
VignetteBuilder: knitr
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,13 @@ import(plyr)
import(scales)
importFrom(grDevices,col2rgb)
importFrom(grDevices,rgb)
importFrom(grid,arrow)
importFrom(grid,unit)
importFrom(knitr,knit_print)
importFrom(methods,is)
importFrom(plyr,as.quoted)
importFrom(plyr,defaults)
importFrom(scales,alpha)
importFrom(stats,na.omit)
importFrom(stats,setNames)
importFrom(utils,browseURL)
Expand Down
17 changes: 15 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
# Changes in version 2024.8.29 (PR#147)

- animint2pages initial commit README.md uses viz title.
- animint2pages gains owner argument, with default taken from `gh::gh_whoami` (same as before, always returns user, even when token has permissions on an org); this allows user to specify an org where the user/token has write permissions. This is used in a new test-compiler-ghpages.R, which now assumes `PAT_GITHUB` has Administration and Contents permissions for all repos in `animint-test` org, so our test code can delete the `animint2pages_test_repo`, create a new one, and then use animint2pages twice, to test the results of creation/update.

# Changes in version 2024.8.27 (PR#144)

- Remove selenium, combine renderer tests into single CI job.

# Changes in version 2024.6.6 (PR#126)

- Add chromote as headless browser for testing and remove phantomjs/firefox support

# Changes in version 2024.3.12 (PR#119)

- Add validation checks for duplicate args passed geom and aes
- Add validation checks for duplicate args passed geom and aes

# Changes in version 2024.2.4 (PR#116)

- Add validation checks for duplicate and missing args passed to animint.
- Add validation checks for duplicate and missing args passed to animint.

# Changes in version 2024.1.24 (PR#112)

Expand Down
2 changes: 1 addition & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
#' Housing sales in TX.
#'
#' Information about the housing market in Texas provided by the TAMU
#' real estate center, \url{https://www.recenter.tamu.edu/}.
#' real estate center.
#'
#' @format A data frame with 8602 observations and 9 variables:
#' \describe{
Expand Down
3 changes: 0 additions & 3 deletions R/stat-unique.r
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#' Remove duplicates.
#'
#' @section Aesthetics:
#' \Sexpr[results=rd,stage=build]{animint2:::rd_aesthetics("stat", "unique")}
#'
#' @export
#' @inheritParams layer
#' @inheritParams geom_point
Expand Down
2 changes: 0 additions & 2 deletions R/z_facets.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Determine titles to put on facet panels.
# The implementation here is a modified version of facet_strips.
getStrips <- function(facet, panel, ...)
Expand Down Expand Up @@ -36,7 +35,6 @@ build_strip <- function(panel, label_df, labeller, side = "right", ...) {
labels <- matrix(list(), nrow = nrow(label_df), ncol = ncol(label_df))
labels <- lapply(labeller(label_df), cbind)
labels <- do.call("cbind", labels)

# unlike ggplot2, we collapse "layers" of strips into 1 layer
apply(labels, 1, paste, collapse = "; ")
}
Expand Down
19 changes: 12 additions & 7 deletions R/z_pages.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#' @param plot.list A named list of ggplots and option lists.
#' @param github_repo The name of the GitHub repository to which the
#' files will be pushed.
#' @param owner The user/org under which the repo will be created, default comes from \code{gh::gh_whoami}.
#' @param commit_message A string specifying the commit message for
#' the pushed files.
#' @param private A logical flag indicating whether the GitHub
Expand Down Expand Up @@ -35,7 +36,7 @@
#' }
#'
#' @export
animint2pages <- function(plot.list, github_repo, commit_message = "Commit from animint2pages", private = FALSE, required_opts = c("title","source"), ...) {
animint2pages <- function(plot.list, github_repo, owner=NULL, commit_message = "Commit from animint2pages", private = FALSE, required_opts = c("title","source"), ...) {
for(opt in required_opts){
if(!opt %in% names(plot.list)){
stop(sprintf("plot.list does not contain option named %s, which is required by animint2pages", opt))
Expand All @@ -61,8 +62,10 @@ animint2pages <- function(plot.list, github_repo, commit_message = "Commit from
stop("The github_repo argument should not contain '/'.")
}
# Check for existing repository
whoami <- suppressMessages(gh::gh_whoami())
owner <- whoami[["login"]]
if(is.null(owner)){
whoami <- suppressMessages(gh::gh_whoami())
owner <- whoami[["login"]]
}
viz_owner_repo <- paste0(owner, "/", github_repo)
local_clone <- tempfile()
if (!check_no_github_repo(owner, github_repo)) {
Expand All @@ -86,18 +89,20 @@ animint2pages <- function(plot.list, github_repo, commit_message = "Commit from
silent = TRUE
)
if (!has_commits) {
initial_commit(local_clone, repo, viz_url)
title <- plot.list[["title"]]
if(!is.character(title))title <- "New animint visualization"
initial_commit(local_clone, repo, viz_url, title)
}
# Handle gh-pages branch
manage_gh_pages(repo, owner, to_post, local_clone, commit_message)
message(sprintf(
"Visualization will be available at %s\nDeployment via GitHub Pages may take a few minutes...", viz_url))
viz_owner_repo
list(owner_repo=viz_owner_repo, local_clone=local_clone, viz_url=viz_url, gh_pages_url=sprintf("https://github.com/%s/tree/gh-pages", viz_owner_repo))
}

initial_commit <- function(local_clone, repo, viz_url) {
initial_commit <- function(local_clone, repo, viz_url, title) {
readme_file_path <- file.path(local_clone, "README.md")
header <- "## New animint visualization\n"
header <- sprintf("## %s\n", title)
url_hyperlink <- sprintf("[%s](%s)\n", viz_url, viz_url)
full_content <- paste0(header, url_hyperlink)
writeLines(full_content, readme_file_path)
Expand Down
3 changes: 3 additions & 0 deletions man/animint2pages.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/position_dodge.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/position_identity.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/position_nudge.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/position_stack.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions man/stat_unique.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/txhousing.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 4 additions & 38 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -1,51 +1,17 @@
library("testthat")
library("animint2")
library("RSelenium");library("XML")
library("XML")
setwd("testthat")
source("helper-functions.R")
source("helper-HTML.R")
source("helper-plot-data.r")

## RSelenium does not work with all versions of firefox, TDH usually
## tests using one of the following.

## thocking@silene:~/R/animint-mine(fix-common-chunk)$ firefox --version
## Mozilla Firefox 11.0
## thocking@silene:~/R/animint(animation-fix)$ java -jar ~/lib/R/library/RSelenium/bin/selenium-server-standalone.jar --version
## 10:10:58.942 INFO - Launching a standalone server
## 10:10:58.973 INFO - Java: Sun Microsystems Inc. 23.25-b01
## 10:10:58.973 INFO - OS: Linux 3.8.0-44-generic amd64
## 10:10:58.987 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
## > packageVersion("RSelenium")
## [1] ‘1.3.6’

## > packageVersion("RSelenium")
## [1] ‘1.3.5’
## tdhock@recycled:~/R/animint(roc-bugfix)$ firefox --version
## Mozilla Firefox 41.0
## tdhock@recycled:~/R/animint(roc-bugfix*)$ java -jar ~/lib/R/library/RSelenium/bin/selenium-server-standalone.jar --version
## 08:13:17.803 INFO - Launching a standalone Selenium Server
## 08:13:17.877 INFO - Java: Oracle Corporation 24.79-b02
## 08:13:17.877 INFO - OS: Linux 3.13.0-65-generic i386
## 08:13:17.907 INFO - v2.47.0, with Core v2.47.0. Built from revision 0e4837e

filter <- Sys.getenv("TEST_SUITE")
# If we're running in github actions then use Firefox, since we can
# use the Selenium docker image instead of relying on PhantomJS.
gh.action <- Sys.getenv("GH_ACTION")
dont.need.browser <- grepl("compiler", filter)
use.browser <- !dont.need.browser
use.browser <- grepl("renderer", filter)
if(filter == ""){
filter <- NULL
}
message(gh.action)
if(FALSE){
tests_init("chrome")
}else if(interactive() | (gh.action == "ENABLED")) {
tests_init("firefox")
} else {
tests_init()
}

if(use.browser)tests_init()
tests_run(filter=filter)
tests_exit()
if(use.browser)tests_exit()
Loading

0 comments on commit f98f9d9

Please sign in to comment.