124 lines
5 KiB
YAML
124 lines
5 KiB
YAML
# This workflow uses actions that are not certified by GitHub.
|
|
# They are provided by a third-party and are governed by
|
|
# separate terms of service, privacy policy, and support
|
|
# documentation.
|
|
#
|
|
# See https://github.com/r-lib/actions/tree/master/examples#readme for
|
|
# additional example workflows available for the R community.
|
|
|
|
# ======================================================== #
|
|
# Determines when the action is triggered #
|
|
# ======================================================== #
|
|
|
|
on: [push, pull_request]
|
|
name: R-CMD-check
|
|
|
|
# ======================================================== #
|
|
# Determine actions to take #
|
|
# ======================================================== #
|
|
|
|
jobs:
|
|
R-CMD-check:
|
|
runs-on: ${{ matrix.config.os }}
|
|
name: ${{ matrix.config.os }} (R ${{ matrix.config.r }})
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
config:
|
|
- {os: windows-latest, r: 'release'}
|
|
- {os: macOS-latest, r: 'release'}
|
|
- {os: ubuntu-latest, r: 'release'}
|
|
- {os: ubuntu-latest, r: 'devel'}
|
|
steps:
|
|
|
|
# Checking out code -------------------------------------- #
|
|
- name: Checking out the repository
|
|
uses: actions/checkout@v2
|
|
|
|
# Setting up environment --------------------------------- #
|
|
- name: Setting up R ${{ matrix.config.r }} on ${{ matrix.config.os }}
|
|
uses: r-lib/actions/setup-r@v1
|
|
with:
|
|
r-version: ${{ matrix.config.r }}
|
|
|
|
# Installing Pandoc -------------------------------------- #
|
|
- name: Installing Pandoc
|
|
uses: r-lib/actions/setup-pandoc@v1
|
|
|
|
# Querying dependencies ---------------------------------- #
|
|
- name: Querying 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}
|
|
|
|
# Restoring R package cache ------------------------------ #
|
|
- name: Restoring R package cache
|
|
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-
|
|
|
|
# Installing system dependencies ------------------------- #
|
|
- name: Installing system dependencies
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get install libcurl4-openssl-dev
|
|
while read -r cmd
|
|
do
|
|
eval sudo $cmd
|
|
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
|
|
|
|
# Installing package dependencies ------------------------ #
|
|
- name: Installing package dependencies
|
|
run: |
|
|
remotes::install_cran(c("rcmdcheck", "BiocManager"))
|
|
BiocManager::install("GenomicRanges")
|
|
BiocManager::install("Rsamtools")
|
|
remotes::install_deps(dependencies = TRUE)
|
|
shell: Rscript {0}
|
|
|
|
# Checking package --------------------------------------- #
|
|
- name: Checking package
|
|
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}
|
|
|
|
# Checking unit test coverage ---------------------------- #
|
|
- name: Checking unit test coverage
|
|
run: |
|
|
install.packages("covr")
|
|
covr::codecov()
|
|
shell: Rscript {0}
|
|
|
|
# Judging coding style ----------------------------------- #
|
|
- name: Linting package
|
|
run: |
|
|
install.packages("lintr")
|
|
library(lintr)
|
|
style_rules <- list(
|
|
assignment_linter, closed_curly_linter, commas_linter,
|
|
todo_comment_linter, equals_na_linter,
|
|
function_left_parentheses_linter, infix_spaces_linter,
|
|
line_length_linter, no_tab_linter, open_curly_linter,
|
|
paren_brace_linter, absolute_path_linter, nonportable_path_linter,
|
|
pipe_continuation_linter, semicolon_terminator_linter,
|
|
single_quotes_linter, spaces_inside_linter,
|
|
trailing_blank_lines_linter, trailing_whitespace_linter,
|
|
undesirable_function_linter, undesirable_operator_linter
|
|
) # TODO: expand style rules as package matures
|
|
lint_package(linters = style_rules)
|
|
shell: Rscript {0}
|
|
|
|
# Uploading check results -------------------------------- #
|
|
- name: Uploading check results
|
|
if: failure()
|
|
uses: actions/upload-artifact@main
|
|
with:
|
|
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
|
|
path: check
|