Update r.yml #40
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
# 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. | |
# 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. | |
name: R | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
permissions: | |
contents: read | |
jobs: | |
R-CMD-check: | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
matrix: | |
config: | |
- { os: ubuntu-latest, r: 'devel' } | |
- { os: ubuntu-latest, r: 'release' } | |
- { os: macOS-latest, r: 'release' } | |
- { os: windows-latest, r: 'release' } | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up R (latest version) | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: 'latest' | |
# Install system dependencies required for R packages | |
- name: Install system dependencies (Linux) | |
if: matrix.config.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update -y || true | |
sudo apt-get install -y pandoc | |
- name: Install system dependencies (macOS) | |
if: matrix.config.os == 'macOS-latest' | |
run: | | |
brew link pkgconf | |
brew install qpdf pkgconf checkbashisms ghostscript | |
brew reinstall pkgconf | |
brew install pandoc | |
- name: Install Pandoc for Windows | |
if: matrix.config.os == 'windows-latest' | |
run: | | |
choco install pandoc -y | |
- name: Install R dependencies | |
run: | | |
Rscript -e "if (!requireNamespace('remotes', quietly = TRUE)) install.packages('remotes')" | |
Rscript -e "remotes::install_deps(dependencies = TRUE)" | |
- name: Run R tests | |
run: | |
Rscript -e "testthat::test_file('tests/testthat/test-counts.R')" | |
Rscript -e "testthat::test_file('tests/testthat/test-reordering.R')" | |
# Build the package based on os | |
- name: Build the package (Linux/macOS) | |
if: matrix.config.os != 'windows-latest' | |
run: | | |
R CMD build . | |
- name: Build the package (Windows) | |
if: matrix.config.os == 'windows-latest' | |
shell: cmd | |
run: | | |
R CMD build . | |
#Check the package | |
- name: Check the package (Linux/macOS) | |
if: matrix.config.os != 'windows-latest' | |
run: | | |
PKG_TAR=$(ls *.tar.gz) | |
R CMD check "$PKG_TAR" --no-manual --as-cran | |
- name: Check the package (Windows) | |
if: matrix.config.os == 'windows-latest' | |
shell: cmd | |
run: | | |
FOR /F "tokens=*" %%i IN ('dir /b *.tar.gz') DO SET PKG_TAR=%%i && R CMD check "%%PKG_TAR%" --no-manual --as-cran |