Skip to content

Commit

Permalink
Updated workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
kloppen committed Sep 4, 2023
1 parent 0c8c894 commit 4157a0e
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 115 deletions.
25 changes: 9 additions & 16 deletions .github/workflows/R-CMD-check-depends-only.yaml
Expand Up @@ -26,29 +26,19 @@ jobs:
- { os: macOS-latest, r: 'release', vdiffr: false }

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# Runs vdiffr test only on the latest version of R
VDIFFR_RUN_TESTS: ${{ matrix.config.vdiffr }}
VDIFFR_LOG_PATH: "../vdiffr.Rout.fail"
R_KEEP_PKG_SOURCE: yes

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

- uses: r-lib/actions/setup-r@master
- 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-pandoc@master

# To install vdiffr, these three libraries/tools are needed:
# - freetype (already installed, needed by systemfonts)
# - cairo (not installed, needed by gdtools)
# - pkg-config (not installed, needed to set proper build settings)
- name: Install pkg-config and cairo on macOS
if: runner.os == 'macOS'
run: brew install pkg-config cairo
- uses: r-lib/actions/setup-pandoc@v2

- name: Query dependencies
run: |
Expand Down Expand Up @@ -80,6 +70,7 @@ jobs:
remotes::install_cran("rcmdcheck")
remotes::install_cran("knitr") # Also install knitr to allow rebuilding of vignettes
remotes::install_cran("rmarkdown") # rmarkdown is required for knitr to work
remotes::install_cran("testthat")
shell: Rscript {0}

- name: Session info
Expand All @@ -93,6 +84,8 @@ jobs:
env:
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_DEPENDS_ONLY_: true
_R_CHECK_FORCE_SUGGESTS_: false

run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--no-build-vignettes"), build_args = c("--no-build-vignettes"), error_on = "error", check_dir = "check")
shell: Rscript {0}

Expand Down
86 changes: 21 additions & 65 deletions .github/workflows/R-CMD-check.yaml
@@ -1,3 +1,5 @@
# 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:
Expand All @@ -9,8 +11,6 @@ on:
- master
- develop
- release**
schedule:
- cron: '0 0 1 * *'

name: R-CMD-check

Expand All @@ -24,89 +24,45 @@ jobs:
fail-fast: false
matrix:
config:
- { os: windows-latest, r: 'release', vdiffr: true }
# - { os: macOS-latest, r: 'devel', vdiffr: false }
- { os: macOS-latest, r: 'release', vdiffr: false }
- { os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", vdiffr: true }
- { os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", vdiffr: false }
# r-devel is not available on Ubuntu (ref. r-lib/actions/setup-r/lib/installer)
- {os: macos-latest, r: 'release', vdiffr: false }
- {os: windows-latest, r: 'release', vdiffr: true }
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release', vdiffr: false }
- {os: ubuntu-latest, r: 'release', vdiffr: false }
- {os: ubuntu-latest, r: 'oldrel-1', vdiffr: false }

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
# Runs vdiffr test only on the latest version of R
VDIFFR_RUN_TESTS: ${{ matrix.config.vdiffr }}
VDIFFR_LOG_PATH: "../vdiffr.Rout.fail"

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

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

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

# To install vdiffr, these three libraries/tools are needed:
# - freetype (already installed, needed by systemfonts)
# - cairo (not installed, needed by gdtools)
# - pkg-config (not installed, needed to set proper build settings)
- name: Install pkg-config and cairo on macOS
if: runner.os == 'macOS'
run: brew install pkg-config cairo
- uses: r-lib/actions/setup-pandoc@v2

- 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
- uses: r-lib/actions/setup-r@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-
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "install.packages('remotes')"
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("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 = "warning", check_dir = "check")
shell: Rscript {0}

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
upload-snapshots: true
58 changes: 27 additions & 31 deletions .github/workflows/test-coverage.yaml
@@ -1,3 +1,5 @@
# 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:
Expand All @@ -12,47 +14,41 @@ name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
env:
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

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

- uses: r-lib/actions/setup-r@v1
id: install-r

- name: Install pak and query dependencies
run: |
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}
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Cache R packages
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
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-
extra-packages: any::covr
needs: coverage

- name: Install system dependencies
if: runner.os == 'Linux'
- name: Test coverage
run: |
pak::local_system_requirements(execute = TRUE)
pak::pkg_system_requirements("covr", execute = TRUE)
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
)
shell: Rscript {0}

- name: Install dependencies
- name: Show testthat output
if: always()
run: |
pak::local_install_dev_deps(upgrade = TRUE)
pak::pkg_install("covr")
shell: Rscript {0}
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Configure Git user
run: |
git config --global user.email "ghau@example.com"
git config --global user.name "GitHub Actions User"
- name: Test coverage
run: covr::codecov()
shell: Rscript {0}
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
2 changes: 1 addition & 1 deletion README.Rmd
Expand Up @@ -15,7 +15,7 @@ knitr::opts_chunk$set(
# cmstatr <img src="man/figures/logo.png" align="right" alt="" width="120" />

<!-- badges: start -->
[![R build status](https://github.com/cmstatr/cmstatr/workflows/R-CMD-check/badge.svg)](https://github.com/cmstatr/cmstatr/actions?workflow=R-CMD-check)
[![R-CMD-check](https://github.com/cmstatr/cmstatr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/cmstatr/cmstatr/actions/workflows/R-CMD-check.yaml)
[![`Codecov` test coverage](https://codecov.io/gh/cmstatr/cmstatr/branch/master/graph/badge.svg)](https://codecov.io/gh/cmstatr/cmstatr?branch=master)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.02265/status.svg)](https://doi.org/10.21105/joss.02265)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/cmstatr)](https://cran.r-project.org/package=cmstatr)
Expand Down
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -5,8 +5,7 @@

<!-- badges: start -->

[![R build
status](https://github.com/cmstatr/cmstatr/workflows/R-CMD-check/badge.svg)](https://github.com/cmstatr/cmstatr/actions?workflow=R-CMD-check)
[![R-CMD-check](https://github.com/cmstatr/cmstatr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/cmstatr/cmstatr/actions/workflows/R-CMD-check.yaml)
[![`Codecov` test
coverage](https://codecov.io/gh/cmstatr/cmstatr/branch/master/graph/badge.svg)](https://codecov.io/gh/cmstatr/cmstatr?branch=master)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.02265/status.svg)](https://doi.org/10.21105/joss.02265)
Expand Down

0 comments on commit 4157a0e

Please sign in to comment.