Skip to content

Commit

Permalink
Update and simplify GHA workflow (rstudio#334)
Browse files Browse the repository at this point in the history
This also fixes a curl installation issue due to a **pak** issue
  • Loading branch information
cderv authored Oct 25, 2021
1 parent 66ece33 commit de014f6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 89 deletions.
66 changes: 15 additions & 51 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
branches:
- main
- master
branches: main
pull_request:
branches:
- main
- master

branches: main
name: Check & Coverage

jobs:
Expand All @@ -24,71 +19,40 @@ jobs:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: 'release', 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.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: 'oldrel'}
- {os: ubuntu-18.04, r: 'release'}
- {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: true
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
# don't treat missing suggested packages as error
_R_CHECK_FORCE_SUGGESTS_: false
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-pandoc@v1

- 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
use-public-rspm: true

- uses: r-lib/actions/setup-tinytex@v1
env:
# install full prebuilt version
TINYTEX_INSTALLER: TinyTeX

- name: Install pak and query dependencies
run: |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
saveRDS(pak::pkg_deps_tree("local::.", dependencies = TRUE), ".github/r-depends.rds")
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@master
with:
path: |
${{ env.R_LIBS_USER }}/*
!${{ env.R_LIBS_USER }}/pak
key: ${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
restore-keys: ${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
extra-packages: |
rcmdcheck
curl
- name: Install system dependencies
if: runner.os == 'Linux'
run: Rscript -e 'pak::local_system_requirements(execute = TRUE)'

- name: Install dependencies
run: |
pak::local_install_dev_deps(upgrade = TRUE)
pak::pkg_install("rcmdcheck")
shell: Rscript {0}

- name: Session info
run: |
options(width = 100)
pkgs <- .packages(TRUE)
pak::pkg_install("sessioninfo")
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- uses: r-lib/actions/check-r-package@v1

- name: Test coverage
if: success() && runner.os == 'Linux' && matrix.config.r == 'release'
Expand Down
46 changes: 8 additions & 38 deletions .github/workflows/required-latex-pkgs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
branches:
- main
- master
branches: main
pull_request:
branches:
- main
- master
branches: main

name: check required LateX packages

Expand All @@ -20,14 +16,14 @@ jobs:

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
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
with:
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@v1

Expand All @@ -36,37 +32,11 @@ jobs:
# install prebuilt base version (infraonly)
TINYTEX_INSTALLER: TinyTeX-0

- name: Install pak and query dependencies
run: |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
saveRDS(pak::pkg_deps_tree("local::.", dependencies = TRUE), ".github/r-depends.rds")
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v1
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
restore-keys: ${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
run: Rscript -e 'pak::local_system_requirements(execute = TRUE)'

- name: Install dependencies
run: |
pak::local_install_dev_deps(upgrade = TRUE)
pak::pkg_install("rcmdcheck")
pak::pkg_install("yihui/knitr")
shell: Rscript {0}

- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
pak::pkg_install("sessioninfo")
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
extra-packages: |
curl,
yihui/knitr
- name: Find required LateX packages
run: Rscript tools/test-packages.R

0 comments on commit de014f6

Please sign in to comment.