Skip to content

Commit

Permalink
Fix check action
Browse files Browse the repository at this point in the history
  • Loading branch information
rundel committed Jan 14, 2024
1 parent 2164ab1 commit 210a5a6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 90 deletions.
83 changes: 13 additions & 70 deletions .github/workflows/R-CMD-check.yaml
@@ -1,86 +1,29 @@
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
- main
- master
branches: [main, master]
pull_request:
branches:
- main
- master
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}

runs-on: ubuntu-latest
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@v1
use-public-rspm: true

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}
extra-packages: any::rcmdcheck
needs: check

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
- uses: r-lib/actions/check-r-package@v2
2 changes: 1 addition & 1 deletion README.Rmd
Expand Up @@ -20,8 +20,8 @@ library(magrittr)
# parsermd

<!-- badges: start -->
[![R-CMD-check](https://github.com/rundel/parsermd/workflows/R-CMD-check/badge.svg)](https://github.com/rundel/parsermd/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/parsermd)](https://CRAN.R-project.org/package=parsermd)
[![R-CMD-check](https://github.com/rundel/parsermd/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rundel/parsermd/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

The goal of parsermd is to extract the content of an R Markdown file to allow for programmatic interactions with the document's contents (i.e. code chunks and markdown text). The goal is to capture the fundamental structure of the document and as such we do not attempt to parse every detail of the Rmd. Specifically, the yaml front matter, markdown text, and R code are read as text lines allowing them to be processed using other tools.
Expand Down
38 changes: 19 additions & 19 deletions README.md
Expand Up @@ -5,9 +5,9 @@

<!-- badges: start -->

[![R-CMD-check](https://github.com/rundel/parsermd/workflows/R-CMD-check/badge.svg)](https://github.com/rundel/parsermd/actions)
[![CRAN
status](https://www.r-pkg.org/badges/version/parsermd)](https://CRAN.R-project.org/package=parsermd)
[![R-CMD-check](https://github.com/rundel/parsermd/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rundel/parsermd/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

The goal of parsermd is to extract the content of an R Markdown file to
Expand Down Expand Up @@ -52,35 +52,35 @@ any of the topic specific articles.
#> ├── Heading [h2] - R Markdown
#> │ ├── Markdown [6 lines]
#> │ ├── Chunk [r, 1 lines] - cars
#> │ └── Chunk [r, 1 lines] - <unnamed>
#> │ └── Chunk [r, 1 lines] - unnamed-chunk-1
#> └── Heading [h2] - Including Plots
#> ├── Markdown [2 lines]
#> ├── Chunk [r, 1 opt, 1 lines] - pressure
#> └── Markdown [2 lines]

as_tibble(rmd)
#> # A tibble: 12 x 5
#> sec_h1 sec_h2 type label ast
#> <chr> <chr> <chr> <chr> <rmd_ast>
#> 1 <NA> <NA> rmd_yaml_list <NA> <yaml>
#> 2 Setup <NA> rmd_heading <NA> <heading [h1]>
#> 3 Setup <NA> rmd_chunk "setup" <chunk [r]>
#> 4 Content <NA> rmd_heading <NA> <heading [h1]>
#> 5 Content R Markdown rmd_heading <NA> <heading [h2]>
#> 6 Content R Markdown rmd_markdown <NA> <rmd_mrkd [6]>
#> 7 Content R Markdown rmd_chunk "cars" <chunk [r]>
#> 8 Content R Markdown rmd_chunk "" <chunk [r]>
#> 9 Content Including Plots rmd_heading <NA> <heading [h2]>
#> 10 Content Including Plots rmd_markdown <NA> <rmd_mrkd [2]>
#> 11 Content Including Plots rmd_chunk "pressure" <chunk [r]>
#> 12 Content Including Plots rmd_markdown <NA> <rmd_mrkd [2]>
#> # A tibble: 12 × 5
#> sec_h1 sec_h2 type label ast
#> <chr> <chr> <chr> <chr> <rmd_ast>
#> 1 <NA> <NA> rmd_yaml_list <NA> <yaml>
#> 2 Setup <NA> rmd_heading <NA> <heading [h1]>
#> 3 Setup <NA> rmd_chunk setup <chunk [r]>
#> 4 Content <NA> rmd_heading <NA> <heading [h1]>
#> 5 Content R Markdown rmd_heading <NA> <heading [h2]>
#> 6 Content R Markdown rmd_markdown <NA> <rmd_mrkd [6]>
#> 7 Content R Markdown rmd_chunk cars <chunk [r]>
#> 8 Content R Markdown rmd_chunk unnamed-chunk-1 <chunk [r]>
#> 9 Content Including Plots rmd_heading <NA> <heading [h2]>
#> 10 Content Including Plots rmd_markdown <NA> <rmd_mrkd [2]>
#> 11 Content Including Plots rmd_chunk pressure <chunk [r]>
#> 12 Content Including Plots rmd_markdown <NA> <rmd_mrkd [2]>

rmd_select(rmd, by_section("Content"))
#> └── Heading [h1] - Content
#> ├── Heading [h2] - R Markdown
#> │ ├── Markdown [6 lines]
#> │ ├── Chunk [r, 1 lines] - cars
#> │ └── Chunk [r, 1 lines] - <unnamed>
#> │ └── Chunk [r, 1 lines] - unnamed-chunk-1
#> └── Heading [h2] - Including Plots
#> ├── Markdown [2 lines]
#> ├── Chunk [r, 1 opt, 1 lines] - pressure
Expand All @@ -91,7 +91,7 @@ rmd_select(rmd, by_section(c("Content", "*"))) %>%
#> └── Heading [h1] - Content
#> ├── Heading [h2] - R Markdown
#> │ ├── Chunk [r, 1 lines] - cars
#> │ └── Chunk [r, 1 lines] - <unnamed>
#> │ └── Chunk [r, 1 lines] - unnamed-chunk-1
#> └── Heading [h2] - Including Plots
#> └── Chunk [r, 1 opt, 1 lines] - pressure

Expand Down

0 comments on commit 210a5a6

Please sign in to comment.