Skip to content

Commit 11e5e4f

Browse files
authored
Progress towards C API conformance (#280)
* Use `R_newEnv()` if available * Avoid using `Rf_findVarInFrame3()` and `R_UnboundValue` * Update snapshots and Rbuildignore * Update URLs * Update NEWS and cran-comments * Update github actions * Move protection in clause
1 parent 21093d0 commit 11e5e4f

File tree

13 files changed

+91
-44
lines changed

13 files changed

+91
-44
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@
1616
^revdep$
1717
^CRAN-RELEASE$
1818
^CRAN-SUBMISSION$
19+
^compile_commands.json$
20+
^.cache$

.github/workflows/R-CMD-check.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ on:
88
push:
99
branches: [main, master]
1010
pull_request:
11-
branches: [main, master]
1211

13-
name: R-CMD-check
12+
name: R-CMD-check.yaml
13+
14+
permissions: read-all
1415

1516
jobs:
1617
R-CMD-check:
@@ -25,24 +26,22 @@ jobs:
2526
- {os: macos-latest, r: 'release'}
2627

2728
- {os: windows-latest, r: 'release'}
28-
# Use 3.6 to trigger usage of RTools35
29-
- {os: windows-latest, r: '3.6'}
30-
# use 4.1 to check with rtools40's older compiler
31-
- {os: windows-latest, r: '4.1'}
32-
33-
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
34-
- {os: ubuntu-latest, r: 'release'}
35-
- {os: ubuntu-latest, r: 'oldrel-1'}
36-
- {os: ubuntu-latest, r: 'oldrel-2'}
37-
- {os: ubuntu-latest, r: 'oldrel-3'}
38-
- {os: ubuntu-latest, r: 'oldrel-4'}
29+
# use 4.0 or 4.1 to check with rtools40's older compiler
30+
- {os: windows-latest, r: 'oldrel-4'}
31+
32+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
33+
- {os: ubuntu-latest, r: 'release'}
34+
- {os: ubuntu-latest, r: 'oldrel-1'}
35+
- {os: ubuntu-latest, r: 'oldrel-2'}
36+
- {os: ubuntu-latest, r: 'oldrel-3'}
37+
- {os: ubuntu-latest, r: 'oldrel-4'}
3938

4039
env:
4140
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
4241
R_KEEP_PKG_SOURCE: yes
4342

4443
steps:
45-
- uses: actions/checkout@v3
44+
- uses: actions/checkout@v4
4645

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

@@ -60,3 +59,4 @@ jobs:
6059
- uses: r-lib/actions/check-r-package@v2
6160
with:
6261
upload-snapshots: true
62+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

.github/workflows/pkgdown.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ on:
44
push:
55
branches: [main, master]
66
pull_request:
7-
branches: [main, master]
87
release:
98
types: [published]
109
workflow_dispatch:
1110

12-
name: pkgdown
11+
name: pkgdown.yaml
12+
13+
permissions: read-all
1314

1415
jobs:
1516
pkgdown:
@@ -19,8 +20,10 @@ jobs:
1920
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
2021
env:
2122
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
23+
permissions:
24+
contents: write
2225
steps:
23-
- uses: actions/checkout@v3
26+
- uses: actions/checkout@v4
2427

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

@@ -39,7 +42,7 @@ jobs:
3942

4043
- name: Deploy to GitHub pages 🚀
4144
if: github.event_name != 'pull_request'
42-
uses: JamesIves/github-pages-deploy-action@v4.4.1
45+
uses: JamesIves/github-pages-deploy-action@v4.5.0
4346
with:
4447
clean: false
4548
branch: gh-pages

.github/workflows/pr-commands.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
issue_comment:
55
types: [created]
66

7-
name: Commands
7+
name: pr-commands.yaml
8+
9+
permissions: read-all
810

911
jobs:
1012
document:
@@ -13,8 +15,10 @@ jobs:
1315
runs-on: ubuntu-latest
1416
env:
1517
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
permissions:
19+
contents: write
1620
steps:
17-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
1822

1923
- uses: r-lib/actions/pr-fetch@v2
2024
with:
@@ -50,8 +54,10 @@ jobs:
5054
runs-on: ubuntu-latest
5155
env:
5256
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
57+
permissions:
58+
contents: write
5359
steps:
54-
- uses: actions/checkout@v3
60+
- uses: actions/checkout@v4
5561

5662
- uses: r-lib/actions/pr-fetch@v2
5763
with:

.github/workflows/test-coverage.yaml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ on:
44
push:
55
branches: [main, master]
66
pull_request:
7-
branches: [main, master]
87

9-
name: test-coverage
8+
name: test-coverage.yaml
9+
10+
permissions: read-all
1011

1112
jobs:
1213
test-coverage:
@@ -15,36 +16,47 @@ jobs:
1516
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1617

1718
steps:
18-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
1920

2021
- uses: r-lib/actions/setup-r@v2
2122
with:
2223
use-public-rspm: true
2324

2425
- uses: r-lib/actions/setup-r-dependencies@v2
2526
with:
26-
extra-packages: any::covr
27+
extra-packages: any::covr, any::xml2
2728
needs: coverage
2829

2930
- name: Test coverage
3031
run: |
31-
covr::codecov(
32+
cov <- covr::package_coverage(
3233
quiet = FALSE,
3334
clean = FALSE,
34-
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
35+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
3536
)
37+
print(cov)
38+
covr::to_cobertura(cov)
3639
shell: Rscript {0}
3740

41+
- uses: codecov/codecov-action@v5
42+
with:
43+
# Fail if error if not on PR, or if on PR and token is given
44+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
45+
files: ./cobertura.xml
46+
plugins: noop
47+
disable_search: true
48+
token: ${{ secrets.CODECOV_TOKEN }}
49+
3850
- name: Show testthat output
3951
if: always()
4052
run: |
4153
## --------------------------------------------------------------------
42-
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
54+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
4355
shell: bash
4456

4557
- name: Upload test results
4658
if: failure()
47-
uses: actions/upload-artifact@v3
59+
uses: actions/upload-artifact@v4
4860
with:
4961
name: coverage-test-failures
5062
path: ${{ runner.temp }}/package

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# magrittr (development version)
22

3+
* Fixes for CRAN checks.
4+
5+
36
# magrittr 2.0.3
47

58
* Fixed a C level protection issue in `%>%` (#256).

README.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ knitr::opts_chunk$set(
1313
library(magrittr)
1414
```
1515

16-
# magrittr <a href='https:/magrittr.tidyverse.org'><img src='man/figures/logo.png' align="right" height="139" /></a>
16+
# magrittr <a href='https://magrittr.tidyverse.org'><img src='man/figures/logo.png' align="right" height="139" /></a>
1717

1818
<!-- badges: start -->
1919
[![CRAN status](https://www.r-pkg.org/badges/version/magrittr)](https://cran.r-project.org/package=magrittr)
2020
[![Codecov test coverage](https://codecov.io/gh/tidyverse/magrittr/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidyverse/magrittr?branch=main)
21-
[![R-CMD-check](https://github.com/smbache/magrittr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/smbache/magrittr/actions/workflows/R-CMD-check.yaml)
21+
[![R-CMD-check](https://github.com/tidyverse/magrittr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tidyverse/magrittr/actions/workflows/R-CMD-check.yaml)
2222
<!-- badges: end -->
2323

2424
## Overview

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

22
<!-- README.md is generated from README.Rmd. Please edit that file -->
33

4-
# magrittr <a href='https:/magrittr.tidyverse.org'><img src='man/figures/logo.png' align="right" height="139" /></a>
4+
# magrittr <a href='https://magrittr.tidyverse.org'><img src='man/figures/logo.png' align="right" height="139" /></a>
55

66
<!-- badges: start -->
77

88
[![CRAN
99
status](https://www.r-pkg.org/badges/version/magrittr)](https://cran.r-project.org/package=magrittr)
1010
[![Codecov test
1111
coverage](https://codecov.io/gh/tidyverse/magrittr/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidyverse/magrittr?branch=main)
12-
[![R-CMD-check](https://github.com/smbache/magrittr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/smbache/magrittr/actions/workflows/R-CMD-check.yaml)
12+
[![R-CMD-check](https://github.com/tidyverse/magrittr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tidyverse/magrittr/actions/workflows/R-CMD-check.yaml)
1313
<!-- badges: end -->
1414

1515
## Overview

cran-comments.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Fixes part of non-conformant C API calls.
2+
3+
See https://github.com/tidyverse/magrittr/issues/279 for progress, the rest needs some ongoing updates to r-devel.
4+
15
## R CMD check results
26

37
There were no ERRORs, WARNINGs, or NOTEs.

src/pipe.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ SEXP magrittr_pipe(SEXP call, SEXP op, SEXP args, SEXP rho) {
7474
SEXP env = PROTECT(Rf_eval(syms_env, rho));
7575

7676
SEXP pipe_sym = r_env_get(rho, syms_sym);
77-
if (pipe_sym == R_UnboundValue) {
77+
if (pipe_sym == r_unbound_sym) {
7878
pipe_sym = syms_pipe;
7979
}
8080
PROTECT(pipe_sym);
@@ -90,15 +90,15 @@ SEXP magrittr_pipe(SEXP call, SEXP op, SEXP args, SEXP rho) {
9090
return lambda;
9191
}
9292

93-
bool use_nested = r_env_get(rho, syms_nested) != R_UnboundValue;
93+
bool use_nested = r_env_get(rho, syms_nested) != r_unbound_sym;
9494
if (use_nested) {
9595
SEXP call = PROTECT(pipe_nest(exprs));
9696
SEXP out = Rf_eval(call, env);
9797
UNPROTECT(7);
9898
return out;
9999
}
100100

101-
bool use_lazy = r_env_get(rho, syms_lazy) != R_UnboundValue;
101+
bool use_lazy = r_env_get(rho, syms_lazy) != r_unbound_sym;
102102
SEXP out = R_NilValue;
103103

104104
if (use_lazy) {
@@ -198,7 +198,7 @@ static
198198
void clean_pipe(void* data) {
199199
struct cleanup_info* info = (struct cleanup_info*) data;
200200

201-
if (info->old == R_UnboundValue) {
201+
if (info->old == r_unbound_sym) {
202202
r_env_unbind(info->env, syms_dot);
203203
} else {
204204
Rf_defineVar(syms_dot, info->old, info->env);

0 commit comments

Comments
 (0)