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
1 change: 1 addition & 0 deletions .github/workflows/covr/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "Actions to run covr for an R package"
description: "Run covr to check code coverage for an R package and upload results to Codecov."
inputs:
token:
description: codecov token
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ runs:
# echo "_R_CHECK_CRAN_INCOMING_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_CRAN_INCOMING_SKIP_LARGE_VERSION_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_FORCE_SUGGESTS_=false" | tee -a $GITHUB_ENV
shell: bash

- name: Set environment variables (non-macOS only)
if: runner.os != 'macOS'
run: |
echo "_R_CHECK_THINGS_IN_OTHER_DIRS_=true" | tee -a $GITHUB_ENV
shell: bash

Expand Down Expand Up @@ -95,7 +100,7 @@ runs:
- id: get-extra
run: |
set -x
packages=$( ( grep Config/gha/extra-packages DESCRIPTION || true ) | cut -d " " -f 2)
packages=$( ( grep Config/gha/extra-packages DESCRIPTION || true ) | cut -d " " -f 2-)
echo packages=$packages >> $GITHUB_OUTPUT
shell: bash

Expand All @@ -106,7 +111,7 @@ runs:
pak-version: stable
needs: ${{ inputs.needs }}
packages: ${{ inputs.packages }}
extra-packages: ${{ inputs.extra-packages }} ${{ ( matrix.covr && 'covr xml2' ) || '' }} ${{ steps.get-extra.outputs.packages }}
extra-packages: ${{ inputs.extra-packages }} ${{ ( matrix.covr && 'r-lib/covr#611 xml2' ) || '' }} ${{ steps.get-extra.outputs.packages }}
cache-version: ${{ inputs.cache-version }}

- name: Add pkg.lock to .gitignore
Expand Down
70 changes: 15 additions & 55 deletions .github/workflows/style/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,69 +3,29 @@ name: "Action to auto-style a package"
runs:
using: "composite"
steps:
- name: Check styler options
- name: Check air.toml
id: check
run: |
set -x
scope=$( ( grep Config/autostyle/scope DESCRIPTION || true ) | cut -d " " -f 2)
strict=$( ( grep Config/autostyle/strict DESCRIPTION || true ) | cut -d " " -f 2)
rmd=$( ( grep Config/autostyle/rmd DESCRIPTION || true ) | cut -d " " -f 2)
echo scope=$scope >> $GITHUB_OUTPUT
echo strict=$strict >> $GITHUB_OUTPUT
echo rmd=$rmd >> $GITHUB_OUTPUT
if [ -f air.toml ]; then
echo enabled=true >> $GITHUB_OUTPUT
else
echo enabled=false >> $GITHUB_OUTPUT
fi
shell: bash

- uses: actions/cache@v4
if: ${{ steps.check.outputs.scope }}
with:
path: |
~/.cache/R/R.cache
key: ${{ runner.os }}-2-${{ github.run_id }}-
restore-keys: |
${{ runner.os }}-2-
- name: Install air
if: ${{ steps.check.outputs.enabled == 'true' }}
uses: posit-dev/setup-air@v1

- name: Imprint run ID
if: ${{ steps.check.outputs.scope }}
- name: Run air
if: ${{ steps.check.outputs.enabled == 'true' }}
run: |
mkdir -p ~/.cache/R/R.cache/styler
touch ~/.cache/R/R.cache/${{ github.run_id }}
air format .
shell: bash

- name: Show cache
if: ${{ steps.check.outputs.scope }}
- name: Check Git status
if: ${{ steps.check.outputs.enabled == 'true' }}
run: |
ls -l ~/.cache/R/R.cache
ls -l ~/.cache/R/R.cache/styler
shell: bash

- name: Enable styler cache
if: ${{ steps.check.outputs.scope }}
run: |
styler::cache_activate(verbose = TRUE)
shell: Rscript {0}

