From 210a5a63f85572cc3d70022b389a70c07eb4db2c Mon Sep 17 00:00:00 2001 From: Colin Rundel Date: Sat, 13 Jan 2024 19:48:07 -0500 Subject: [PATCH] Fix check action --- .github/workflows/R-CMD-check.yaml | 83 +++++------------------------- README.Rmd | 2 +- README.md | 38 +++++++------- 3 files changed, 33 insertions(+), 90 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 243c87b..f4b17a4 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.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 diff --git a/README.Rmd b/README.Rmd index 357bf84..7bef39b 100644 --- a/README.Rmd +++ b/README.Rmd @@ -20,8 +20,8 @@ library(magrittr) # parsermd -[![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) 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. diff --git a/README.md b/README.md index 1382c36..cc40fbe 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ -[![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) The goal of parsermd is to extract the content of an R Markdown file to @@ -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] - +#> │ └── 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 -#> -#> 1 rmd_yaml_list -#> 2 Setup rmd_heading -#> 3 Setup rmd_chunk "setup" -#> 4 Content rmd_heading -#> 5 Content R Markdown rmd_heading -#> 6 Content R Markdown rmd_markdown -#> 7 Content R Markdown rmd_chunk "cars" -#> 8 Content R Markdown rmd_chunk "" -#> 9 Content Including Plots rmd_heading -#> 10 Content Including Plots rmd_markdown -#> 11 Content Including Plots rmd_chunk "pressure" -#> 12 Content Including Plots rmd_markdown +#> # A tibble: 12 × 5 +#> sec_h1 sec_h2 type label ast +#> +#> 1 rmd_yaml_list +#> 2 Setup rmd_heading +#> 3 Setup rmd_chunk setup +#> 4 Content rmd_heading +#> 5 Content R Markdown rmd_heading +#> 6 Content R Markdown rmd_markdown +#> 7 Content R Markdown rmd_chunk cars +#> 8 Content R Markdown rmd_chunk unnamed-chunk-1 +#> 9 Content Including Plots rmd_heading +#> 10 Content Including Plots rmd_markdown +#> 11 Content Including Plots rmd_chunk pressure +#> 12 Content Including Plots rmd_markdown 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] - +#> │ └── Chunk [r, 1 lines] - unnamed-chunk-1 #> └── Heading [h2] - Including Plots #> ├── Markdown [2 lines] #> ├── Chunk [r, 1 opt, 1 lines] - pressure @@ -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] - +#> │ └── Chunk [r, 1 lines] - unnamed-chunk-1 #> └── Heading [h2] - Including Plots #> └── Chunk [r, 1 opt, 1 lines] - pressure