Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .github/workflows/R-CMD-check-HTML5.yaml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/integration-tests-daily.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
on:
schedule:
# every morning at 8am UTC
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onschedule
- cron: '0 8 * * *'
push:
branches:
- ci-tweaks

name: integration-tests-daily

jobs:
integration-tests:
runs-on: ubuntu-20.04
env:
RSC_VERSION: 2022.09.0
RSC_REPO_SUFFIX: -preview
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RSC_LICENSE: ${{ secrets.RSC_LICENSE }}
CONNECTAPI_INTEGRATED: true

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck, local::.
needs: check

- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Setup test environment
run: |
connectapi:::build_test_env(rsc_version="daily")
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v2

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check

- name: Notify Slack on Failure
if: ${{ failure() && (startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main')) }}
uses: 8398a7/action-slack@v3
with:
author_name: 'GitHub Actions'
status: failure
fields: action,commit,repo,job,took
icon_emoji: ':sad_parrot:'
text: 'Build on ${{ github.ref }} failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_CONNECTAPI }}
GITHUB_TOKEN: ${{ github.token }}
7 changes: 4 additions & 3 deletions R/content.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Content <- R6::R6Class(
id = NA_character_,
content_guid = guid,
# TODO: what if groups can own content?
principal_guid = self$get_content()$owner,
principal_guid = self$get_content()$owner_guid,
principal_type = "user",
role = "owner"
)
Expand Down Expand Up @@ -780,7 +780,8 @@ content_add_group <- function(content, guid, role = c("viewer", "owner")) {

.content_add_permission_impl <- function(content, type, guid, role) {
existing <- .get_permission(content, type, guid)
if (length(existing) > 0) {
message(existing)
if (length(existing) > 0 && !is.null(existing[[1]][["id"]]) && !is.na(existing[[1]][["id"]])) {
message(glue::glue("Updating permission for {type} '{guid}' with role '{role}'"))
res <- content$permissions_update(
id = existing[[1]]$id,
Expand Down Expand Up @@ -830,7 +831,7 @@ content_delete_group <- function(content, guid) {

.get_permission <- function(content, type, guid, add_owner = TRUE) {
res <- content$permissions(add_owner = add_owner)
purrr::keep(res, ~ .x$principal_type == type && .x$principal_guid == guid)
purrr::keep(res, ~.x$principal_type == type && .x$principal_guid == guid)
}

#' @rdname permissions
Expand Down
23 changes: 23 additions & 0 deletions R/utils-ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@
# TODO: A nicer way to execute these system commands...
# - debug output... better error handling... etc.

toggle_integrated <- function(to=NULL) {
env_var <- "CONNECTAPI_INTEGRATED"
curr_val <- FALSE
if (is.null(to)) {
env_val <- Sys.getenv(env_var)
if (tolower(env_val) == "true") {
curr_val <- TRUE
} else {
curr_val <- FALSE
}
} else {
curr_val <- !to
}

if (curr_val) {
do.call(Sys.setenv, as.list(rlang::set_names("false", env_var)))
} else {
do.call(Sys.setenv, as.list(rlang::set_names("true", env_var)))
}
return(!curr_val)
}

# set up test servers...
find_compose <- function() {
wh <- processx::process$new("which", "docker-compose", stdout = "|", stderr = "|")
Expand Down Expand Up @@ -78,6 +100,7 @@ compose_start <- function(connect_license = Sys.getenv("RSC_LICENSE"), rsc_versi
args <- c("-f", compose_file_path, "up", "-d")
env_vars <- c(
RSC_VERSION = rsc_version,
RSC_REPO_SUFFIX = Sys.getenv("RSC_REPO_SUFFIX"),
PATH = Sys.getenv("PATH"),
license_details$env_params
)
Expand Down
4 changes: 3 additions & 1 deletion inst/ci/test-connect-lic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ services:

connect:
hostname: connect
image: ghcr.io/rstudio/rstudio-connect:bionic-${RSC_VERSION}
image: ghcr.io/rstudio/rstudio-connect${RSC_REPO_SUFFIX}:bionic-${RSC_VERSION}
scale: 2
ports:
- 3939
privileged: true
environment:
- RSC_HASTE_ENABLED=true
volumes:
- "${RSC_LICENSE_FILE}:/etc/rstudio-connect/rstudio-connect.lic"
platform: linux/amd64
2 changes: 1 addition & 1 deletion inst/ci/test-connect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:

connect:
hostname: connect
image: ghcr.io/rstudio/rstudio-connect:bionic-${RSC_VERSION}
image: ghcr.io/rstudio/rstudio-connect${RSC_REPO_SUFFIX}:bionic-${RSC_VERSION}
scale: 2
ports:
- 3939
Expand Down