Merge pull request #817 from DyfanJones/main #288
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
Unit-Tests: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.R }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { os: 'ubuntu-latest', R: 'latest' } | |
- { os: 'macOS-latest', R: 'latest' } | |
- { os: 'windows-latest', R: 'latest' } | |
- { os: 'ubuntu-latest', R: 'devel' } | |
- { os: 'windows-latest', R: 'devel' } | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.R }} | |
- uses: r-lib/actions/setup-pandoc@v2 | |
with: | |
pandoc-version: '2.17.1' | |
- name: Install system dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev libgit2-dev | |
sudo apt-get install -y libharfbuzz-dev libfribidi-dev | |
- name: List dependencies | |
run: | | |
install.packages('remotes') | |
saveRDS( | |
c( | |
remotes::dev_package_deps('paws.common', dependencies = TRUE), | |
remotes::dev_package_deps('make.paws', dependencies = TRUE), | |
'remotes', 'covr' | |
), | |
'.github/depends.Rds', version = 2 | |
) | |
shell: Rscript {0} | |
- name: Cache R packages | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ runner.os }}-${{ matrix.config.R }}-1-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ runner.os }}-${{ matrix.config.R }}-1- | |
- name: Install dependencies | |
run: | | |
install.packages('remotes') | |
remotes::install_deps('paws.common', dependencies = TRUE) | |
remotes::install_deps('make.paws', dependencies = TRUE) | |
remotes::install_cran("rcmdcheck") | |
shell: Rscript {0} | |
- name: Install paws packages | |
run: | | |
remotes::install_local('paws.common', force = TRUE) | |
remotes::install_local('make.paws', force = TRUE) | |
for (package in rev(list.dirs("cran", recursive = FALSE))) { | |
remotes::install_local(package, force = TRUE) | |
} | |
shell: Rscript {0} | |
- name: Check | |
env: | |
_R_CHECK_CRAN_INCOMING_: false | |
run: | | |
rcmdcheck::rcmdcheck('paws.common', args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") | |
rcmdcheck::rcmdcheck('make.paws', args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") | |
rcmdcheck::rcmdcheck('cran/paws', 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 | |
- name: Install covr | |
run: | | |
install.packages('covr') | |
shell: Rscript {0} | |
- name: Get code coverage | |
run: | | |
Rscript script/codecov.R paws.common make.paws |