From 431ceb085c5ea30e292b696b1dfa53402e1be11a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Tue, 18 Oct 2022 10:16:06 +0200 Subject: [PATCH] modernize GHA workflow + update README + add Rproj --- .Rbuildignore | 1 + .github/.gitignore | 1 + .github/workflows/R-CMD-check.yaml | 49 ++++++++++++++++ .github/workflows/R-check.yaml | 92 ------------------------------ README.Rmd | 24 +++++--- README.md | 60 +++++++++++-------- gistr.Rproj | 20 +++++++ 7 files changed, 122 insertions(+), 125 deletions(-) create mode 100644 .github/.gitignore create mode 100644 .github/workflows/R-CMD-check.yaml delete mode 100644 .github/workflows/R-check.yaml create mode 100644 gistr.Rproj diff --git a/.Rbuildignore b/.Rbuildignore index ae72076..8f356a4 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -14,3 +14,4 @@ figure ^cran-comments\.md$ ^\.httr-oauth$ ^codemeta\.json$ +^\.github$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..52c2b27 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,49 @@ +# 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] + pull_request: + 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: macOS-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true diff --git a/.github/workflows/R-check.yaml b/.github/workflows/R-check.yaml deleted file mode 100644 index 5ccc855..0000000 --- a/.github/workflows/R-check.yaml +++ /dev/null @@ -1,92 +0,0 @@ -on: [push, pull_request] - -name: R-check - -jobs: - R-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: windows-latest, r: 'devel'} - - { os: macOS-latest, r: 'release'} - # - { os: macOS-latest, r: 'devel'} - - { os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - - env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - CRAN: ${{ matrix.config.rspm }} - GITHUB_PAT: ${{secrets.MY_GITHUB_PAT}} - - steps: - - uses: actions/checkout@v2 - - - uses: r-lib/actions/setup-r@master - with: - r-version: ${{ matrix.config.r }} - - - uses: r-lib/actions/setup-pandoc@master - - - 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@v1 - 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' - env: - RHUB_PLATFORM: linux-x86_64-ubuntu-gcc - run: | - Rscript -e "remotes::install_github('r-hub/sysreqs')" - sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))") - sudo -s eval "$sysreqs" - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran(c("rcmdcheck")) - shell: Rscript {0} - - - name: Session info - run: | - options(width = 100) - pkgs <- installed.packages()[, "Package"] - sessioninfo::session_info(pkgs, include_base = TRUE) - shell: Rscript {0} - - - name: Check - env: - _R_CHECK_CRAN_INCOMING_: false - run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check") - shell: Rscript {0} - - - name: Show testthat output - if: always() - run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true - shell: bash - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main - with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check - - - name: Test coverage - if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release' - run: | - Rscript -e 'install.packages("covr")' -e 'covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")' diff --git a/README.Rmd b/README.Rmd index d1d2670..dab6d0a 100644 --- a/README.Rmd +++ b/README.Rmd @@ -1,20 +1,28 @@ -gistr -======= +--- +output: github_document +--- + + -```{r echo=FALSE} +```{r, include = FALSE} knitr::opts_chunk$set( - comment = "#>", collapse = TRUE, - warning = FALSE, - message = FALSE + comment = "#>", + fig.path = "man/figures/README-", + out.width = "100%" ) ``` +gistr +======= + + +[![R-CMD-check](https://github.com/ropensci/gistr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/gistr/actions/workflows/R-CMD-check.yaml) [![cran checks](https://cranchecks.info/badges/worst/gistr)](https://cranchecks.info/pkgs/gistr) -[![R-check](https://github.com/ropensci/gistr/workflows/R-check/badge.svg)](https://github.com/ropensci/gistr/actions/) [![codecov.io](https://codecov.io/github/ropensci/gistr/coverage.svg?branch=master)](https://codecov.io/github/ropensci/gistr?branch=master) [![rstudio mirror downloads](https://cranlogs.r-pkg.org/badges/gistr)](https://github.com/metacran/cranlogs.app) [![cran version](https://www.r-pkg.org/badges/version/gistr)](https://cran.r-project.org/package=gistr) + `gistr` is a light interface to GitHub's gists for R. @@ -50,5 +58,3 @@ library("gistr") * License: MIT * Get citation information for `gistr` in R doing `citation(package = 'gistr')` * Please note that this package is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By contributing to this project, you agree to abide by its terms. - -[![rofooter](https://ropensci.org/public_images/github_footer.png)](https://ropensci.org) diff --git a/README.md b/README.md index 9f75ecb..ce10d3b 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,63 @@ -gistr -======= + +# gistr -[![cran checks](https://cranchecks.info/badges/worst/gistr)](https://cranchecks.info/pkgs/gistr) -[![R-check](https://github.com/ropensci/gistr/workflows/R-check/badge.svg)](https://github.com/ropensci/gistr/actions/) + + +[![R-CMD-check](https://github.com/ropensci/gistr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/gistr/actions/workflows/R-CMD-check.yaml) +[![cran +checks](https://cranchecks.info/badges/worst/gistr)](https://cranchecks.info/pkgs/gistr) [![codecov.io](https://codecov.io/github/ropensci/gistr/coverage.svg?branch=master)](https://codecov.io/github/ropensci/gistr?branch=master) -[![rstudio mirror downloads](https://cranlogs.r-pkg.org/badges/gistr)](https://github.com/metacran/cranlogs.app) -[![cran version](https://www.r-pkg.org/badges/version/gistr)](https://cran.r-project.org/package=gistr) +[![rstudio mirror +downloads](https://cranlogs.r-pkg.org/badges/gistr)](https://github.com/metacran/cranlogs.app) +[![cran +version](https://www.r-pkg.org/badges/version/gistr)](https://cran.r-project.org/package=gistr) + -`gistr` is a light interface to GitHub's gists for R. +`gistr` is a light interface to GitHub’s gists for R. -Get started with the docs: https://docs.ropensci.org/gistr +Get started with the docs: ## See also: -* [gert](https://github.com/r-lib/gert) Simple git client for R by Jeroen Ooms -* [gistfo](https://github.com/MilesMcBain/gistfo) for turning your untitled RStudio tabs into gists! -* [git2r](https://github.com/ropensci/git2r) an R client for the libgit2 C library by Stefan Widgren -* [git2rdata](https://ropensci.github.io/git2rdata/) for storing data frames efficiently in git +- [git2r](https://github.com/ropensci/git2r) an R client for the + libgit2 C library by Stefan Widgren +- [gert](https://github.com/r-lib/gert) Simple git client for R by + Jeroen Ooms +- [gistfo](https://github.com/MilesMcBain/gistfo) for turning your + untitled RStudio tabs into gists! ## Install Stable version from CRAN - -```r +``` r install.packages("gistr") ``` Or dev version from GitHub. - -```r +``` r remotes::install_github("ropensci/gistr") ``` - -```r +``` r library("gistr") +#> +#> Attaching package: 'gistr' +#> The following objects are masked from 'package:stats': +#> +#> embed, update ``` ## Meta -* Please [report any issues or bugs](https://github.com/ropensci/gistr/issues). -* License: MIT -* Get citation information for `gistr` in R doing `citation(package = 'gistr')` -* Please note that this package is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By contributing to this project, you agree to abide by its terms. - -[![rofooter](https://ropensci.org/public_images/github_footer.png)](https://ropensci.org) +- Please [report any issues or + bugs](https://github.com/ropensci/gistr/issues). +- License: MIT +- Get citation information for `gistr` in R doing + `citation(package = 'gistr')` +- Please note that this package is released with a [Contributor Code + of Conduct](https://ropensci.org/code-of-conduct/). By contributing + to this project, you agree to abide by its terms. diff --git a/gistr.Rproj b/gistr.Rproj new file mode 100644 index 0000000..497f8bf --- /dev/null +++ b/gistr.Rproj @@ -0,0 +1,20 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source