Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d82f2d0
update rhub.yaml
vikram-rawat Sep 29, 2026
d8e7f72
add a file to check dev
vikram-rawat Sep 29, 2026
74dfbf1
update
vikram-rawat Sep 29, 2026
1d4c7da
update check
vikram-rawat Sep 29, 2026
96a29cb
update yam
vikram-rawat Sep 29, 2026
9770b6c
remove renv from .build and action
vikram-rawat Sep 30, 2026
1e5dd1e
update yaml
vikram-rawat Sep 30, 2026
ab2a401
update .Rprofile
vikram-rawat Sep 30, 2026
90078eb
update renv
vikram-rawat Sep 30, 2026
9067fa4
update
vikram-rawat Sep 30, 2026
9e0a2c1
update all files
vikram-rawat Sep 30, 2026
ba7166d
move to dev
vikram-rawat Sep 30, 2026
c5509f8
update dependencies
vikram-rawat Sep 30, 2026
d3ecd2f
update renv settings
vikram-rawat Sep 30, 2026
ba055a9
update setttings
vikram-rawat Sep 30, 2026
bbd7c66
add snapshot for all packages
vikram-rawat Sep 30, 2026
7de5f5c
update renv.lock
vikram-rawat Sep 30, 2026
48aa29f
update wordlist
vikram-rawat Sep 30, 2026
1b02bcf
update pool packages dependencies
vikram-rawat Sep 30, 2026
c4d9f6e
update .SQL
vikram-rawat Sep 30, 2026
1bd9a01
update rhub to use renv
vikram-rawat Sep 30, 2026
022d68f
update rhub
vikram-rawat Sep 30, 2026
bfca681
keep env to DRY
vikram-rawat Sep 30, 2026
2f42ae4
update
vikram-rawat Sep 30, 2026
22ae44e
update platform numbers
vikram-rawat Sep 30, 2026
0ffc3e6
update logs
vikram-rawat Sep 30, 2026
1768110
update platform
vikram-rawat Sep 30, 2026
19afe40
rhub
vikram-rawat Oct 1, 2026
3eedf54
fixed naming
vikram-rawat Oct 1, 2026
2bc13c7
install renv beforehand
vikram-rawat Oct 1, 2026
25ed878
add a setup renv step
vikram-rawat Oct 1, 2026
259dd38
fix renv
vikram-rawat Oct 1, 2026
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
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
^renv$
^renv\.lock$
^\.Rprofile$
^read\.sql\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
Expand All @@ -10,3 +11,5 @@
^\.git$
^\.github$
^\.DS_Store$

