From 7410783b3ae3b6fa030a3151fe62f019b9d72a9a Mon Sep 17 00:00:00 2001 From: Jim Hester Date: Thu, 4 Feb 2021 14:20:31 -0500 Subject: [PATCH 1/5] Use the pak based actions for tidy github actions --- R/github-actions.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/github-actions.R b/R/github-actions.R index dffc5cfc9..c816617ab 100644 --- a/R/github-actions.R +++ b/R/github-actions.R @@ -87,8 +87,8 @@ use_tidy_github_actions <- function() { full_status <- use_github_action_check_full(repo_spec = repo_spec) pr_status <- use_github_action_pr_commands() - pkgdown_status <- use_github_action("pkgdown") - test_coverage_status <- use_github_action("test-coverage") + pkgdown_status <- use_github_action("pkgdown-pak", save_as = "pkgdown.yaml") + test_coverage_status <- use_github_action("test-coverage-pak", save_as = "test-coverage.yaml") old_configs <- proj_path(c(".travis.yml", "appveyor.yml")) has_appveyor_travis <- file_exists(old_configs) @@ -222,7 +222,7 @@ use_github_action_check_full <- function(save_as = "R-CMD-check.yaml", # this must have `repo_spec` as an argument because it is called as part of # use_tidy_github_actions() use_github_action( - "check-full.yaml", + "check-pak.yaml", save_as = save_as, ignore = ignore, open = open From 356d4ce8615c492269bdd2302bbb65a32971c9af Mon Sep 17 00:00:00 2001 From: Jim Hester Date: Thu, 4 Feb 2021 14:43:35 -0500 Subject: [PATCH 2/5] Update usethis workflows --- .github/workflows/R-CMD-check.yaml | 37 +++++++++++++--------------- .github/workflows/pkgdown.yaml | 34 ++++++++++++++----------- .github/workflows/test-coverage.yaml | 31 ++++++++++++----------- 3 files changed, 52 insertions(+), 50 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index b0d724618..47e8871b3 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -29,17 +29,16 @@ jobs: - {os: macOS-latest, r: 'release'} - {os: windows-latest, r: 'release'} - {os: windows-latest, r: '3.6'} - - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.1.0 (ubuntu-18.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } + - {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - {os: ubuntu-18.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - - {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true RSPM: ${{ matrix.config.rspm }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} @@ -47,35 +46,33 @@ jobs: - uses: actions/checkout@v2 - uses: r-lib/actions/setup-r@v1 + id: install-r with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} - uses: r-lib/actions/setup-pandoc@v1 - - name: Query dependencies + - name: Install pak and 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") + install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") + saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds") shell: Rscript {0} - name: Cache R packages - if: runner.os != 'Windows' uses: actions/cache@v2 with: path: ${{ env.R_LIBS_USER }} - key: ${{ matrix.config.os }}-${{ hashFiles('.github/R-version') }}-2-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ matrix.config.os }}-${{ hashFiles('.github/R-version') }}-2- + key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }} + restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1- - - name: Install linux system dependencies + - 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", "16.04"))') - sudo apt-get install -y libgit2-dev + pak::local_system_requirements(execute = TRUE) + pak::pkg_system_requirements("rcmdcheck", execute = TRUE) + shell: Rscript {0} + - name: Install macOS system dependencies if: runner.os == 'macOS' @@ -85,8 +82,8 @@ jobs: - name: Install dependencies run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") + pak::local_install_dev_deps(upgrade = TRUE) + pak::pkg_install("rcmdcheck") shell: Rscript {0} - name: Configure Git user @@ -104,8 +101,8 @@ jobs: - name: Check env: _R_CHECK_CRAN_INCOMING_: false - _R_CHECK_FORCE_SUGGESTS_: ${{ matrix.config.r != '3.3' }} run: | + options(crayon.enabled = TRUE) rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") shell: Rscript {0} @@ -118,5 +115,5 @@ jobs: if: failure() uses: actions/upload-artifact@main with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results + name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results path: check diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 609eb139c..8cfa87ce8 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -8,46 +8,50 @@ name: pkgdown jobs: pkgdown: - runs-on: macOS-latest + runs-on: ubuntu-18.04 env: + RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: - uses: actions/checkout@v2 - uses: r-lib/actions/setup-r@v1 + id: install-r - uses: r-lib/actions/setup-pandoc@v1 - - name: Query dependencies + - name: Install pak and 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") + install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") + saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds") shell: Rscript {0} - name: Cache R packages uses: actions/cache@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- + key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }} + restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1- - - name: Install macOS system dependencies - if: runner.os == 'macOS' + - name: Install system dependencies + if: runner.os == 'Linux' run: | - brew install libgit2 + pak::local_system_requirements(execute = TRUE) + pak::pkg_system_requirements("pkgdown", execute = TRUE) + shell: Rscript {0} - name: Install dependencies run: | - remotes::install_deps(dependencies = TRUE) - install.packages("pkgdown", type = "binary") + pak::local_install_dev_deps(upgrade = TRUE) + pak::pkg_install("pkgdown") shell: Rscript {0} - name: Install package run: R CMD INSTALL . - - name: Deploy package + - name: Build and deploy pkgdown site run: | - git config --local user.name "$GITHUB_ACTOR" - git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git config --local user.email "$GITHUB_ACTOR" + git config --local user.name "$GITHUB_ACTOR@users.noreply.github.com" Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 9f55fb2a8..ebdbb4e6d 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -12,40 +12,41 @@ name: test-coverage jobs: test-coverage: - runs-on: macOS-latest + runs-on: ubuntu-18.04 env: + RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: - uses: actions/checkout@v2 - uses: r-lib/actions/setup-r@v1 + id: install-r - - uses: r-lib/actions/setup-pandoc@v1 - - - name: Query dependencies + - name: Install pak and 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") + install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") + saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds") shell: Rscript {0} - name: Cache R packages uses: actions/cache@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- + key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }} + restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1- - - name: Install macOS system dependencies - if: runner.os == 'macOS' + - name: Install system dependencies + if: runner.os == 'Linux' run: | - brew install libgit2 - brew install imagemagick@6 + pak::local_system_requirements(execute = TRUE) + pak::pkg_system_requirements("covr", execute = TRUE) + shell: Rscript {0} - name: Install dependencies run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("covr") + pak::local_install_dev_deps(upgrade = TRUE) + pak::pkg_install("covr") shell: Rscript {0} - name: Configure Git user From 1ceeba354afea38bd2ccfbe876b687de2c3ad71f Mon Sep 17 00:00:00 2001 From: Jim Hester Date: Thu, 4 Feb 2021 14:46:46 -0500 Subject: [PATCH 3/5] Re-arrange username and user-email --- .github/workflows/pkgdown.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 8cfa87ce8..d64002431 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -52,6 +52,6 @@ jobs: - name: Build and deploy pkgdown site run: | - git config --local user.email "$GITHUB_ACTOR" - git config --local user.name "$GITHUB_ACTOR@users.noreply.github.com" + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' From de8aa116820a8e54f2f952b341039985d78d0352 Mon Sep 17 00:00:00 2001 From: Jim Hester Date: Fri, 5 Feb 2021 07:41:05 -0500 Subject: [PATCH 4/5] Set the R-devel CI user agent to R 4.0 Because we want RSPM to serve the R 4.0 binaries for R-devel. --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 7c4b8cdd3..2569c786d 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -29,7 +29,7 @@ jobs: - {os: macOS-latest, r: 'release'} - {os: windows-latest, r: 'release'} - {os: windows-latest, r: '3.6'} - - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.1.0 (ubuntu-18.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } + - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } - {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} From 6e2920c8a47e02a24db1290ec7ed6230a2f34735 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Mon, 8 Feb 2021 16:24:25 -0800 Subject: [PATCH 5/5] Whitespace --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 2569c786d..451bc2a7a 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -29,7 +29,7 @@ jobs: - {os: macOS-latest, r: 'release'} - {os: windows-latest, r: 'release'} - {os: windows-latest, r: '3.6'} - - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } + - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } - {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}