- name: Run styler
if: ${{ steps.check.outputs.scope }}
run: |
strict <- as.logical("${{ steps.check.outputs.strict }}")
if (is.na(strict)) {
strict <- FALSE
}
rmd <- as.logical("${{ steps.check.outputs.rmd }}")
if (is.na(rmd)) {
rmd <- TRUE
}
styler::style_pkg(
scope = "${{ steps.check.outputs.scope }}",
strict = strict,
filetype = c("R", "Rprofile", if (rmd) c("Rmd", "Rmarkdown", "Rnw", "Qmd"))
)
shell: Rscript {0}

- name: Show cache again
if: ${{ steps.check.outputs.scope }}
run: |
ls -l ~/.cache/R/R.cache
ls -l ~/.cache/R/R.cache/styler
gdu -s --inodes ~/.cache/R/R.cache/styler/* || du -s --inodes ~/.cache/R/R.cache/styler/*
git status
shell: bash
45 changes: 3 additions & 42 deletions tests/testthat/_snaps/fallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
Message
The duckplyr package is configured to fall back to dplyr when it encounters an incompatibility. Fallback events can be collected and uploaded for analysis to guide future development. By default, data will be collected but no data will be uploaded.
x Fallback printing is disabled.
v Fallback logging is enabled.
i Fallback logging is not controlled, see `?duckplyr::fallback()`.
i Logs are written to 'fallback/log/dir'.
x Fallback logging is disabled.
i Automatic fallback uploading is not controlled and therefore disabled, see `?duckplyr::fallback()`.
i No reports ready for upload.
i See `?duckplyr::fallback_config()` for details.

# fallback_sitrep() enabled
Expand All @@ -19,11 +16,8 @@
Message
The duckplyr package is configured to fall back to dplyr when it encounters an incompatibility. Fallback events can be collected and uploaded for analysis to guide future development. By default, data will be collected but no data will be uploaded.
x Fallback printing is disabled.
v Fallback logging is enabled.
i Logs are written to 'fallback/log/dir'.
x Fallback logging is disabled.
v Automatic fallback uploading is enabled.
v Number of reports ready for upload: 3.
> Review with `duckplyr::fallback_review()`, upload with `duckplyr::fallback_upload()`.
i See `?duckplyr::fallback_config()` for details.

# fallback_sitrep() enabled silent
Expand All @@ -33,11 +27,8 @@
Message
The duckplyr package is configured to fall back to dplyr when it encounters an incompatibility. Fallback events can be collected and uploaded for analysis to guide future development. By default, data will be collected but no data will be uploaded.
v Fallback printing is enabled.
v Fallback logging is enabled.
i Logs are written to 'fallback/log/dir'.
x Fallback logging is disabled.
v Automatic fallback uploading is enabled.
v Number of reports ready for upload: 3.
> Review with `duckplyr::fallback_review()`, upload with `duckplyr::fallback_upload()`.
i See `?duckplyr::fallback_config()` for details.

# fallback_sitrep() disabled
Expand All @@ -55,9 +46,6 @@

Code
duckdb_tibble(a = 1, b = 2, c = 3) %>% summarize(.by = a, e = sum(b), f = sum(e))
Message
i dplyr fallback recorded
{"version":"0.3.1","message":"Can't reuse summary variable `...4`.","name":"summarise","x":{"...1":"numeric","...2":"numeric","...3":"numeric"},"args":{"dots":{"...4":"sum(...2)","...5":"sum(...4)"},"by":["...1"]}}
Output
# A duckplyr data frame: 3 variables
a e f
Expand All @@ -69,15 +57,8 @@
Code
duckdb_tibble(a = as.Date("2024-03-08")) %>% mutate(b = lubridate::wday(a,
label = TRUE))
Message
i dplyr fallback recorded
{"version":"0.3.1","message":"wday(label = ) not supported","name":"mutate","x":{"...1":"Date"},"args":{"dots":{"...2":"...3::...4(...1, label = TRUE)"},".by":"NULL",".keep":["all","used","unused","none"]}}
Output
# A duckplyr data frame: 2 variables
Message
i dplyr fallback recorded
{"version":"0.3.1","message":"Can't convert columns of class <ordered/factor> to relational. Affected column: `...2`.","name":"head","x":{"...1":"Date","...2":"ordered/factor"},"args":{"n":21}}
Output
a b
<date> <ord>
1 2024-03-08 Fri
Expand All @@ -86,9 +67,6 @@

Code
duckdb_tibble(a = as.Date("2024-03-08")) %>% mutate(b = lubridate::wday(a))
Message
i dplyr fallback recorded
{"version":"0.3.1","message":"`wday()` with `option(\"lubridate.week.start\")` not supported","name":"mutate","x":{"...1":"Date"},"args":{"dots":{"...2":"...3::...4(...1)"},".by":"NULL",".keep":["all","used","unused","none"]}}
Output
# A duckplyr data frame: 2 variables
a b
Expand All @@ -100,9 +78,6 @@
Code
duckdb_tibble(a = as.Date("2024-03-08")) %>% mutate(b = strftime(a, format = "%Y-%m-%d",
tz = "CET"))
Message
i dplyr fallback recorded
{"version":"0.3.1","message":"strftime(tz = ) not supported","name":"mutate","x":{"...1":"Date"},"args":{"dots":{"...2":"strftime(...1, format = \"<character>\", tz = \"<character>\")"},".by":"NULL",".keep":["all","used","unused","none"]}}
Output
# A duckplyr data frame: 2 variables
a b
Expand All @@ -113,9 +88,6 @@

Code
duckdb_tibble(a = 1, b = 2) %>% mutate(c = .env$x)
Message
i dplyr fallback recorded
{"version":"0.3.1","message":"object not found, should also be triggered by the dplyr fallback","name":"mutate","x":{"...1":"numeric","...2":"numeric"},"args":{"dots":{"...3":"...4$...5"},".by":"NULL",".keep":["all","used","unused","none"]}}
Condition
Error in `mutate()`:
i In argument: `c = .env$x`.
Expand All @@ -126,9 +98,6 @@

Code
duckdb_tibble(a = 1, b = 2) %>% mutate(c = foo(a, b))
Message
i dplyr fallback recorded
{"version":"0.3.1","message":"Can't translate function `foo()`.","name":"mutate","x":{"...1":"numeric","...2":"numeric"},"args":{"dots":{"...3":"foo(...1, ...2)"},".by":"NULL",".keep":["all","used","unused","none"]}}
Output
# A duckplyr data frame: 3 variables
a b c
Expand Down Expand Up @@ -174,9 +143,6 @@

Code
duckdb_tibble(`___row_number` = 1, b = 2:3) %>% arrange(b)
Message
i dplyr fallback recorded
{"version":"0.3.1","message":"Can't use column `...1` already present in rel for order preservation","name":"arrange","x":{"...1":"numeric","...2":"integer"},"args":{"dots":["...2"],".by_group":false}}
Output
# A duckplyr data frame: 2 variables
`___row_number` b
Expand All @@ -188,11 +154,6 @@

Code
duckdb_tibble(a = 1) %>% count(a, .drop = FALSE, name = "n")
Message
i dplyr fallback recorded
{"version":"0.3.1","message":"{.code count()} only implemented for {.arg .drop} = {.value TRUE}","name":"count","x":{"...1":"numeric"},"args":{"dots":{"1":"...1"},"wt":"NULL","sort":false,".drop":false}}
i dplyr fallback recorded
{"version":"0.3.1","message":"Try {.code summarise(.by = ...)} or {.code mutate(.by = ...)} instead of {.code group_by()} and {.code ungroup()}."}
Output
# A duckplyr data frame: 2 variables
a n
Expand Down