dev/*
6 changes: 6 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
options(repos = c(CRAN = "https://cloud.r-project.org"))

if (Sys.getenv("GITHUB_ACTIONS") == "true") {
options(renv.config.autoloader.enabled = FALSE)
}

source("renv/activate.R")
157 changes: 113 additions & 44 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -1,92 +1,161 @@
# R-hub's generic GitHub Actions workflow file. Its canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"
run-name: >-
${{ github.event.inputs.id || format('Manual run by @{0}', github.triggering_actor) }}:
${{ github.event.inputs.name || github.event.inputs.config }}

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
description: >-
Comma-separated list of R-hub platforms to use.
Full list: summary(rhub::rhub_platforms())
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
description: 'Run name. You can leave this empty.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
description: 'Unique ID. You can leave this empty.'
type: string

env:
RENV_CONFIG_AUTOLOADER_ENABLED: "false"
RENV_AUTOLOADER_ENABLED: "false"

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-r: true

- name: Install dependencies
run: |
install.packages("rhub")
rhub::rhub_setup()
steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup platform info
run: |
rhub::platform_info(job_config = "${{ matrix.config.job_config }}")

- name: Setup dependencies
steps:
- uses: r-hub/actions/checkout@v1
- name: "Setup renv"
run: |
rhub::setup_deps(job_config = "${{ matrix.config.job_config }}")

- name: Run checks
Rscript --no-init-file -e '
install.packages("renv", repos = "https://cloud.r-project.org")
renv::activate()
options(renv.config.auto.snapshot = FALSE)
renv::restore(prompt = FALSE)
'
shell: bash
- name: "Session diagnostics"
run: |
rhub::run_check(job_config = "${{ matrix.config.job_config }}")
Rscript --no-init-file -e '
cat("=== R Version ===\n")
print(R.version)
cat("\n=== Platform ===\n")
print(Sys.info())
cat("\n=== Library Paths ===\n")
print(.libPaths())
cat("\n=== Environment Variables ===\n")
print(Sys.getenv())
cat("\n=== Installed Packages ===\n")
print(as.data.frame(installed.packages()[, c("Package", "Version", "LibPath")]))
cat("\n=== renv Status ===\n")
renv::status()
cat("\n=== renv Diagnostics ===\n")
renv::diagnostics()
'
shell: bash
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
needs: package
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup R
uses: r-lib/actions/setup-r@v2
steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job_config }}
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}

- name: Setup platform info
- name: "Setup renv"
run: |
rhub::platform_info(job_config = "${{ matrix.config.job_config }}")

- name: Setup dependencies
Rscript --no-init-file -e '
install.packages("renv", repos = "https://cloud.r-project.org")
renv::activate()
options(renv.config.auto.snapshot = FALSE)
renv::restore(prompt = FALSE)
'
shell: bash
- name: "Session diagnostics"
run: |
rhub::setup_deps(job_config = "${{ matrix.config.job_config }}")

- name: Run checks
run: |
rhub::run_check(job_config = "${{ matrix.config.job_config }}")
Rscript --no-init-file -e '
cat("=== R Version ===\n")
print(R.version)
cat("\n=== Platform ===\n")
print(Sys.info())
cat("\n=== Library Paths ===\n")
print(.libPaths())
cat("\n=== Environment Variables ===\n")
print(Sys.getenv())
cat("\n=== Installed Packages ===\n")
print(as.data.frame(installed.packages()[, c("Package", "Version", "LibPath")]))
cat("\n=== renv Status ===\n")
renv::status()
cat("\n=== renv Diagnostics ===\n")
renv::diagnostics()
'
shell: bash
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
needs: package
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
6 changes: 6 additions & 0 deletions .renvignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ignore everything
**

# except dev folder
!dev/
!dev/**
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: read.sql
Title: Reads .SQL Files And Execute Them
Title: Reads .SQL Files and Execute Them
Version: 0.4.1
Authors@R:
person(
Expand Down
12 changes: 10 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,13 @@ export(rs_get_sql_query)
export(rs_interpolate)
export(rs_migrate)
export(rs_read_query)
import(DBI)
import(stringi)
importFrom(DBI,
SQL,
dbConnect,
dbWithTransaction,
sqlInterpolate
)
importFrom(stringi,
stri_replace_all_fixed,
stri_sprintf
)
11 changes: 6 additions & 5 deletions R/create_connection.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
#'
#' @return db connection object
#'
#' @import DBI
#' @importFrom DBI dbConnect
#'
#' @export
rs_create_conn <- function(
driver = NULL,
param_list,
pool = FALSE) {
pool = FALSE
) {
if (is.null(param_list$drv)) {
if (missing(driver)) {
stop("Please provide a valid Driver")
Expand All @@ -28,18 +29,18 @@ rs_create_conn <- function(
stop("Please provide a valid Driver")
} else {
param_list$drv <- NULL

param_list <- append(param_list, c(drv = driver))
}
}


if (pool) {
if (!requireNamespace("pool", quietly = TRUE)) {
stop("Package 'pool' is required for pool connections. Install it with: install.packages('pool')")
}
conn <- do.call(pool::dbPool, param_list)
} else {
conn <- do.call(DBI::dbConnect, param_list)
}


return(conn)
}
2 changes: 2 additions & 0 deletions R/migration.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#' and \code{execute} (the result of the execution,
#' typically the number of rows affected).
#'
#' @importFrom DBI dbWithTransaction
#'
#' @export
rs_migrate <- function(
sql_conn,
Expand Down
4 changes: 2 additions & 2 deletions R/read_sql.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ generate_sql_statement <- function(sql_query, param_ls) {
#'
#' @return A character string with all placeholders replaced.
#'
#' @import stringi
#' @importFrom stringi stri_replace_all_fixed stri_sprintf
#'
meta_sql_interpolate <- function(sql_query, meta_query_params) {
# Loop over each item in the query_params list
Expand Down Expand Up @@ -230,7 +230,7 @@ meta_sql_interpolate <- function(sql_query, meta_query_params) {
#'
#' @return A new \code{sql_query} object with the final, transformed SQL statement.
#'
#' @import DBI
#' @importFrom DBI sqlInterpolate SQL
#'
#' @export
rs_interpolate <- function(
Expand Down
13 changes: 13 additions & 0 deletions dev/dependencies.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Section --- renv discovery only ----------------------------------------
# Never run. Exists so renv::snapshot() picks up these packages.

library(cli)
library(stringi)
library(DBI)
library(testthat)
library(RSQLite)
library(pool)
library(cli)
library(withr)
library(devtools)
library(rhub)
28 changes: 28 additions & 0 deletions dev/dev_check.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# step 1
devtools::test()

# step 2
devtools::document()

# step 3
devtools::check(
env_vars = c("_R_CHECK_SYSTEM_CLOCK_" = "0")
)

# step 4
devtools::spell_check()
# spelling::update_wordlist()

# step 5
# rhub::rhub_setup(overwrite = TRUE)
rhub::rhub_doctor()
rhub::rhub_check(platforms = c("linux", "windows")) # 1,5

# step 6
# check windows builder
devtools::build()
# upload the tar file on this website https://win-builder.r-project.org/upload.aspx
# wait for the email

# step 7
devtools::release()
3 changes: 3 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ seperate
seperately
setosa
sql
.SQL
New
submission
stmt
Loading
Loading